* [PATCH net 1/1] net: usb: rtl8150: break cycle between tasklet and URB
@ 2026-11-12 10:45 Oliver Neukum
2026-11-12 10:52 ` netdev-bot+sinfo
0 siblings, 1 reply; 3+ messages in thread
From: Oliver Neukum @ 2026-11-12 10:45 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.
Fixes: eff674a514bd3 ("USB: rtl8150_disconnect() needs tasklet_kill()")
Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
drivers/net/usb/rtl8150.c | 31 ++++++++++++++++++++++++++-----
1 file changed, 26 insertions(+), 5 deletions(-)
diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
index d51e43170e03..846e6329d571 100644
--- a/drivers/net/usb/rtl8150.c
+++ b/drivers/net/usb/rtl8150.c
@@ -343,6 +343,13 @@ static int alloc_all_urbs(rtl8150_t * dev)
return 0;
}
+ /*
+ * They need to be blocked so that open()
+ * can unblock them
+ */
+ usb_block_urb(dev->rx_urb);
+ usb_block_urb(dev->tx_urb);
+ usb_block_urb(dev->intr_urb);
return 1;
}
@@ -353,11 +360,18 @@ static void free_all_urbs(rtl8150_t * dev)
usb_free_urb(dev->intr_urb);
}
+static void reenable_all_urbs(rtl8150_t *dev)
+{
+ usb_unpoison_urb(dev->rx_urb);
+ usb_unpoison_urb(dev->tx_urb);
+ usb_unpoison_urb(dev->intr_urb);
+}
+
static void unlink_all_urbs(rtl8150_t * dev)
{
- usb_kill_urb(dev->rx_urb);
- usb_kill_urb(dev->tx_urb);
- usb_kill_urb(dev->intr_urb);
+ usb_poison_urb(dev->rx_urb);
+ usb_poison_urb(dev->tx_urb);
+ usb_poison_urb(dev->intr_urb);
}
static inline struct sk_buff *pull_skb(rtl8150_t *dev)
@@ -425,6 +439,11 @@ static void read_bulk_callback(struct urb *urb)
netdev->stats.rx_bytes += pkt_len;
spin_lock_irqsave(&dev->rx_pool_lock, flags);
+ /* prevent an eteral loop */
+ if (test_bit(RTL8150_UNPLUG, &dev->flags)) {
+ spin_unlock_irqrestore(&dev->rx_pool_lock, flags);
+ return;
+ }
skb = pull_skb(dev);
spin_unlock_irqrestore(&dev->rx_pool_lock, flags);
if (!skb)
@@ -518,7 +537,7 @@ static void intr_callback(struct urb *urb)
res = usb_submit_urb (urb, GFP_ATOMIC);
if (res == -ENODEV)
netif_device_detach(dev->netdev);
- else if (res)
+ else if (res != -EPERM)
dev_err(&dev->udev->dev,
"can't resubmit intr, %s-%s/input0, status %d\n",
dev->udev->bus->bus_name, dev->udev->devpath, res);
@@ -751,6 +770,7 @@ static int rtl8150_open(struct net_device *netdev)
if (!dev->rx_skb)
return -ENOMEM;
+ reenable_all_urbs(dev);
set_registers(dev, IDR, 6, netdev->dev_addr);
usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1),
@@ -969,8 +989,9 @@ static void rtl8150_disconnect(struct usb_interface *intf)
if (dev) {
set_bit(RTL8150_UNPLUG, &dev->flags);
tasklet_kill(&dev->tl);
- unregister_netdev(dev->netdev);
unlink_all_urbs(dev);
+ tasklet_kill(&dev->tl);
+ unregister_netdev(dev->netdev);
free_all_urbs(dev);
free_skb_pool(dev);
dev_kfree_skb(dev->rx_skb);
--
2.56.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net 1/1] net: usb: rtl8150: break cycle between tasklet and URB
2026-11-12 10:45 [PATCH net 1/1] net: usb: rtl8150: break cycle between tasklet and URB Oliver Neukum
@ 2026-11-12 10:52 ` netdev-bot+sinfo
2026-11-12 11:09 ` Oliver Neukum
0 siblings, 1 reply; 3+ messages in thread
From: netdev-bot+sinfo @ 2026-11-12 10:52 UTC (permalink / raw)
To: Oliver Neukum
Cc: petkan, andrew+netdev, davem, edumazet, kuba, pabeni, linux-usb,
netdev, linux-kernel
Hi!
This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:
- How the issue was discovered, e.g. hit in production, hit during
development, syzbot report, manual code inspection, LLM or static
analysis tool scan.
- Whether the issue was actually triggered, or is only theoretical
(e.g. found by LLM and not proven at runtime). If it was triggered
please include the symptoms, like the stack trace or kernel messages.
Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account. If the series needs another revision for
other reasons, please include the information in the commit messages
then.
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net 1/1] net: usb: rtl8150: break cycle between tasklet and URB
2026-11-12 10:52 ` netdev-bot+sinfo
@ 2026-11-12 11:09 ` Oliver Neukum
0 siblings, 0 replies; 3+ messages in thread
From: Oliver Neukum @ 2026-11-12 11:09 UTC (permalink / raw)
To: netdev-bot+sinfo
Cc: petkan, andrew+netdev, davem, edumazet, kuba, pabeni, linux-usb,
netdev, linux-kernel
On 12.11.26 11:52, netdev-bot+sinfo@kernel.org wrote:
> Please do not repost the series just to address the above. Instead,
> reply to this email with the missing information, so that reviewers
> can take it into account. If the series needs another revision for
> other reasons, please include the information in the commit messages
> then.
This is in response to a patch by Myeonghung Pak, whose patch
tried to fix the issue, but failed to, as Sashiko found out.
HTH
Oliver
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-12 11:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-12 10:45 [PATCH net 1/1] net: usb: rtl8150: break cycle between tasklet and URB Oliver Neukum
2026-11-12 10:52 ` netdev-bot+sinfo
2026-11-12 11:09 ` 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®