aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/acct.c
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2006-09-29 05:01:41 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-29 12:18:25 -0400
commiteb84a20e9e6b98dcb33023ad22241d79107a08a7 (patch)
tree4971aef730cc3a1917463afe1dbb381dea664e99 /kernel/acct.c
parent5f412b24240d92212e50ebbaff2dff20c9e6f3d0 (diff)
[PATCH] audit/accounting: tty locking
Add tty locking around the audit and accounting code. The whole current->signal-> locking is all deeply strange but it's for someone else to sort out. Add rather than replace the lock for acct.c Signed-off-by: Alan Cox <alan@redhat.com> Acked-by: Arjan van de Ven <arjan@linux.intel.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Oleg Nesterov <oleg@tv-sign.ru> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/acct.c')
-rw-r--r--kernel/acct.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/kernel/acct.c b/kernel/acct.c
index 2a7c933651c7..f4330acead46 100644
--- a/kernel/acct.c
+++ b/kernel/acct.c
@@ -483,10 +483,14 @@ static void do_acct_process(struct file *file)
483 ac.ac_ppid = current->parent->tgid; 483 ac.ac_ppid = current->parent->tgid;
484#endif 484#endif
485 485
486 read_lock(&tasklist_lock); /* pin current->signal */ 486 mutex_lock(&tty_mutex);
487 /* FIXME: Whoever is responsible for current->signal locking needs
488 to use the same locking all over the kernel and document it */
489 read_lock(&tasklist_lock);
487 ac.ac_tty = current->signal->tty ? 490 ac.ac_tty = current->signal->tty ?
488 old_encode_dev(tty_devnum(current->signal->tty)) : 0; 491 old_encode_dev(tty_devnum(current->signal->tty)) : 0;
489 read_unlock(&tasklist_lock); 492 read_unlock(&tasklist_lock);
493 mutex_unlock(&tty_mutex);
490 494
491 spin_lock_irq(&current->sighand->siglock); 495 spin_lock_irq(&current->sighand->siglock);
492 ac.ac_utime = encode_comp_t(jiffies_to_AHZ(cputime_to_jiffies(pacct->ac_utime))); 496 ac.ac_utime = encode_comp_t(jiffies_to_AHZ(cputime_to_jiffies(pacct->ac_utime)));