Commit 7285840f authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] BSD accounting oops fix

oopses have been reported in do_acct_process(), with premption enabled, when
threaded applications are exitting.

It appears that we're racing with another thread which is nulling out
current->tty.  I think this race is still there after we moved current->tty
into current->signal->tty, so let's take the needed lock.
parent 177ddd52
......@@ -347,7 +347,11 @@ static void do_acct_process(long exitcode, struct file *file)
/* we really need to bite the bullet and change layout */
ac.ac_uid = current->uid;
ac.ac_gid = current->gid;
ac.ac_tty = current->signal->tty ? old_encode_dev(tty_devnum(current->signal->tty)) : 0;
read_lock(&tasklist_lock); /* pin current->signal */
ac.ac_tty = current->signal->tty ?
old_encode_dev(tty_devnum(current->signal->tty)) : 0;
read_unlock(&tasklist_lock);
ac.ac_flag = 0;
if (current->flags & PF_FORKNOEXEC)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment