bsd_acct: plain current->real_parent access is not always safe
[sfrench/cifs-2.6.git] / kernel / acct.c
index cf19547cc9e42d346c49b0e51e89aa5fb19364d6..7ff5339a3f058d50f3bbbdffcae8c8a38145ec19 100644 (file)
@@ -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->parent->tgid;
+       rcu_read_lock();
+       ac.ac_ppid = rcu_dereference(current->real_parent)->tgid;
+       rcu_read_unlock();
 #endif
 
        spin_lock_irq(&current->sighand->siglock);