From a846a1954b6397e844fe1e258af7598897ec6159 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Mon, 24 Mar 2008 12:29:52 -0700 Subject: 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 Cc: Oleg Nesterov Cc: "Paul E. McKenney" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- kernel/acct.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'kernel') 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) #endif #if ACCT_VERSION==3 ac.ac_pid = current->tgid; - ac.ac_ppid = current->real_parent->tgid; + rcu_read_lock(); + ac.ac_ppid = rcu_dereference(current->real_parent)->tgid; + rcu_read_unlock(); #endif spin_lock_irq(¤t->sighand->siglock); -- cgit v1.2.2