aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-03-24 15:29:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-03-24 22:22:19 -0400
commita846a1954b6397e844fe1e258af7598897ec6159 (patch)
treea90b3a593d528c299fd90e9e84fe17a7cdb23733 /kernel
parent4dd4b920218326231156c7991ce5b94afad841c3 (diff)
bsd_acct: plain current->real_parent access is not always safe
This is minor, but dereferencing even current real_parent is not safe on debug kernels, since the memory, this points to, can be unmapped - RCU protection is required. Besides, the tgid field is deprecated and is to be replaced with task_tgid_xxx call (the 2nd patch), so RCU will be required anyway. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Cc: Oleg Nesterov <oleg@tv-sign.ru> Cc: "Paul E. McKenney" <paulmck@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/acct.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/acct.c b/kernel/acct.c
index 521dfa53cb99..7ff5339a3f05 100644
--- a/kernel/acct.c
+++ b/kernel/acct.c
@@ -482,7 +482,9 @@ static void do_acct_process(struct file *file)
482#endif 482#endif
483#if ACCT_VERSION==3 483#if ACCT_VERSION==3
484 ac.ac_pid = current->tgid; 484 ac.ac_pid = current->tgid;
485 ac.ac_ppid = current->real_parent->tgid; 485 rcu_read_lock();
486 ac.ac_ppid = rcu_dereference(current->real_parent)->tgid;
487 rcu_read_unlock();
486#endif 488#endif
487 489
488 spin_lock_irq(&current->sighand->siglock); 490 spin_lock_irq(&current->sighand->siglock);