summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2018-07-15 15:39:33 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-26 08:39:38 +0200
commit442f4d1e9aa62a0b8149bc43501f44300e9f3274 (patch)
treedfa5cedacd2db5334c5183eb45486b9f1539c839
parent859a99742a95c440aa339723cf0b36b970f4f12c (diff)
downloadlinux-stable-442f4d1e9aa62a0b8149bc43501f44300e9f3274.tar.gz
linux-stable-442f4d1e9aa62a0b8149bc43501f44300e9f3274.tar.bz2
linux-stable-442f4d1e9aa62a0b8149bc43501f44300e9f3274.zip
tty: fix termios input-speed encoding
[ Upstream commit fada18c48d774b9e837928ecdce6a5d5fdd11ee7 ] Make sure to clear the CIBAUD bits before OR-ing the new mask when encoding the termios input baud rate. This could otherwise lead to an incorrect input rate being reported back and incidentally set on subsequent termios updates. Fixes: edc6afc54968 ("[PATCH] tty: switch to ktermios and new framework") Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/tty/tty_baudrate.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/tty/tty_baudrate.c b/drivers/tty/tty_baudrate.c
index d39b4f18e0d9..3e827a3d48d5 100644
--- a/drivers/tty/tty_baudrate.c
+++ b/drivers/tty/tty_baudrate.c
@@ -173,6 +173,9 @@ void tty_termios_encode_baud_rate(struct ktermios *termios,
iclose = 0;
#endif
termios->c_cflag &= ~CBAUD;
+#ifdef IBSHIFT
+ termios->c_cflag &= ~(CBAUD << IBSHIFT);
+#endif
/*
* Our goal is to find a close match to the standard baud rate