From ef44c6c1e86fa89f20d27713d7268d7c7689af5c Mon Sep 17 00:00:00 2001 From: Ilpo Järvinen Date: Thu, 19 May 2022 11:18:08 +0300 Subject: pcmcia: synclink_cs: Don't allow CS5-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only CS7 and CS8 seem supported but CSIZE was not sanitized in termios c_cflag. The driver sets 7 bits whenever data_bits is not 8 so default to CS7 when CSIZE is not CS8. Signed-off-by: Ilpo Järvinen Link: https://lore.kernel.org/r/20220519081808.3776-10-ilpo.jarvinen@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- drivers/char/pcmcia/synclink_cs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'drivers/char') diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index c20f2cb784e8..0daf1bc95360 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c @@ -1418,7 +1418,11 @@ static void mgslpc_change_params(MGSLPC_INFO *info, struct tty_struct *tty) info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR); /* byte size and parity */ - + if ((cflag & CSIZE) != CS8) { + cflag &= ~CSIZE; + cflag |= CS7; + tty->termios.c_cflag = cflag; + } info->params.data_bits = tty_get_char_size(cflag); if (cflag & CSTOPB) -- cgit v1.2.3-59-g8ed1b