Commit 808ffa3d authored by Eric Paris's avatar Eric Paris Committed by Linus Torvalds

tty_open can return to userspace holding tty_mutex

__tty_open could return (to userspace) holding the tty_mutex thanks to a
regression introduced by 4a2b5fdd ("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: default avatarEric Paris <eparis@redhat.com>
Signed-off-by: default avatarAlan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 5ee81007
...@@ -1817,9 +1817,11 @@ got_driver: ...@@ -1817,9 +1817,11 @@ got_driver:
/* check whether we're reopening an existing tty */ /* check whether we're reopening an existing tty */
tty = tty_driver_lookup_tty(driver, inode, index); tty = tty_driver_lookup_tty(driver, inode, index);
if (IS_ERR(tty)) if (IS_ERR(tty)) {
mutex_unlock(&tty_mutex);
return PTR_ERR(tty); return PTR_ERR(tty);
} }
}
if (tty) { if (tty) {
retval = tty_reopen(tty); retval = tty_reopen(tty);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment