kernel_optimize_test/drivers/tty
Johannes Weiner e65c62b137 tty: fall back to N_NULL if switching to N_TTY fails during hangup
We have seen NULL-pointer dereference crashes in tty->disc_data when the
N_TTY fallback driver failed to open during hangup.  The immediate cause
of this open to fail has been addressed in the preceding patch to
vmalloc(), but this code could be more robust.

As Alan pointed out in commit 8a8dabf2dd ("tty: handle the case where
we cannot restore a line discipline"), the N_TTY driver, historically
the safe fallback that could never fail, can indeed fail, but the
surrounding code is not prepared to handle this.  To avoid crashes he
added a new N_NULL driver to take N_TTY's place as the last resort.

Hook that fallback up to the hangup path.  Update tty_ldisc_reinit() to
reflect the reality that n_tty_open can indeed fail.

Link: http://lkml.kernel.org/r/20171004185959.GC2136@cmpxchg.org
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Alan Cox <alan@llwyncelyn.cymru>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Michal Hocko <mhocko@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-10-13 16:18:33 -07:00
..
hvc powerpc updates for 4.14 2017-09-07 10:15:40 -07:00
ipwireless
serdev
serial serial: sccnxp: Fix error handling in sccnxp_probe() 2017-09-18 18:19:21 +02:00
vt
amiserial.c
bfin_jtag_comm.c
cyclades.c
ehv_bytechan.c
goldfish.c tty: goldfish: Implement support for kernel 'earlycon' parameter 2017-08-31 18:58:45 +02:00
isicom.c
Kconfig Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next 2017-09-10 09:57:23 -07:00
Makefile
metag_da.c
mips_ejtag_fdc.c tty: mips_ejtag_fdc: constify mips_cdmm_device_id 2017-08-28 20:51:22 +02:00
moxa.c
moxa.h
mxser.c mxser: fix timeout calculation for low rates 2017-09-18 18:19:20 +02:00
mxser.h
n_gsm.c tty: n_gsm: Add compat_ioctl 2017-08-28 20:51:22 +02:00
n_hdlc.c
n_null.c
n_r3964.c
n_tracerouter.c
n_tracesink.c
n_tracesink.h
n_tty.c
nozomi.c
pty.c TTY/Serial updates for 4.14-rc1 2017-09-05 10:30:48 -07:00
rocket_int.h
rocket.c
rocket.h
synclink_gt.c
synclink.c
synclinkmp.c
sysrq.c
tty_audit.c
tty_baudrate.c
tty_buffer.c
tty_io.c Staging/IIO driver updates for 4.14-rc1 2017-09-05 10:36:26 -07:00
tty_ioctl.c
tty_jobctrl.c
tty_ldisc.c tty: fall back to N_NULL if switching to N_TTY fails during hangup 2017-10-13 16:18:33 -07:00
tty_ldsem.c
tty_mutex.c
tty_port.c
vcc.c sparc64: vcc: make ktermios const 2017-08-29 15:10:44 -07:00