Skip to content

Commit

Permalink
tty: make sure that proc_clear_tty stores the cpu flags
Browse files Browse the repository at this point in the history
proc_clear_tty() gets called with interrupts off (while holding the task list
lock) from sys_setid. This means that it needs the _irqsave version of the
locking primitives.

Reported-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Tested-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Arjan van de Ven authored and Linus Torvalds committed Oct 15, 2008
1 parent 6d54aaf commit 7c3b1dc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/char/tty_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -3032,11 +3032,12 @@ EXPORT_SYMBOL(tty_devnum);

void proc_clear_tty(struct task_struct *p)
{
unsigned long flags;
struct tty_struct *tty;
spin_lock_irq(&p->sighand->siglock);
spin_lock_irqsave(&p->sighand->siglock, flags);
tty = p->signal->tty;
p->signal->tty = NULL;
spin_unlock_irq(&p->sighand->siglock);
spin_unlock_irqrestore(&p->sighand->siglock, flags);
tty_kref_put(tty);
}

Expand Down

0 comments on commit 7c3b1dc

Please sign in to comment.