]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
tty_open can return to userspace holding tty_mutex
authorEric Paris <eparis@redhat.com>
Tue, 27 Jan 2009 11:50:37 +0000 (11:50 +0000)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 27 Jan 2009 15:37:15 +0000 (07:37 -0800)
__tty_open could return (to userspace) holding the tty_mutex thanks to a
regression introduced by 4a2b5fddd53b80efcb3266ee36e23b8de28e761a ("Move
tty lookup/reopen to caller").

This was found by bisecting an fsfuzzer problem.  Admittedly I have no
idea how it managed to tickle this 100% reliably, but it is clearly a
regression and when hit leaves the box in a completely unusable state.
This patch lets the fsfuzzer test complete every time.

Signed-off-by: Eric Paris <eparis@redhat.com>
Signed-off-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/char/tty_io.c

index d33e5ab061779a67e63b305b30b29d01f6fe38ca..bc84e125c6bc428ca1d51cbcb29909466ea96b87 100644 (file)
@@ -1817,8 +1817,10 @@ got_driver:
                /* check whether we're reopening an existing tty */
                tty = tty_driver_lookup_tty(driver, inode, index);
 
-               if (IS_ERR(tty))
+               if (IS_ERR(tty)) {
+                       mutex_unlock(&tty_mutex);
                        return PTR_ERR(tty);
+               }
        }
 
        if (tty) {