public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] can: usb: etas_es58x: correctly anchor the urb in the read bulk callback
@ 2026-02-23 16:39 Greg Kroah-Hartman
  2026-03-01 21:18 ` Vincent Mailhol
  2026-03-02 10:01 ` Marc Kleine-Budde
  0 siblings, 2 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2026-02-23 16:39 UTC (permalink / raw)
  To: linux-can
  Cc: linux-kernel, Greg Kroah-Hartman, Vincent Mailhol,
	Marc Kleine-Budde, stable

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 <stable@kernel.org>
Assisted-by: gkh_clanker_2000
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/can/usb/etas_es58x/es58x_core.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.c b/drivers/net/can/usb/etas_es58x/es58x_core.c
index 2d248deb69dc..b259f6109808 100644
--- a/drivers/net/can/usb/etas_es58x/es58x_core.c
+++ b/drivers/net/can/usb/etas_es58x/es58x_core.c
@@ -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));
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-03-02 13:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-23 16:39 [PATCH] can: usb: etas_es58x: correctly anchor the urb in the read bulk callback Greg Kroah-Hartman
2026-03-01 21:18 ` Vincent Mailhol
2026-03-02 10:01 ` Marc Kleine-Budde
2026-03-02 12:50   ` Greg Kroah-Hartman
2026-03-02 13:11     ` checkpatch: format of stable@k.o address (was: Re: [PATCH] can: usb: etas_es58x: correctly anchor the urb in the read bulk callback) Marc Kleine-Budde
2026-03-02 13:36       ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox