Skip to contentSkip to conversation

tty: make sure that proc_clear_tty stores the cpu flags

PATCH New Alan Cox 1 participant 1 message Oct 15, 2008 Char and misc drivers

lore
Share & tools
lore

Alan Cox

author
#0 lore raw

PATCH 1/1 tty: make sure that proc_clear_tty stores the cpu flags

From: Arjan van de Ven <[email protected]>

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.

---

 drivers/char/tty_io.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/char/tty_io.c +3 -2
index 7053d63..3f48d88 100644
@@ -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);
 }