From: Arjan van de Ven <arjan@linux.intel.com>
Date: Wed, 15 Oct 2008 09:52:34 +0000 (+0100)
Subject: tty: make sure that proc_clear_tty stores the cpu flags
X-Git-Tag: v2.6.28-rc1~565
X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=7c3b1dcf13d5660152e02c6dea47b0bd9fd5d871;p=linux-2.6-omap-h63xx.git

tty: make sure that proc_clear_tty stores the cpu flags

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>
---

diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 7053d633369..3f48d88cffc 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -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);
 }