linux-stable/drivers/tty
Andi Shyti f0b9d97a77 serial: ma35d1: Validate console index before assignment
The console is immediately assigned to the ma35d1 port without
checking its index. This oversight can lead to out-of-bounds
errors when the index falls outside the valid '0' to
MA35_UART_NR range. Such scenario trigges ran error like the
following:

 UBSAN: array-index-out-of-bounds in drivers/tty/serial/ma35d1_serial.c:555:51
 index -1 is out of range for type 'uart_ma35d1_port [17]

Check the index before using it and bail out with a warning.

Fixes: 930cbf92db ("tty: serial: Add Nuvoton ma35d1 serial driver support")
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Cc: Jacky Huang <ychuang3@nuvoton.com>
Cc: <stable@vger.kernel.org> # v6.5+
Link: https://lore.kernel.org/r/20231204163804.1331415-2-andi.shyti@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-07 10:48:45 +09:00
..
hvc TTY/Serial changes for 6.7-rc1 2023-11-03 15:44:25 -10:00
ipwireless tty: make tty_operations::write()'s count size_t 2023-08-11 21:12:46 +02:00
serdev serdev: Replace custom code with device_match_acpi_handle() 2023-10-27 13:04:11 +02:00
serial serial: ma35d1: Validate console index before assignment 2023-12-07 10:48:45 +09:00
vt TTY/Serial changes for 6.7-rc1 2023-11-03 15:44:25 -10:00
amiserial.c tty: make tty_operations::write()'s count size_t 2023-08-11 21:12:46 +02:00
ehv_bytechan.c tty: make tty_operations::write()'s count size_t 2023-08-11 21:12:46 +02:00
goldfish.c tty: make tty_operations::write()'s count size_t 2023-08-11 21:12:46 +02:00
Kconfig Merge commit b320441c04 ("Merge tag 'tty-6.5-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty") into tty-next 2023-08-20 14:29:37 +02:00
Makefile
mips_ejtag_fdc.c tty: make tty_operations::write()'s count size_t 2023-08-11 21:12:46 +02:00
moxa.c tty: make tty_operations::write()'s count size_t 2023-08-11 21:12:46 +02:00
mxser.c mxser: Annotate struct mxser_board with __counted_by 2023-10-03 14:35:49 +02:00
n_gsm.c tty: n_gsm: add copyright Siemens Mobility GmbH 2023-10-27 09:21:13 +02:00
n_hdlc.c tty: ldops: unify to u8 2023-08-11 21:12:47 +02:00
n_null.c tty: ldops: unify to u8 2023-08-11 21:12:47 +02:00
n_tty.c tty: invert return values of tty_{,un}throttle_safe() 2023-10-03 14:31:15 +02:00
nozomi.c tty: make tty_operations::write()'s count size_t 2023-08-11 21:12:46 +02:00
pty.c tty: make tty_operations::write()'s count size_t 2023-08-11 21:12:46 +02:00
rpmsg_tty.c tty: make tty_operations::write()'s count size_t 2023-08-11 21:12:46 +02:00
synclink_gt.c tty: make tty_operations::write()'s count size_t 2023-08-11 21:12:46 +02:00
sysrq.c tty/sysrq: replace smp_processor_id() with get_cpu() 2023-10-10 08:52:24 +02:00
tty.h tty: convert THROTTLE constants into enum 2023-10-03 14:31:16 +02:00
tty_audit.c tty: audit: unify to u8 2023-08-11 21:12:46 +02:00
tty_baudrate.c
tty_buffer.c tty: tty_buffer: use bool for 'restart' in tty_buffer_unlock_exclusive() 2023-10-03 14:31:16 +02:00
tty_io.c TTY/Serial changes for 6.7-rc1 2023-11-03 15:44:25 -10:00
tty_ioctl.c tty: convert THROTTLE constants into enum 2023-10-03 14:31:16 +02:00
tty_jobctrl.c tty: tty_jobctrl: fix pid memleak in disassociate_ctty() 2023-09-18 11:14:43 +02:00
tty_ldisc.c tty: tty_ldisc: Remove the ret variable 2023-03-09 17:11:18 +01:00
tty_ldsem.c
tty_mutex.c tty: remove TTY_MAGIC 2022-09-22 16:12:34 +02:00
tty_port.c tty: stop using ndash in kernel-doc 2023-10-03 14:31:16 +02:00
ttynull.c tty: make tty_operations::write()'s count size_t 2023-08-11 21:12:46 +02:00
vcc.c tty: vcc: Add check for kstrdup() in vcc_probe() 2023-09-18 11:14:42 +02:00