]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/2.6.36.2/tty-ldisc-fix-open-flag-handling.patch
fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 2.6.36.2 / tty-ldisc-fix-open-flag-handling.patch
1 From 7f90cfc505d613f4faf096e0d84ffe99208057d9 Mon Sep 17 00:00:00 2001
2 From: Jiri Slaby <jslaby@suse.cz>
3 Date: Thu, 25 Nov 2010 00:27:54 +0100
4 Subject: TTY: ldisc, fix open flag handling
5
6 From: Jiri Slaby <jslaby@suse.cz>
7
8 commit 7f90cfc505d613f4faf096e0d84ffe99208057d9 upstream.
9
10 When a concrete ldisc open fails in tty_ldisc_open, we forget to clear
11 TTY_LDISC_OPEN. This causes a false warning on the next ldisc open:
12 WARNING: at drivers/char/tty_ldisc.c:445 tty_ldisc_open+0x26/0x38()
13 Hardware name: System Product Name
14 Modules linked in: ...
15 Pid: 5251, comm: a.out Tainted: G W 2.6.32-5-686 #1
16 Call Trace:
17 [<c1030321>] ? warn_slowpath_common+0x5e/0x8a
18 [<c1030357>] ? warn_slowpath_null+0xa/0xc
19 [<c119311c>] ? tty_ldisc_open+0x26/0x38
20 [<c11936c5>] ? tty_set_ldisc+0x218/0x304
21 ...
22
23 So clear the bit when failing...
24
25 Introduced in c65c9bc3efa (tty: rewrite the ldisc locking) back in
26 2.6.31-rc1.
27
28 Signed-off-by: Jiri Slaby <jslaby@suse.cz>
29 Cc: Alan Cox <alan@linux.intel.com>
30 Reported-by: Sergey Lapin <slapin@ossfans.org>
31 Tested-by: Sergey Lapin <slapin@ossfans.org>
32 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
33
34 ---
35 drivers/char/tty_ldisc.c | 2 ++
36 1 file changed, 2 insertions(+)
37
38 --- a/drivers/char/tty_ldisc.c
39 +++ b/drivers/char/tty_ldisc.c
40 @@ -454,6 +454,8 @@ static int tty_ldisc_open(struct tty_str
41 /* BTM here locks versus a hangup event */
42 WARN_ON(!tty_locked());
43 ret = ld->ops->open(tty);
44 + if (ret)
45 + clear_bit(TTY_LDISC_OPEN, &tty->flags);
46 return ret;
47 }
48 return 0;