1
0
Fork 0
alistair23-linux/drivers/net/can
Richard Palethorpe 34545cad8e 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:45:19 +01:00
..
c_can can: c_can: C_CAN: add bus recovery events 2019-11-04 21:47:21 +01:00
cc770 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 495 2019-06-19 17:09:52 +02:00
ifi_canfd treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
m_can can: tcan4x5x: tcan4x5x_can_probe(): get the device out of standby before register access 2020-01-14 20:08:27 +01:00
mscan can: mscan: mscan_rx_poll(): fix rx path lockup when returning from polling to irq mode 2020-01-14 20:08:27 +01:00
peak_canfd can: mark expected switch fall-throughs 2019-07-25 20:09:42 -05:00
rcar can: rcar_can: Remove unused platform data support 2019-08-20 13:41:25 +02:00
sja1000 can: peak_pci: Make structure peak_pciec_i2c_bit_ops constant 2019-08-20 13:41:25 +02:00
softing net/can: using dev_get_drvdata directly 2019-07-05 15:24:41 -07:00
spi can: mcp251x: mcp251x_restart_work_handler(): Fix potential force_quit race condition 2019-11-05 12:44:22 +01:00
usb can: gs_usb: gs_usb_probe(): use descriptors of current altsetting 2020-01-14 20:08:27 +01:00
Kconfig can: kvaser_pciefd: Add driver for Kvaser PCIEcan devices 2019-07-24 10:31:53 +02:00
Makefile can: kvaser_pciefd: Add driver for Kvaser PCIEcan devices 2019-07-24 10:31:53 +02:00
at91_can.c can: mark expected switch fall-throughs 2019-07-25 20:09:42 -05:00
dev.c can: dev: add missing of_node_put() after calling of_get_child_by_name() 2019-11-04 21:47:20 +01:00
flexcan.c can: flexcan: add low power enter/exit acknowledgment helper 2019-12-31 16:46:05 +01:00
grcan.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
janz-ican3.c net: Remove dev_err() usage after platform_get_irq() 2019-07-30 14:37:35 -07:00
kvaser_pciefd.c can: kvaser_pciefd: the PWM generator is running at the bus frequency of the system. 2019-09-03 10:23:57 +02:00
led.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
pch_can.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 340 2019-06-05 17:37:07 +02:00
rx-offload.c can: rx-offload: can_rx_offload_irq_offload_fifo(): continue on error 2019-11-04 21:47:22 +01:00
slcan.c can, slip: Protect tty->disc_data in write_wakeup and close with RCU 2020-01-29 16:45:19 +01:00
sun4i_can.c net: Remove dev_err() usage after platform_get_irq() 2019-07-30 14:37:35 -07:00
ti_hecc.c can: ti_hecc: add missing state changes 2019-11-04 21:47:23 +01:00
vcan.c can: make use of preallocated can_ml_priv for per device struct can_dev_rcv_lists 2019-09-04 13:29:15 +02:00
vxcan.c can: make use of preallocated can_ml_priv for per device struct can_dev_rcv_lists 2019-09-04 13:29:15 +02:00
xilinx_can.c can: xilinx_can: Fix missing Rx can packets on CANFD2.0 2019-12-31 16:45:55 +01:00