tty: make sure that proc_clear_tty stores the cpu flags

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Wednesday, October 15, 2008 - 12:09 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7c3b1d...
Commit:     7c3b1dcf13d5660152e02c6dea47b0bd9fd5d871
Parent:     6d54aaf389bb47f30fd6567b88665689967be642
Author:     Arjan van de Ven <arjan@linux.intel.com>
AuthorDate: Wed Oct 15 10:52:34 2008 +0100
Committer:  Linus Torvalds <torvalds@linux-foundation.org>
CommitDate: Wed Oct 15 10:19:51 2008 -0700

    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>
---
 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 7053d63..3f48d88 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);
 }
 
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
tty: make sure that proc_clear_tty stores the cpu flags, Linux Kernel Mailing ..., (Wed Oct 15, 12:09 pm)