summaryrefslogtreecommitdiffstats
path: root/tty-Do-not-disable-interrupts-in-put_ldisc-on-rt.patch
blob: 7973e419f8bfbd591477ba8517d8cc9b7e9a367b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
From c47880579954454c07c8449c2d4a2f871b1a3d95 Mon Sep 17 00:00:00 2001
From: Thomas Gleixner <tglx@linutronix.de>
Date: Mon, 17 Aug 2009 19:49:19 +0200
Subject: [PATCH] tty: Do not disable interrupts in put_ldisc on -rt

commit b67602a5975990e35c964312a9da333e594e3840 in tip.

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:
[<ffffffff81034a4f>] __might_sleep+0xec/0xee
[<ffffffff812fbc6d>] rt_spin_lock+0x34/0x75
[ffffffff81064a83>] atomic_dec_and_spin_lock+0x36/0x54
[<ffffffff811df7c7>] put_ldisc+0x57/0xa6
[<ffffffff811dfb87>] tty_ldisc_hangup+0xe7/0x19f
[<ffffffff811d9224>] do_tty_hangup+0xff/0x319
[<ffffffff811d9453>] tty_vhangup+0x15/0x17
[<ffffffff811e1263>] pty_close+0x127/0x12b
[<ffffffff811dac41>] tty_release_dev+0x1ad/0x4c0
....

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/char/tty_ldisc.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/char/tty_ldisc.c b/drivers/char/tty_ldisc.c
index 500e740..5375232 100644
--- a/drivers/char/tty_ldisc.c
+++ b/drivers/char/tty_ldisc.c
@@ -71,7 +71,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;
 
@@ -82,7 +82,7 @@ static void put_ldisc(struct tty_ldisc *ld)
 		kfree(ld);
 		return;
 	}
-	local_irq_restore(flags);
+	local_irq_restore_nort(flags);
 }
 
 /**
-- 
1.7.0.4