diff options
author | Alan Cox <alan@linux.intel.com> | 2009-06-16 12:01:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-16 15:01:16 -0400 |
commit | 1aa4bed82a684308f54bf782cffaecd4b1dc3cf4 (patch) | |
tree | a629a5c25caf3880a23bda9af4404c86a8a5ad00 /drivers/char/tty_io.c | |
parent | 762faaed91e4ea4a3c34bc58f3221d9487acb470 (diff) |
tty: fix sanity check
The WARN_ON() that was added to tty_reopen can be triggered in the specific
case of a hangup occurring during a re-open of a tty which is not in the
middle of being otherwise closed.
In that case however the WARN() is bogus as we don't hold the neccessary
locks to make a correct decision.
The case we should be checking is "if the ldisc is not changing and reopen
is occuring". We could drop the WARN_ON but for the moment the debug is more
valuable even if it means taking a mutex as it will find any other cases.
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/tty_io.c')
-rw-r--r-- | drivers/char/tty_io.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 939e198d7670..a3afa0c387cd 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -1263,7 +1263,9 @@ static int tty_reopen(struct tty_struct *tty) | |||
1263 | tty->count++; | 1263 | tty->count++; |
1264 | tty->driver = driver; /* N.B. why do this every time?? */ | 1264 | tty->driver = driver; /* N.B. why do this every time?? */ |
1265 | 1265 | ||
1266 | mutex_lock(&tty->ldisc_mutex); | ||
1266 | WARN_ON(!test_bit(TTY_LDISC, &tty->flags)); | 1267 | WARN_ON(!test_bit(TTY_LDISC, &tty->flags)); |
1268 | mutex_unlock(&tty->ldisc_mutex); | ||
1267 | 1269 | ||
1268 | return 0; | 1270 | return 0; |
1269 | } | 1271 | } |