linux/drivers/net/can
Anssi Hannula 33ddee2b95 can: kvaser_usb: Fix possible completions during init_completion
commit 2871edb32f upstream.

kvaser_usb uses completions to signal when a response event is received
for outgoing commands.

However, it uses init_completion() to reinitialize the start_comp and
stop_comp completions before sending the start/stop commands.

In case the device sends the corresponding response just before the
actual command is sent, complete() may be called concurrently with
init_completion() which is not safe.

This might be triggerable even with a properly functioning device by
stopping the interface (CMD_STOP_CHIP) just after it goes bus-off (which
also causes the driver to send CMD_STOP_CHIP when restart-ms is off),
but that was not tested.

Fix the issue by using reinit_completion() instead.

Fixes: 080f40a6fa ("can: kvaser_usb: Add support for Kvaser CAN/USB devices")
Tested-by: Jimmy Assarsson <extja@kvaser.com>
Signed-off-by: Anssi Hannula <anssi.hannula@bitwise.fi>
Signed-off-by: Jimmy Assarsson <extja@kvaser.com>
Link: https://lore.kernel.org/all/20221010185237.319219-2-extja@kvaser.com
Cc: stable@vger.kernel.org
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-11-03 23:59:10 +09:00
..
c_can can: c_can: don't cache TX messages for C_CAN cores 2022-10-05 10:39:37 +02:00
cc770
dev can: netlink: allow configuring of fixed data bit rates without need for do_set_data_bittiming callback 2022-08-17 14:23:20 +02:00
ifi_canfd
m_can can: m_can: m_can_{read_fifo,echo_tx_event}(): shift timestamp to full 32 bits 2022-07-12 16:34:49 +02:00
mscan can: mscan: mpc5xxx_can: mpc5xxx_can_probe(): remove useless BUG_ON() 2021-08-25 08:25:11 +02:00
peak_canfd can: peak_pciefd: pucan_handle_status(): fix a potential starvation issue in TX path 2021-06-24 08:40:10 +02:00
rcar can: rcar_can: do not report txerr and rxerr during bus-off 2022-08-17 14:23:32 +02:00
sja1000 can: sja1000: do not report txerr and rxerr during bus-off 2022-08-17 14:23:32 +02:00
softing can: softing: softing_startstop(): fix set but not used variable warning 2022-01-27 11:04:01 +01:00
spi can: mcp251x: Fix race condition on receive interrupt 2022-08-25 11:40:04 +02:00
usb can: kvaser_usb: Fix possible completions during init_completion 2022-11-03 23:59:10 +09:00
at91_can.c net: at91_can: fix the comments style issue 2021-07-25 11:36:27 +02:00
flexcan.c can: flexcan: flexcan_mailbox_read() fix return value for drop = true 2022-09-28 11:11:44 +02:00
grcan.c can: grcan: grcan_probe(): remove extra of_node_get() 2022-07-12 16:34:48 +02:00
janz-ican3.c can: janz-ican3: use DEVICE_ATTR_RO/RW() helper macro 2021-07-25 11:36:26 +02:00
Kconfig can: flexcan: update Kconfig to enable coldfire 2021-07-25 11:36:29 +02:00
kvaser_pciefd.c can: kvaser_pciefd: kvaser_pciefd_rx_error_frame(): increase correct stats->{rx,tx}_errors counter 2021-12-14 10:57:07 +01:00
led.c
Makefile
pch_can.c can: pch_can: pch_can_error(): initialize errc before using it 2022-08-17 14:23:33 +02:00
slcan.c tty: no checking of tty_unregister_ldisc 2021-05-13 16:57:17 +02:00
sun4i_can.c can: sun4i_can: do not report txerr and rxerr during bus-off 2022-08-17 14:23:33 +02:00
ti_hecc.c can: rx-offload: add skb queue for use during ISR 2021-07-25 11:36:25 +02:00
vcan.c
vxcan.c vxcan: enable local echo for sent CAN frames 2022-04-08 14:23:39 +02:00
xilinx_can.c Revert "can: xilinx_can: Limit CANFD brp to 2" 2022-07-21 21:24:40 +02:00