]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
tty: make sure that proc_clear_tty stores the cpu flags
authorArjan van de Ven <arjan@linux.intel.com>
Wed, 15 Oct 2008 09:52:34 +0000 (10:52 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 15 Oct 2008 17:19:51 +0000 (10:19 -0700)
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>
drivers/char/tty_io.c

index 7053d6333692d7bd8fcd112a4dfc8bac783ccbc0..3f48d88cffc046445202cdaece8c346cb272add7 100644 (file)
@@ -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);
 }