From af892d9d7beb8d3dd7b286fe533f868e76fc4b76 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Mon, 17 Aug 2009 19:49:19 +0200 Subject: [072/254] tty: Do not disable interrupts in put_ldisc on -rt Fixes the following on PREEMPT_RT: BUG: sleeping function called from invalid context at kernel/rtmutex.c:684 in_atomic(): 0, irqs_disabled(): 1, pid: 9116, name: sshd Pid: 9116, comm: sshd Not tainted 2.6.31-rc6-rt2 #6 Call Trace: [] __might_sleep+0xec/0xee [] rt_spin_lock+0x34/0x75 [ffffffff81064a83>] atomic_dec_and_spin_lock+0x36/0x54 [] put_ldisc+0x57/0xa6 [] tty_ldisc_hangup+0xe7/0x19f [] do_tty_hangup+0xff/0x319 [] tty_vhangup+0x15/0x17 [] pty_close+0x127/0x12b [] tty_release_dev+0x1ad/0x4c0 .... Signed-off-by: Thomas Gleixner --- drivers/tty/tty_ldisc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c index 24b95db..7894759 100644 --- a/drivers/tty/tty_ldisc.c +++ b/drivers/tty/tty_ldisc.c @@ -53,7 +53,7 @@ static void put_ldisc(struct tty_ldisc *ld) * We really want an "atomic_dec_and_lock_irqsave()", * but we don't have it, so this does it by hand. */ - local_irq_save(flags); + local_irq_save_nort(flags); if (atomic_dec_and_lock(&ld->users, &tty_ldisc_lock)) { struct tty_ldisc_ops *ldo = ld->ops; @@ -64,7 +64,7 @@ static void put_ldisc(struct tty_ldisc *ld) kfree(ld); return; } - local_irq_restore(flags); + local_irq_restore_nort(flags); wake_up(&tty_ldisc_idle); }