sys_getppid: add missing rcu_dereference
authorMandeep Singh Baines <[email protected]>
Thu, 8 Dec 2011 22:34:44 +0000 (14:34 -0800)
committerLinus Torvalds <[email protected]>
Fri, 9 Dec 2011 15:50:29 +0000 (07:50 -0800)
In order to safely dereference current->real_parent inside an
rcu_read_lock, we need an rcu_dereference.

Signed-off-by: Mandeep Singh Baines <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Pavel Emelyanov <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: Kees Cook <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
kernel/timer.c

index dbaa62422b13c057754252d986f97440ec7dd3af..9c3c62b0c4bc89ebd307ff79950039021d157861 100644 (file)
@@ -1368,7 +1368,7 @@ SYSCALL_DEFINE0(getppid)
        int pid;
 
        rcu_read_lock();
-       pid = task_tgid_vnr(current->real_parent);
+       pid = task_tgid_vnr(rcu_dereference(current->real_parent));
        rcu_read_unlock();
 
        return pid;