Skip to content

Commit

Permalink
tty_open can return to userspace holding tty_mutex
Browse files Browse the repository at this point in the history
__tty_open could return (to userspace) holding the tty_mutex thanks to a
regression introduced by 4a2b5fd ("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>
  • Loading branch information
Eric Paris authored and Linus Torvalds committed Jan 27, 2009
1 parent 5ee8100 commit 808ffa3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/char/tty_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1817,8 +1817,10 @@ static int __tty_open(struct inode *inode, struct file *filp)
/* 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) {
Expand Down

0 comments on commit 808ffa3

Please sign in to comment.