diff options
author | Johan Hovold <johan@kernel.org> | 2017-05-11 11:41:21 +0200 |
---|---|---|
committer | Johan Hovold <johan@kernel.org> | 2017-05-15 11:52:04 +0200 |
commit | 6aeb75e6adfaed16e58780309613a578fe1ee90b (patch) | |
tree | 4dfbc9180a80ceffbcf043c58f2fd82cd754138b /drivers/usb/serial | |
parent | USB: serial: mct_u232: fix big-endian baud-rate handling (diff) | |
download | linux-6aeb75e6adfaed16e58780309613a578fe1ee90b.tar.xz linux-6aeb75e6adfaed16e58780309613a578fe1ee90b.zip |
USB: serial: io_ti: fix div-by-zero in set_termios
Fix a division-by-zero in set_termios when debugging is enabled and a
high-enough speed has been requested so that the divisor value becomes
zero.
Instead of just fixing the offending debug statement, cap the baud rate
at the base as a zero divisor value also appears to crash the firmware.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable <stable@vger.kernel.org> # 2.6.12
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r-- | drivers/usb/serial/io_ti.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 87798e625d6c..6cefb9cb133d 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c @@ -2336,8 +2336,11 @@ static void change_port_settings(struct tty_struct *tty, if (!baud) { /* pick a default, any default... */ baud = 9600; - } else + } else { + /* Avoid a zero divisor. */ + baud = min(baud, 461550); tty_encode_baud_rate(tty, baud, baud); + } edge_port->baud_rate = baud; config->wBaudRate = (__u16)((461550L + baud/2) / baud); |