]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
can: usb: etas_es58x: correctly anchor the urb in the read bulk callback
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 23 Feb 2026 16:39:20 +0000 (17:39 +0100)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Mon, 2 Mar 2026 10:03:42 +0000 (11:03 +0100)
When submitting an urb, that is using the anchor pattern, it needs to be
anchored before submitting it otherwise it could be leaked if
usb_kill_anchored_urbs() is called.  This logic is correctly done
elsewhere in the driver, except in the read bulk callback so do that
here also.

Cc: Vincent Mailhol <mailhol@kernel.org>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: stable@kernel.org
Assisted-by: gkh_clanker_2000
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Vincent Mailhol <mailhol@kernel.org>
Tested-by: Vincent Mailhol <mailhol@kernel.org>
Link: https://patch.msgid.link/2026022320-poser-stiffly-9d84@gregkh
Fixes: 8537257874e9 ("can: etas_es58x: add core support for ETAS ES58X CAN USB interfaces")
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/usb/etas_es58x/es58x_core.c

index 2d248deb69dc1e0577c25033da5999d18db79061..b259f61098083c66bf0220a7b2f8dc3b39d3de6c 100644 (file)
@@ -1461,12 +1461,18 @@ static void es58x_read_bulk_callback(struct urb *urb)
        }
 
  resubmit_urb:
+       usb_anchor_urb(urb, &es58x_dev->rx_urbs);
        ret = usb_submit_urb(urb, GFP_ATOMIC);
+       if (!ret)
+               return;
+
+       usb_unanchor_urb(urb);
+
        if (ret == -ENODEV) {
                for (i = 0; i < es58x_dev->num_can_ch; i++)
                        if (es58x_dev->netdev[i])
                                netif_device_detach(es58x_dev->netdev[i]);
-       } else if (ret)
+       } else
                dev_err_ratelimited(dev,
                                    "Failed resubmitting read bulk urb: %pe\n",
                                    ERR_PTR(ret));