Skip to contentSkip to conversation

patch "serdev: ttyport: fix tty locking in close" added to tty-linus

PATCH [email protected] 1 participant 1 message Nov 28, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

serdev: ttyport: fix tty locking in close

to my tty git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
in the tty-linus branch.

The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)

The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.

If you have any questions about this process, please let me know.

Quoted 1 line

From 90dbad8cd6efccbdce109d5ef0724f8434a6cdde Mon Sep 17 00:00:00 2001

From: Johan Hovold <[email protected]>
Date: Fri, 3 Nov 2017 15:30:56 +0100
Subject: serdev: ttyport: fix tty locking in close

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 cd6484e1830b ("serdev: Introduce new bus for serial attached devices")
Cc stable <[email protected]>
---
 drivers/tty/serdev/serdev-ttyport.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/tty/serdev/serdev-ttyport.c +2 -0
index 12cb9139073e..247788a16f0b 100644
@@ -154,8 +154,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);
 }
Signature · 1 line
2.15.0