linux/drivers/tty/serial
Jiri Slaby 7bbe08d6b8 TTY: serial, stop accessing potential NULLs
The following commits:
* 6732c8bb86 (TTY: switch
  tty_schedule_flip)
* 2e124b4a39 (TTY: switch
  tty_flip_buffer_push)
* 05c7cd3990 (TTY: switch
  tty_insert_flip_string)
* 92a19f9cec (TTY: switch
  tty_insert_flip_char)
* 227434f898 (TTY: switch
  tty_buffer_request_room to tty_port)

introduced a potential NULL dereference to some drivers. In
particular, when the device is used as a console, incoming bytes can
kill the box. This is caused by removed checks for TTY against NULL.

It happened because it was unclear to me why the checks were there. I
assumed them superfluous because the interrupts were unbound or
otherwise stopped. But this is not the case for consoles for these
drivers, as was pointed out by David Miller.

Now, this patch re-introduces the checks (at this point we check
port->state, not the tty proper, as we do not care about tty pointers
anymore). For both of the drivers, we place the check below the
handling of break signal so that sysrq can actually work. (One needs
to issue a break and then sysrq key within the following 5 seconds.)

We do not change sc26xx, sunhv, and sunsu here because they behave the
same as before.  People having that hardware should fix the driver
eventually, however. They always could unconditionally dereference tty
in receive_chars, port->state in uart_handle_dcd_change, and
up->port.state->port.tty.

There is perhaps more to fix in all those drivers, but they are at
least in a state they were before.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Rob Herring <rob.herring@calxeda.com>
Cc: sparclinux@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-18 17:09:37 -07:00
..
8250 serial: ralink: adds support for the serial core found on ralink wisoc 2013-01-30 00:15:34 -05:00
cpm_uart TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
jsm TTY: jsm, remove superfluous check 2013-03-18 16:17:20 -07:00
21285.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
68328serial.c TTY: cleanup tty->hw_stopped uses 2013-03-18 16:24:30 -07:00
altera_jtaguart.c tty: serial: altera_jtaguart: Simplify altera_jtaguart_init() 2013-02-05 11:13:51 -08:00
altera_uart.c tty: serial: altera_uart: Simplify altera_uart_init() 2013-02-05 11:13:50 -08:00
amba-pl010.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
amba-pl011.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
apbuart.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
apbuart.h
ar933x_uart.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
arc_uart.c TTY: cleanup tty->hw_stopped uses 2013-03-18 16:24:30 -07:00
atmel_serial.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
bcm63xx_uart.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
bfin_sport_uart.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
bfin_sport_uart.h
bfin_uart.c TTY: serial/bfin_uart, unbreak build with KGDB enabled 2013-03-18 16:24:30 -07:00
clps711x.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
crisv10.c crisv10: use counts from tty_port 2013-03-18 16:26:33 -07:00
crisv10.h crisv10: use counts from tty_port 2013-03-18 16:26:33 -07:00
dz.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
dz.h
efm32-uart.c serial/efm32: parse location property 2013-01-21 13:56:46 -08:00
icom.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
icom.h
ifx6x60.c tty: ifx6x60: Remove unused suspend/resume callbacks 2013-03-18 16:29:29 -07:00
ifx6x60.h serial:ifx6x60:Prevent data transfer when IFX6x60 port is shutdown 2012-11-01 08:50:01 -07:00
imx.c serial: imx: fix uninitialized variable warning 2013-02-18 11:05:14 -08:00
ioc3_serial.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
ioc4_serial.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
ip22zilog.c TTY: ip22zilog, fix tty_flip_buffer_push call 2013-01-16 07:36:47 -08:00
ip22zilog.h
Kconfig Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2013-03-02 07:44:16 -08:00
kgdb_nmi.c kgdb: remove #include <linux/serial_8250.h> from kgdb.h 2013-02-04 15:35:26 -08:00
kgdboc.c KGDB/KDB fixes and cleanups 2012-10-13 11:16:58 +09:00
lantiq.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
lpc32xx_hs.c serial: lpc32xx: Fix fallout from tty_port conversion 2013-01-18 16:05:15 -08:00
m32r_sio_reg.h
m32r_sio.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
m32r_sio.h
Makefile serial: rp2: New driver for Comtrol RocketPort 2 cards 2013-01-17 17:28:39 -08:00
max310x.c tty: max310x: Use dev_pm_ops 2013-03-18 16:29:29 -07:00
max3100.c tty: max3100: Use dev_pm_ops 2013-03-18 16:29:29 -07:00
mcf.c serial: mcf: Add support RS485 in ColdFire serial driver 2013-01-15 22:56:34 -08:00
mfd.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
mpc52xx_uart.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
mpsc.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
mrst_max3110.c tty: mrst_max3110: Use dev_pm_ops 2013-03-18 16:29:29 -07:00
mrst_max3110.h
msm_serial_hs.c TTY: serial/msm_serial_hs, remove unused tty 2013-03-18 16:24:30 -07:00
msm_serial.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
msm_serial.h
msm_smd_tty.c TTY: msm_smd_tty, clean up activate/shutdown 2013-03-18 16:19:44 -07:00
mux.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
mxs-auart.c Merge 3.8-rc5 into tty-next 2013-01-25 13:27:36 -08:00
netx-serial.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
nwpserial.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
of_serial.c tty: of_serial: unexport tegra_serial_handle_break 2013-02-05 11:13:16 -08:00
omap-serial.c OMAP/serial: Fix incorrect Rx FIFO threshold setting, LSR validation on Tx, and Tx FIFO IRQ generation 2013-02-05 11:13:16 -08:00
pch_uart.c serial: pch_uart: add console poll support 2013-03-15 13:55:23 -07:00
pmac_zilog.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
pmac_zilog.h
pnx8xxx_uart.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
pxa.c serial: pxa: fine-tune clk useage 2013-01-25 08:52:23 -08:00
rp2.c serial: rp2: New driver for Comtrol RocketPort 2 cards 2013-01-17 17:28:39 -08:00
sa1100.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
samsung.c Merge 3.8-rc5 into tty-next 2013-01-25 13:27:36 -08:00
samsung.h
sb1250-duart.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
sc26xx.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
sccnxp.c tty/serial patches for 3.9-rc1 2013-02-21 13:41:04 -08:00
serial_core.c tty: Remove ancient hardpps() 2013-02-13 10:17:06 -08:00
serial_ks8695.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
serial_txx9.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
serial-tegra.c serial: tegra: Convert to devm_ioremap_resource() 2013-03-15 13:55:22 -07:00
sh-sci.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
sh-sci.h
sirfsoc_uart.c serial: sirf: only use lookup table to set baudrate when ioclk=150MHz 2013-01-17 17:18:55 -08:00
sirfsoc_uart.h serial: sirf: only use lookup table to set baudrate when ioclk=150MHz 2013-01-17 17:18:55 -08:00
sn_console.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
suncore.c
sunhv.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
sunsab.c TTY: serial, stop accessing potential NULLs 2013-03-18 17:09:37 -07:00
sunsab.h
sunsu.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
sunzilog.c TTY: serial, stop accessing potential NULLs 2013-03-18 17:09:37 -07:00
sunzilog.h
timbuart.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
timbuart.h
uartlite.c tty: serial: uartlite: Support uartlite on big and little endian systems 2013-02-13 08:38:45 -08:00
ucc_uart.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
vr41xx_siu.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
vt8500_serial.c serial: vt8500_serial: Convert to devm_ioremap_resource() 2013-03-15 13:55:23 -07:00
xilinx_uartps.c serial: xilinx_uartps: Remove leftover __exit_p() 2013-01-22 09:25:33 -08:00
zs.c TTY: switch tty_flip_buffer_push 2013-01-15 22:30:15 -08:00
zs.h