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.


---

 25-akpm/kernel/acct.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletion(-)

diff -puN kernel/acct.c~acct-oops-fix kernel/acct.c
--- 25/kernel/acct.c~acct-oops-fix	2004-04-09 04:10:54.206998040 -0700
+++ 25-akpm/kernel/acct.c	2004-04-09 04:13:47.835602480 -0700
@@ -347,7 +347,11 @@ static void do_acct_process(long exitcod
 	/* 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)

_