[PATCH] tty: make sure that proc_clear_tty stores the cpu flags

From: Arjan van de Ven
Date: Mon Oct 13 2008 - 14:56:39 EST


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@xxxxxxxxx>
Signed-off-by: Arjan van de Ven <arjan@xxxxxxxxxxxxxxx>
---
drivers/char/tty_io.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index e4dce87..4715961 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -3595,9 +3595,10 @@ EXPORT_SYMBOL(tty_devnum);

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

/* Called under the sighand lock */
--
1.5.5.1



--
Arjan van de Ven Intel Open Source Technology Centre
For development, discussion and tips for power savings,
visit http://www.lesswatts.org
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/