linux/drivers/net/can
Marc Kleine-Budde 54950747d5 can: gs_usb: gs_can_open(): improve error handling
commit 2603be9e81 upstream.

The gs_usb driver handles USB devices with more than 1 CAN channel.
The RX path for all channels share the same bulk endpoint (the
transmitted bulk data encodes the channel number). These per-device
resources are allocated and submitted by the first opened channel.

During this allocation, the resources are either released immediately
in case of a failure or the URBs are anchored. All anchored URBs are
finally killed with gs_usb_disconnect().

Currently, gs_can_open() returns with an error if the allocation of a
URB or a buffer fails. However, if usb_submit_urb() fails, the driver
continues with the URBs submitted so far, even if no URBs were
successfully submitted.

Treat every error as fatal and free all allocated resources
immediately.

Switch to goto-style error handling, to prepare the driver for more
per-device resource allocation.

Cc: stable@vger.kernel.org
Cc: John Whittington <git@jbrengineering.co.uk>
Link: https://lore.kernel.org/all/20230716-gs_usb-fix-time-stamp-counter-v1-1-9017cefcd9d5@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2023-07-27 08:50:27 +02:00
..
c_can can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
cc770 can: cc770: cc770_isa_probe(): add missing free_cc770dev() 2022-11-24 16:09:53 +01:00
ctucanfd can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
dev can: dev: fix missing CAN XL support in can_put_echo_skb() 2023-05-24 17:32:46 +01:00
flexcan can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
ifi_canfd can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
m_can can: tcan4x5x: Fix use of register error status mask 2022-12-31 13:32:27 +01:00
mscan can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
peak_canfd can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
rcar can: rcar_canfd: Fix R-Car V3U GAFLCFG field accesses 2023-03-10 09:32:58 +01:00
sja1000 can: sja1000_isa: sja1000_isa_probe(): add missing free_sja1000dev() 2022-11-24 16:09:39 +01:00
slcan can: slcan: fix freed work crash 2022-12-07 10:32:24 +01:00
softing can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
spi can: mcp251xfd: __mcp251xfd_chip_set_mode(): increase poll timeout 2023-07-27 08:50:27 +02:00
usb can: gs_usb: gs_can_open(): improve error handling 2023-07-27 08:50:27 +02:00
at91_can.c can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
can327.c can: can327: flush TX_work on ldisc .close() 2022-12-07 10:32:36 +01:00
grcan.c can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
janz-ican3.c can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
Kconfig can: slcan: use CAN network device driver API 2022-07-03 11:34:28 +02:00
kvaser_pciefd.c can: kvaser_pciefd: Set hardware timestamp on transmitted packets 2023-07-19 16:21:11 +02:00
Makefile can: slcan: move driver into separate sub directory 2022-07-03 11:34:44 +02:00
pch_can.c can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
sun4i_can.c can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
ti_hecc.c can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
vcan.c can: dev: add CAN XL support to virtual CAN 2022-09-15 09:08:09 +02:00
vxcan.c can: dev: add CAN XL support to virtual CAN 2022-09-15 09:08:09 +02:00
xilinx_can.c can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00