mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-13 14:14:37 +00:00
serdev: ttyport: fix tty locking in close
commit90dbad8cd6
upstream. Make sure to hold the tty lock as required when calling tty-driver close() (e.g. to avoid racing with hangup()). Note that the serport active flag is currently set under the lock at controller open, but really isn't protected by it. Fixes:cd6484e183
("serdev: Introduce new bus for serial attached devices") Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
5a3da8bd93
commit
ce42ed5ae8
1 changed files with 2 additions and 0 deletions
|
@ -149,8 +149,10 @@ static void ttyport_close(struct serdev_controller *ctrl)
|
|||
|
||||
clear_bit(SERPORT_ACTIVE, &serport->flags);
|
||||
|
||||
tty_lock(tty);
|
||||
if (tty->ops->close)
|
||||
tty->ops->close(tty, NULL);
|
||||
tty_unlock(tty);
|
||||
|
||||
tty_release_struct(tty, serport->tty_idx);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue