summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2026-10-27 12:06:42 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-11-03 13:28:52 +0100
commit08daebfd63e9054e097eb2653eff9381de43a422 (patch)
tree56a6e9806995dfeb304bf9dc0861faaedf5fe704 /scripts
parent84da8238f7bd3025fc16da32c4cd9992c95a783b (diff)
serial: 8250_lpss: don't divide by 0 above 6.25 Mbaud
byt_set_termios() derives the clock of the UART from the baud rate in the termios, which nobody has looked at yet: fuart = baud * 16; ... fuart *= rounddown_pow_of_two(fref / fuart); ... p->uartclk = fuart; fref is 100 MHz. For a baud rate above 6250000, which BOTHER allows, fref / fuart is 0, and rounddown_pow_of_two(0) shifts 1UL by -1. On x86 that is 1UL << 63, the product with a multiple of 16 is 0, and so is uartclk. serial8250_get_baud_rate() then passes 0 for both limits, uart_get_baud_rate() finds no rate which fits, WARNs and returns 0, and uart_get_divisor() or dw8250_get_divisor() divide by 16 * 0. Everybody who may open the tty can oops the kernel with one TCSETS2. Don't ask for more than fref. The limits are those of a 100 MHz clock then, and uart_get_baud_rate() falls back to the old rate as for any other rate that the port cannot do. 8250_mid, which has the same formula, treats this case separately. Fixes: 21947ba654a6 ("serial: 8250_pci: replace switch-case by formula") Cc: stable <stable@kernel.org> Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Jiri Slaby <jirislaby@kernel.org> Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com> Cc: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://patch.msgid.link/20261027-tty-llm-v1-16-99b0202ae546@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions