Skip to content

Commit

Permalink
[PATCH] tty: fix the locking for signal->session in disassociate_ctty
Browse files Browse the repository at this point in the history
commit 24ec839 while fixing the locking for
signal->tty got the locking wrong for signal->session.  This places our
accesses of signal->session back under the tasklist_lock where they belong.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Eric W. Biederman authored and Linus Torvalds committed Feb 12, 2007
1 parent 680a967 commit 2ea8186
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/char/tty_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1496,7 +1496,6 @@ void disassociate_ctty(int on_exit)
{
struct tty_struct *tty;
int tty_pgrp = -1;
int session;

lock_kernel();

Expand Down Expand Up @@ -1530,7 +1529,6 @@ void disassociate_ctty(int on_exit)

spin_lock_irq(&current->sighand->siglock);
current->signal->tty_old_pgrp = 0;
session = process_session(current);
spin_unlock_irq(&current->sighand->siglock);

mutex_lock(&tty_mutex);
Expand All @@ -1549,7 +1547,7 @@ void disassociate_ctty(int on_exit)

/* Now clear signal->tty under the lock */
read_lock(&tasklist_lock);
session_clear_tty(session);
session_clear_tty(process_session(current));
read_unlock(&tasklist_lock);
unlock_kernel();
}
Expand Down

0 comments on commit 2ea8186

Please sign in to comment.