aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/tty_io.c
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2014-10-16 13:46:38 -0400
committerBen Hutchings <ben@decadent.org.uk>2014-12-14 16:23:55 +0000
commit2eb38b7609836f81419f52a62170c2a222f7e1aa (patch)
tree9a0b1d2ba2bde16353e0c5b6d5b31ff76728992e /drivers/tty/tty_io.c
parentae11f62aeb3b9cd5222309a48611d475dad974ed (diff)
downloadkernel_samsung_smdk4412-2eb38b7609836f81419f52a62170c2a222f7e1aa.zip
kernel_samsung_smdk4412-2eb38b7609836f81419f52a62170c2a222f7e1aa.tar.gz
kernel_samsung_smdk4412-2eb38b7609836f81419f52a62170c2a222f7e1aa.tar.bz2
serial: Fix divide-by-zero fault in uart_get_divisor()
commit 547039ec502076e60034eeb79611df3433a99b7d upstream. uart_get_baud_rate() will return baud == 0 if the max rate is set to the "magic" 38400 rate and the SPD_* flags are also specified. On the first iteration, if the current baud rate is higher than the max, the baud rate is clamped at the max (which in the degenerate case is 38400). On the second iteration, the now-"magic" 38400 baud rate selects the possibly higher alternate baud rate indicated by the SPD_* flag. Since only two loop iterations are performed, the loop is exited, a kernel WARNING is generated and a baud rate of 0 is returned. Reproducible with: setserial /dev/ttyS0 spd_hi base_baud 38400 Only perform the "magic" 38400 -> SPD_* baud transform on the first loop iteration, which prevents the degenerate case from recognizing the clamped baud rate as the "magic" 38400 value. Reported-by: Robert Święcki <robert@swiecki.net> Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'drivers/tty/tty_io.c')
0 files changed, 0 insertions, 0 deletions