[SRU][B][PATCH 01/10] serdev: ttyport: release tty lock sooner on open

Shrirang Bagul shrirang.bagul at canonical.com
Fri Feb 21 06:41:18 UTC 2020


From: Johan Hovold <johan at kernel.org>

BugLink: https://bugs.launchpad.net/bugs/1864147

Release the tty lock once tty-driver open returns to make it clear that
it does not protect neither tty->termios or the serport flags.

linux-oem buglink: http://bugs.launchpad.net/bugs/1769610

Signed-off-by: Johan Hovold <johan at kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
(cherry picked from commit 51899a63b42ee01df676b0624df4e81a517c3571)
Signed-off-by: Shrirang Bagul <shrirang.bagul at canonical.com>
Signed-off-by: AceLan Kao <acelan.kao at canonical.com>
(cherry picked from commit 03cd12a5bd08d48898e0293fa86bef5bae515da2)
(source tag: Ubuntu-oem-4.15.0-1073.83)
Signed-off-by: Shrirang Bagul <shrirang.bagul at canonical.com>
---
 drivers/tty/serdev/serdev-ttyport.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serdev/serdev-ttyport.c b/drivers/tty/serdev/serdev-ttyport.c
index 247788a16f0b..f892fbe08208 100644
--- a/drivers/tty/serdev/serdev-ttyport.c
+++ b/drivers/tty/serdev/serdev-ttyport.c
@@ -122,6 +122,8 @@ static int ttyport_open(struct serdev_controller *ctrl)
 	if (ret)
 		goto err_close;
 
+	tty_unlock(serport->tty);
+
 	/* Bring the UART into a known 8 bits no parity hw fc state */
 	ktermios = tty->termios;
 	ktermios.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP |
@@ -135,7 +137,6 @@ static int ttyport_open(struct serdev_controller *ctrl)
 
 	set_bit(SERPORT_ACTIVE, &serport->flags);
 
-	tty_unlock(serport->tty);
 	return 0;
 
 err_close:
-- 
2.17.1




More information about the kernel-team mailing list