WSL2-Linux-Kernel/drivers/tty/serial
George Kennedy 9196e42a3b serial: core: check uartclk for zero to avoid divide by zero
commit 6eabce6608d6f3440f4c03aa3d3ef50a47a3d193 upstream.

Calling ioctl TIOCSSERIAL with an invalid baud_base can
result in uartclk being zero, which will result in a
divide by zero error in uart_get_divisor(). The check for
uartclk being zero in uart_set_info() needs to be done
before other settings are made as subsequent calls to
ioctl TIOCSSERIAL for the same port would be impacted if
the uartclk check was done where uartclk gets set.

Oops: divide error: 0000  PREEMPT SMP KASAN PTI
RIP: 0010:uart_get_divisor (drivers/tty/serial/serial_core.c:580)
Call Trace:
 <TASK>
serial8250_get_divisor (drivers/tty/serial/8250/8250_port.c:2576
    drivers/tty/serial/8250/8250_port.c:2589)
serial8250_do_set_termios (drivers/tty/serial/8250/8250_port.c:502
    drivers/tty/serial/8250/8250_port.c:2741)
serial8250_set_termios (drivers/tty/serial/8250/8250_port.c:2862)
uart_change_line_settings (./include/linux/spinlock.h:376
    ./include/linux/serial_core.h:608 drivers/tty/serial/serial_core.c:222)
uart_port_startup (drivers/tty/serial/serial_core.c:342)
uart_startup (drivers/tty/serial/serial_core.c:368)
uart_set_info (drivers/tty/serial/serial_core.c:1034)
uart_set_info_user (drivers/tty/serial/serial_core.c:1059)
tty_set_serial (drivers/tty/tty_io.c:2637)
tty_ioctl (drivers/tty/tty_io.c:2647 drivers/tty/tty_io.c:2791)
__x64_sys_ioctl (fs/ioctl.c:52 fs/ioctl.c:907
    fs/ioctl.c:893 fs/ioctl.c:893)
do_syscall_64 (arch/x86/entry/common.c:52
    (discriminator 1) arch/x86/entry/common.c:83 (discriminator 1))
entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130)

Reported-by: syzkaller <syzkaller@googlegroups.com>
Cc: stable@vger.kernel.org
Signed-off-by: George Kennedy <george.kennedy@oracle.com>
Rule: add
Link: https://lore.kernel.org/stable/1721148848-9784-1-git-send-email-george.kennedy%40oracle.com
Link: https://lore.kernel.org/r/1721219078-3209-1-git-send-email-george.kennedy@oracle.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-08-19 05:45:46 +02:00
..
8250 serial: 8250_omap: Fix Errata i2310 with RX FIFO level check 2024-07-05 09:14:52 +02:00
cpm_uart serial: cpm_uart: Avoid suspicious locking 2023-09-23 11:09:59 +02:00
jsm drivers: serial: jsm: fix some leaks in probe 2022-10-26 12:35:13 +02:00
21285.c
Kconfig
Makefile
altera_jtaguart.c
altera_uart.c serial: altera_uart: fix locking in polling mode 2022-12-31 13:14:28 +01:00
amba-pl010.c serial: pl010: Drop CR register reset on set_termios 2022-01-27 11:04:54 +01:00
amba-pl011.c serial: amba-pl011: Fix DMA transmission in RS485 mode 2024-03-01 13:21:49 +01:00
amba-pl011.h
apbuart.c
apbuart.h
ar933x_uart.c serial: ar933x: Deassert Transmit Enable on ->rs485_config() 2022-11-10 18:15:24 +01:00
arc_uart.c serial: arc_uart: fix of_iomap leak in `arc_serial_probe` 2023-05-24 17:36:50 +01:00
atmel_serial.c serial: atmel: don't enable IRQs prematurely 2023-07-23 13:47:53 +02:00
atmel_serial.h
bcm63xx_uart.c
clps711x.c
digicolor-usart.c serial: digicolor-usart: Don't allow CS5-6 2022-06-14 18:36:08 +02:00
dz.c
dz.h
earlycon-arm-semihost.c
earlycon-riscv-sbi.c
earlycon.c
fsl_linflexuart.c
fsl_lpuart.c tty: serial: fsl_lpuart: avoid idle preamble pending if CTS is enabled 2024-04-10 16:18:45 +02:00
icom.c tty: Fix a possible resource leak in icom_probe 2022-06-14 18:36:20 +02:00
icom.h
imx.c serial: imx: Introduce timeout when waiting on transmitter empty 2024-07-05 09:14:28 +02:00
imx_earlycon.c
ip22zilog.c
ip22zilog.h
kgdb_nmi.c
kgdboc.c serial: kgdboc: Fix NMI-safety problems from keyboard reset code 2024-05-25 16:20:18 +02:00
lantiq.c serial: lantiq: add missing interrupt ack 2023-06-21 15:59:15 +02:00
liteuart.c serial: liteuart: fix MODULE_ALIAS 2022-01-27 11:03:55 +01:00
lpc32xx_hs.c tty: drivers/tty/, stop using tty_schedule_flip() 2022-07-29 17:25:31 +02:00
max310x.c serial: max310x: fix syntax error in IRQ error message 2024-03-26 18:21:34 -04:00
max3100.c serial: max3100: Fix bitwise types 2024-06-16 13:39:35 +02:00
mcf.c tty: mcf: MCF54418 has 10 UARTS 2024-07-05 09:14:47 +02:00
men_z135_uart.c
meson_uart.c tty: serial: meson: fix hard LOCKUP on crtscts mode 2023-11-28 16:56:32 +00:00
milbeaut_usio.c
mpc52xx_uart.c
mps2-uart.c
msm_serial.c serial: msm_serial: disable interrupts in __msm_console_write() 2022-06-14 18:36:22 +02:00
mux.c
mvebu-uart.c serial: mvebu-uart: uart2 error bits clearing 2022-08-17 14:22:56 +02:00
mxs-auart.c serial: mxs-auart: add spinlock around changing cts state 2024-05-02 16:24:47 +02:00
omap-serial.c
owl-uart.c tty: serial: owl: Fix missing clk_disable_unprepare() in owl_uart_probe 2022-06-14 18:36:03 +02:00
pch_uart.c tty: pcn_uart: fix memory leak with using debugfs_lookup() 2023-03-11 13:57:37 +01:00
pic32_uart.c
pic32_uart.h
pmac_zilog.c serial/pmac_zilog: Remove flawed mitigation for rx irq flood 2024-04-27 17:05:27 +02:00
pmac_zilog.h
pxa.c
qcom_geni_serial.c serial: qcom-geni: fix opp vote on shutdown 2023-09-06 21:28:39 +01:00
rda-uart.c serial: rda-uart: Don't allow CS5-6 2022-06-14 18:36:08 +02:00
rp2.c
sa1100.c drivers: tty: serial: Fix deadlock in sa1100_set_termios() 2022-06-14 18:36:21 +02:00
samsung_tty.c tty: serial: samsung: fix tx_empty() to return TIOCSER_TEMT 2024-03-26 18:21:34 -04:00
sb1250-duart.c
sc16is7xx.c serial: sc16is7xx: fix bug in sc16is7xx_set_baud() when using prescaler 2024-07-05 09:14:12 +02:00
sccnxp.c
serial-tegra.c serial: tegra: handle clk prepare error in tegra_uart_hw_init() 2023-09-19 12:22:47 +02:00
serial_core.c serial: core: check uartclk for zero to avoid divide by zero 2024-08-19 05:45:46 +02:00
serial_mctrl_gpio.c
serial_mctrl_gpio.h
serial_txx9.c serial: txx9: Don't allow CS5-6 2022-06-14 18:36:08 +02:00
sh-sci.c serial: sh-sci: protect invalidating RXDMA on shutdown 2024-06-16 13:39:40 +02:00
sh-sci.h
sifive.c serial: sifive: Fix sifive_serial_console_setup() section 2023-08-03 10:22:41 +02:00
sprd_serial.c serial: sprd: Fix DMA buffer leak issue 2023-09-19 12:22:45 +02:00
st-asc.c serial: st-asc: Sanitize CSIZE and correct PARENB for CS7 2022-06-14 18:36:08 +02:00
stm32-usart.c serial: stm32: rework RX over DMA 2024-07-05 09:14:33 +02:00
stm32-usart.h serial: stm32: rework RX over DMA 2024-07-05 09:14:33 +02:00
suncore.c
sunhv.c
sunsab.c serial: sunsab: Fix error handling in sunsab_init() 2022-12-31 13:14:28 +01:00
sunsab.h
sunsu.c
sunzilog.c
sunzilog.h
tegra-tcu.c serial: tegra-tcu: Use uart_xmit_advance(), fixes icount.tx accounting 2022-09-28 11:11:54 +02:00
timbuart.c
timbuart.h
uartlite.c tty: serial: uartlite: allow 64 bit address 2022-01-27 11:03:25 +01:00
ucc_uart.c tty: serial: Fix refcount leak bug in ucc_uart.c 2022-08-25 11:40:40 +02:00
vr41xx_siu.c
vt8500_serial.c
xilinx_uartps.c tty: xilinx_uartps: Fix the ignore_status 2022-10-26 12:35:05 +02:00
zs.c
zs.h