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
6 From: Jiri Slaby <jslaby@suse.cz>
8 commit 7f90cfc505d613f4faf096e0d84ffe99208057d9 upstream.
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
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
23 So clear the bit when failing...
25 Introduced in c65c9bc3efa (tty: rewrite the ldisc locking) back in
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>
35 drivers/char/tty_ldisc.c | 2 ++
36 1 file changed, 2 insertions(+)
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);
45 + clear_bit(TTY_LDISC_OPEN, &tty->flags);