linux/drivers/tty
Alexey Kardashevskiy 2f70e49ed8 serial_core: Check for port state when tty is in error state
At the moment opening a serial device node (such as /dev/ttyS3)
succeeds even if there is no actual serial device behind it.
Reading/writing/ioctls fail as expected because the uart port is not
initialized (the type is PORT_UNKNOWN) and the TTY_IO_ERROR error state
bit is set fot the tty.

However setting line discipline does not have these checks
8250_port.c (8250 is the default choice made by univ8250_console_init()).
As the result of PORT_UNKNOWN, uart_port::iobase is NULL which
a platform translates onto some address accessing which produces a crash
like below.

This adds tty_port_initialized() to uart_set_ldisc() to prevent the crash.

Found by syzkaller.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Link: https://lore.kernel.org/r/20201203055834.45838-1-aik@ozlabs.ru
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-12-09 15:34:37 +01:00
..
hvc tty: hvc: hvc_opal: Staticify function invoked by reference 2020-11-06 10:54:05 +01:00
ipwireless tty: ipwireless: fix error handling 2020-09-04 18:08:16 +02:00
serdev tty: serdev: core: Provide missing description for 'owner' 2020-11-06 10:49:27 +01:00
serial serial_core: Check for port state when tty is in error state 2020-12-09 15:34:37 +01:00
vt vt: keyboard, make use of assign_bit() API 2020-11-12 09:43:51 +01:00
amiserial.c Remove every trace of SERIAL_MAGIC 2019-11-13 19:01:14 +08:00
cyclades.c treewide: Remove uninitialized_var() usage 2020-07-16 12:35:15 -07:00
ehv_bytechan.c tty: evh_bytechan: Fix out of bounds accesses 2020-03-17 23:40:31 +11:00
goldfish.c tty: goldfish: use __raw_writel()/__raw_readl() 2020-10-28 13:44:43 +01:00
isicom.c treewide: Remove uninitialized_var() usage 2020-07-16 12:35:15 -07:00
Kconfig tty: Remove redundant synclinkmp driver 2020-11-06 17:10:58 +01:00
Makefile tty: Remove redundant synclinkmp driver 2020-11-06 17:10:58 +01:00
mips_ejtag_fdc.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
moxa.c remove ioremap_nocache and devm_ioremap_nocache 2020-01-06 09:45:59 +01:00
moxa.h tty: fix spelling mistake 2020-06-27 16:21:20 +02:00
mxser.c tty: mxser: make mxser_change_speed() return void 2020-05-15 14:47:05 +02:00
mxser.h
n_gsm.c tty: n_gsm: Demote obvious abuse of kernel-doc and supply other missing docss 2020-11-06 10:54:04 +01:00
n_hdlc.c Linux 5.9-rc3 2020-08-31 07:19:25 +02:00
n_null.c
n_r3964.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
n_tracerouter.c
n_tracesink.c
n_tracesink.h tty: n_tracesink: Use the correct style for SPDX License Identifier 2020-03-18 13:01:31 +01:00
n_tty.c tty: n_tty: Add 2 missing parameter descriptions 2020-11-06 10:49:27 +01:00
nozomi.c tty: nozomi: remove unneeded break 2020-10-28 13:44:43 +01:00
pty.c tty: pty: Provide descriptions for the 'file' parameters 2020-11-06 10:54:04 +01:00
rocket_int.h
rocket.c Merge 5.7-rc3 into tty-next 2020-04-27 09:33:21 +02:00
rocket.h
synclink_gt.c tty: synclink_gt: Demote one kernel-doc header and repair another 2020-11-06 10:54:05 +01:00
sysrq.c tty/sysrq: Extend the sysrq_key_table to cover capital letters 2020-10-02 14:56:06 +02:00
tty_audit.c tty: tty_audit: Demote non-conformant kernel-doc headers 2020-11-06 10:54:04 +01:00
tty_baudrate.c tty: tty_baudrate: Add missing description for 'tty' 2020-11-06 10:49:27 +01:00
tty_buffer.c tty: tty_buffer: Add missing description for 'limit' 2020-11-06 10:49:27 +01:00
tty_io.c Merge 5.10-rc7 into tty-next 2020-12-07 10:19:31 +01:00
tty_ioctl.c tty: Remove dead termiox code 2020-12-04 16:54:35 +01:00
tty_jobctrl.c Merge 5.10-rc7 into tty-next 2020-12-07 10:19:31 +01:00
tty_ldisc.c tty: tty_ldisc: Fix some kernel-doc related misdemeanours 2020-11-13 15:30:45 +01:00
tty_ldsem.c locking/lockdep: Remove unused @nested argument from lock_release() 2019-10-09 12:46:10 +02:00
tty_mutex.c
tty_port.c tty: tty_port: Demote obvious abuse of kernel-doc formatting 2020-11-06 10:49:27 +01:00
ttynull.c
vcc.c sparc64: vcc: Fix error return code in vcc_probe() 2020-04-28 14:38:54 +02:00