mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-25 02:09:42 +00:00
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: 1da177e4c3
("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>
This commit is contained in:
parent
26cede3436
commit
6aeb75e6ad
1 changed files with 4 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue