Skip to content

Commit 5eaad4f

Browse files
gregkhmarckleinebudde
authored andcommitted
can: usb: etas_es58x: correctly anchor the urb in the read bulk callback
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: 8537257 ("can: etas_es58x: add core support for ETAS ES58X CAN USB interfaces") Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
1 parent 1e446fd commit 5eaad4f

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

drivers/net/can/usb/etas_es58x/es58x_core.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1461,12 +1461,18 @@ static void es58x_read_bulk_callback(struct urb *urb)
14611461
}
14621462

14631463
resubmit_urb:
1464+
usb_anchor_urb(urb, &es58x_dev->rx_urbs);
14641465
ret = usb_submit_urb(urb, GFP_ATOMIC);
1466+
if (!ret)
1467+
return;
1468+
1469+
usb_unanchor_urb(urb);
1470+
14651471
if (ret == -ENODEV) {
14661472
for (i = 0; i < es58x_dev->num_can_ch; i++)
14671473
if (es58x_dev->netdev[i])
14681474
netif_device_detach(es58x_dev->netdev[i]);
1469-
} else if (ret)
1475+
} else
14701476
dev_err_ratelimited(dev,
14711477
"Failed resubmitting read bulk urb: %pe\n",
14721478
ERR_PTR(ret));

0 commit comments

Comments
 (0)