summaryrefslogtreecommitdiff
path: root/drivers/tty/tty_baudrate.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2018-07-15 16:39:33 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-26 09:38:11 +0300
commit49c90d012ab47625e0b41a1d8d49b3ce1ca8a5a7 (patch)
treea334df2f9eaae680a904838f88053b6a2045d599 /drivers/tty/tty_baudrate.c
parent3c11fe1edaff491fd43fc9270282e04981621d99 (diff)
downloadlinux-49c90d012ab47625e0b41a1d8d49b3ce1ca8a5a7.tar.xz
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>
Diffstat (limited to 'drivers/tty/tty_baudrate.c')
-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 8457bb941e1a..ebc797fc1afd 100644
--- a/drivers/tty/tty_baudrate.c
+++ b/drivers/tty/tty_baudrate.c
@@ -172,6 +172,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