linux-uconsole/drivers/net/can
Richard Palethorpe bd1448458c can, slip: Protect tty->disc_data in write_wakeup and close with RCU
[ Upstream commit 0ace17d568 ]

write_wakeup can happen in parallel with close/hangup where tty->disc_data
is set to NULL and the netdevice is freed thus also freeing
disc_data. write_wakeup accesses disc_data so we must prevent close from
freeing the netdev while write_wakeup has a non-NULL view of
tty->disc_data.

We also need to make sure that accesses to disc_data are atomic. Which can
all be done with RCU.

This problem was found by Syzkaller on SLCAN, but the same issue is
reproducible with the SLIP line discipline using an LTP test based on the
Syzkaller reproducer.

A fix which didn't use RCU was posted by Hillf Danton.

Fixes: 661f7fda21 ("slip: Fix deadlock in write_wakeup")
Fixes: a8e83b1753 ("slcan: Port write_wakeup deadlock fix from slip")
Reported-by: syzbot+017e491ae13c0068598a@syzkaller.appspotmail.com
Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
Cc: Wolfgang Grandegger <wg@grandegger.com>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Tyler Hall <tylerwhall@gmail.com>
Cc: linux-can@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: syzkaller@googlegroups.com
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-29 16:43:14 +01:00
..
c_can can: c_can: D_CAN: c_can_chip_config(): perform a sofware reset on open 2019-12-05 09:19:41 +01:00
cc770 can: cc770: fix spelling mistake: "comptibility" -> "compatibility" 2018-07-27 10:40:16 +02:00
ifi_canfd
m_can can: m_can: implement errata "Needless activation of MRAF irq" 2019-07-14 08:11:07 +02:00
mscan can: mscan: mscan_rx_poll(): fix rx path lockup when returning from polling to irq mode 2020-01-14 20:07:02 +01:00
peak_canfd can: peak_canfd: rearrange the way resources are released 2018-07-27 10:40:18 +02:00
rcar can: rcar_canfd: fix possible IRQ storm on high load 2019-08-16 10:12:43 +02:00
sja1000 can: sja1000: force the string buffer NULL-terminated 2019-08-29 08:28:37 +02:00
softing drivers/net: Use octal not symbolic permissions 2018-03-26 12:07:49 -04:00
spi can: mcp251x: mcp251x_restart_work_handler(): Fix potential force_quit race condition 2019-12-05 09:19:43 +01:00
usb can: gs_usb: gs_usb_probe(): use descriptors of current altsetting 2020-01-14 20:07:02 +01:00
at91_can.c drivers/net: Use octal not symbolic permissions 2018-03-26 12:07:49 -04:00
dev.c can: dev: add missing of_node_put() after calling of_get_child_by_name() 2019-11-12 19:20:45 +01:00
flexcan.c can: flexcan: increase error counters if skb enqueueing via can_rx_offload_queue_sorted() fails 2019-12-05 09:19:43 +01:00
grcan.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
janz-ican3.c can: janz-ican3: fix ican3_xmit()'s return type 2018-07-27 10:40:16 +02:00
Kconfig can: mark led trigger as broken 2018-06-28 21:34:45 +02:00
led.c
Makefile
pch_can.c
rx-offload.c can: rx-offload: can_rx_offload_irq_offload_fifo(): continue on error 2019-12-05 09:19:43 +01:00
slcan.c can, slip: Protect tty->disc_data in write_wakeup and close with RCU 2020-01-29 16:43:14 +01:00
sun4i_can.c can: sun4i: fix sun4ican_start_xmit()'s return type 2018-07-27 10:40:16 +02:00
ti_hecc.c
vcan.c drivers/net: Use octal not symbolic permissions 2018-03-26 12:07:49 -04:00
vxcan.c
xilinx_can.c can: xilinx: fix return type of ndo_start_xmit function 2019-12-13 08:52:08 +01:00