[PARISC] be more defensive in process.c::get_wchan
[sfrench/cifs-2.6.git] / arch / parisc / kernel / process.c
index 2f9f9dfa66f7ba557d2a9158ffae6cfbe13a29dd..355664812b8319e1d0c9b01115fd4dbe162f8dc2 100644 (file)
@@ -13,7 +13,7 @@
  *    Copyright (C) 2000 Grant Grundler <grundler with parisc-linux.org>
  *    Copyright (C) 2001 Alan Modra <amodra at parisc-linux.org>
  *    Copyright (C) 2001-2002 Ryan Bradetich <rbrad at parisc-linux.org>
- *    Copyright (C) 2001-2002 Helge Deller <deller at parisc-linux.org>
+ *    Copyright (C) 2001-2007 Helge Deller <deller at parisc-linux.org>
  *    Copyright (C) 2002 Randolph Chung <tausq with parisc-linux.org>
  *
  *
@@ -303,7 +303,7 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
                 * Copy function and argument to be called from
                 * ret_from_kernel_thread.
                 */
-#ifdef __LP64__
+#ifdef CONFIG_64BIT
                cregs->gr[27] = pregs->gr[27];
 #endif
                cregs->gr[26] = pregs->gr[26];
@@ -355,8 +355,8 @@ asmlinkage int sys_execve(struct pt_regs *regs)
        error = PTR_ERR(filename);
        if (IS_ERR(filename))
                goto out;
-       error = do_execve(filename, (char __user **) regs->gr[25],
-               (char __user **) regs->gr[24], regs);
+       error = do_execve(filename, (char __user * __user *) regs->gr[25],
+               (char __user * __user *) regs->gr[24], regs);
        if (error == 0) {
                task_lock(current);
                current->ptrace &= ~PT_DTRACE;
@@ -381,6 +381,10 @@ get_wchan(struct task_struct *p)
        struct unwind_frame_info info;
        unsigned long ip;
        int count = 0;
+
+       if (!p || p == current || p->state == TASK_RUNNING)
+               return 0;
+
        /*
         * These bracket the sleeping functions..
         */