]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
can: etas_es58x: es58x_read_bulk_callback(): fix RX buffer leak on URB resubmit failure
authorGuangshuo Li <lgs201920130244@gmail.com>
Mon, 6 Jul 2026 01:46:01 +0000 (09:46 +0800)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Wed, 29 Jul 2026 10:00:00 +0000 (12:00 +0200)
es58x_read_bulk_callback() resubmits the RX URB after processing a received
packet. If the resubmit succeeds, the URB remains anchored and will be
handled by the normal RX path or by teardown.

However, if usb_submit_urb() fails, the callback unanchors the URB and then
returns directly. This skips the existing free_urb path, so the coherent
transfer buffer allocated with usb_alloc_coherent() is not released.

Reuse the existing free_urb path after a resubmit failure so that the RX
coherent buffer is freed before leaving the callback.

Fixes: 5eaad4f76826 ("can: usb: etas_es58x: correctly anchor the urb in the read bulk callback")
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Reviewed-by: Vincent Mailhol <mailhol@kernel.org>
Link: https://patch.msgid.link/20260706014601.415445-1-lgs201920130244@gmail.com
Cc: stable@kernel.org
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/usb/etas_es58x/es58x_core.c

index b259f61098083c66bf0220a7b2f8dc3b39d3de6c..e1724ae79c5a18658bb941cc357a3cca1d9ef1af 100644 (file)
@@ -1476,7 +1476,6 @@ static void es58x_read_bulk_callback(struct urb *urb)
                dev_err_ratelimited(dev,
                                    "Failed resubmitting read bulk urb: %pe\n",
                                    ERR_PTR(ret));
-       return;
 
  free_urb:
        usb_free_coherent(urb->dev, urb->transfer_buffer_length,