* [PATCH v2 net-next 1/1] net: usb: rtl8150: break cycle between tasklet and URB
@ 2026-11-18 13:35 Oliver Neukum
0 siblings, 0 replies; only message in thread
From: Oliver Neukum @ 2026-11-18 13:35 UTC (permalink / raw)
To: petkan, andrew+netdev, davem, edumazet, kuba, pabeni, linux-usb,
netdev, linux-kernel
Cc: Oliver Neukum
The tasklet can resubmit the URB, which in turn can
resubmit the tasklet. The cycle needs to be broken.
The simplest way to do so is to prevent the resubmission
of the URBs by poisoning them.
This has been detected by automatic code analysis.
Fixes: eff674a514bd3 ("USB: rtl8150_disconnect() needs tasklet_kill()")
Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
drivers/net/usb/rtl8150.c | 10 +++++++++-
V2: Sashiko pointed out errors which conceptually arose from handling
close() and disconnect() in the same way. Treating disconnect()
separatly makes them go away
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
index d51e43170e03..6d20f52d52ef 100644
--- a/drivers/net/usb/rtl8150.c
+++ b/drivers/net/usb/rtl8150.c
@@ -353,6 +353,13 @@ static void free_all_urbs(rtl8150_t * dev)
usb_free_urb(dev->intr_urb);
}
+static void terminate_all_urbs(rtl8150_t *dev)
+{
+ usb_poison_urb(dev->rx_urb);
+ usb_poison_urb(dev->tx_urb);
+ usb_poison_urb(dev->intr_urb);
+}
+
static void unlink_all_urbs(rtl8150_t * dev)
{
usb_kill_urb(dev->rx_urb);
@@ -970,7 +977,8 @@ static void rtl8150_disconnect(struct usb_interface *intf)
set_bit(RTL8150_UNPLUG, &dev->flags);
tasklet_kill(&dev->tl);
unregister_netdev(dev->netdev);
- unlink_all_urbs(dev);
+ terminate_all_urbs(dev);
+ tasklet_kill(&dev->tl);
free_all_urbs(dev);
free_skb_pool(dev);
dev_kfree_skb(dev->rx_skb);
--
2.56.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-18 13:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-18 13:35 [PATCH v2 net-next 1/1] net: usb: rtl8150: break cycle between tasklet and URB Oliver Neukum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®