Skip to contentSkip to conversation

Patch "serdev: ttyport: fix tty locking in close" has been added to the 4.14-stable tree

PATCH [email protected] 1 participant 1 message Dec 10, 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 the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
serdev-ttyport-fix-tty-locking-in-close.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

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

From: Johan Hovold <[email protected]>

commit 90dbad8cd6efccbdce109d5ef0724f8434a6cdde 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 cd6484e1830b ("serdev: Introduce new bus for serial attached devices")
---
 drivers/tty/serdev/serdev-ttyport.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/tty/serdev/serdev-ttyport.c +2 -0
@@ -149,8 +149,10 @@ static void ttyport_close(struct serdev_
 
 	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);
 }

Patches currently in stable-queue which might be from [email protected] are

queue-4.14/serdev-ttyport-fix-null-deref-on-hangup.patch queue-4.14/serdev-ttyport-fix-tty-locking-in-close.patch queue-4.14/serdev-ttyport-add-missing-receive_buf-sanity-checks.patch