[PATCH v2 net-next 1/1] net: usb: rtl8150: break cycle between tasklet and URB

From: Oliver Neukum

Date: Wed Nov 18 2026 - 08:36:08 EST


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@xxxxxxxx>
---
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