OpenCloudOS-Kernel/drivers/net/can/usb
Anssi Hannula 2871edb32f can: kvaser_usb: Fix possible completions during init_completion
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>
2022-10-27 09:00:39 +02:00
..
etas_es58x can: etas_es58x: Replace zero-length array with DECLARE_FLEX_ARRAY() helper 2022-09-06 08:28:26 +02:00
kvaser_usb can: kvaser_usb: Fix possible completions during init_completion 2022-10-27 09:00:39 +02:00
peak_usb net: move from strlcpy with unused retval to strscpy 2022-08-31 14:11:07 -07:00
Kconfig can/esd_usb2: Rename esd_usb2.c to esd_usb.c 2022-06-25 13:05:26 +02:00
Makefile can/esd_usb2: Rename esd_usb2.c to esd_usb.c 2022-06-25 13:05:26 +02:00
ems_usb.c can: ems_usb: fix clang's -Wunaligned-access warning 2022-08-09 09:05:06 +02:00
esd_usb.c can: tree-wide: advertise software timestamping capabilities 2022-07-28 11:44:01 +02:00
gs_usb.c can: gs_usb: remove dma allocations 2022-09-23 13:55:00 +02:00
mcba_usb.c can: tree-wide: advertise software timestamping capabilities 2022-07-28 11:44:01 +02:00
ucan.c can: tree-wide: advertise software timestamping capabilities 2022-07-28 11:44:01 +02:00
usb_8dev.c can: tree-wide: advertise software timestamping capabilities 2022-07-28 11:44:01 +02:00