WSL2-Linux-Kernel/drivers/net/can/usb
Pavel Skripkin 928150fad4 can: esd_usb2: fix memory leak
In esd_usb2_setup_rx_urbs() MAX_RX_URBS coherent buffers are allocated
and there is nothing, that frees them:

1) In callback function the urb is resubmitted and that's all
2) In disconnect function urbs are simply killed, but URB_FREE_BUFFER
   is not set (see esd_usb2_setup_rx_urbs) and this flag cannot be used
   with coherent buffers.

So, all allocated buffers should be freed with usb_free_coherent()
explicitly.

Side note: This code looks like a copy-paste of other can drivers. The
same patch was applied to mcba_usb driver and it works nice with real
hardware. There is no change in functionality, only clean-up code for
coherent buffers.

Fixes: 96d8e90382 ("can: Add driver for esd CAN-USB/2 device")
Link: https://lore.kernel.org/r/b31b096926dcb35998ad0271aac4b51770ca7cc8.1627404470.git.paskripkin@gmail.com
Cc: linux-stable <stable@vger.kernel.org>
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2021-07-30 08:47:34 +02:00
..
etas_es58x can: etas_es58x: Fix a couple of spelling mistakes 2021-04-24 14:36:50 +02:00
kvaser_usb can: kvaser_usb: Add new Kvaser hydra devices 2021-05-27 09:42:23 +02:00
peak_usb can: peak_usb: pcan_usb_handle_bus_evt(): fix reading rxerr/txerr values 2021-07-24 19:02:32 +02:00
Kconfig can: kvaser_usb: Add new Kvaser hydra devices 2021-05-27 09:42:23 +02:00
Makefile can: etas_es58x: add core support for ETAS ES58X CAN USB interfaces 2021-04-13 10:15:42 +02:00
ems_usb.c can: ems_usb: fix memory leak 2021-07-30 08:47:24 +02:00
esd_usb2.c can: esd_usb2: fix memory leak 2021-07-30 08:47:34 +02:00
gs_usb.c can: dev: can_free_echo_skb(): extend to return can frame length 2021-03-30 11:14:28 +02:00
mcba_usb.c can: mcba_usb_start(): add missing urb->transfer_dma initialization 2021-07-30 08:47:01 +02:00
ucan.c can: ucan: fix alignment constraints 2021-03-30 11:14:46 +02:00
usb_8dev.c can: usb_8dev: fix memory leak 2021-07-30 08:47:05 +02:00