🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
4 messages
4 total messages Started by Stefano Munari Tue, 20 Oct 2026 20:26
[PATCH net v2] net: usb: lan78xx: fix error handling in lan78xx_open()
#5699
Author: Stefano Munari
Date: Tue, 20 Oct 2026 20:26
56 lines
12464 bytes
A failed interrupt URB submission leaves NAPI enabled and EVENT_DEV_OPEN
set. A subsequent open enables NAPI again, triggering BUG_ON() in
napi_enable().

Clear EVENT_DEV_OPEN and disable NAPI on the submission error path.

Reproduced using failslab on a Raspberry Pi 3 Model B+ (LAN7515).
With the fix, the injected allocation failure returns -ENOMEM and a
subsequent open succeeds. Verified connectivity with ping and SSH.

Fixes: e110bc825897 ("net: usb: lan78xx: Convert to PHYLINK for improved PHY and MAC management")
Signed-off-by: Stefano Munari <stefanomunari.sm@gmail.com>
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
---
Changes in v2:
- Move cleanup code in err_napi unwind label as suggested by Nicolai.
- Add Nicolai's Reviewed-by tag.

v1: https://lore.kernel.org/netdev/20261016000521.92868-1-stefanomunari.sm@gmail.com
---
 drivers/net/usb/lan78xx.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index 5655941f1478..2fd1fd0cd565 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -3484,17 +3484,20 @@ static int lan78xx_open(struct net_device *net)
 		if (ret < 0) {
 			netif_err(dev, ifup, dev->net,
 				  "intr submit %d\n", ret);
-			goto done;
+			goto err_napi;
 		}
 	}
 
 	phylink_start(dev->phylink);
-
-done:
 	mutex_unlock(&dev->dev_mutex);
 
-	if (ret < 0)
-		usb_autopm_put_interface(dev->intf);
+	return 0;
+
+err_napi:
+	clear_bit(EVENT_DEV_OPEN, &dev->flags);
+	napi_disable(&dev->napi);
+	mutex_unlock(&dev->dev_mutex);
+	usb_autopm_put_interface(dev->intf);
 
 	return ret;
 }
-- 
2.55.0
Re: [PATCH net v2] net: usb: lan78xx: fix error handling in lan78xx_open()
#5703
Author: netdev-bot+sinfo
Date: Tue, 20 Oct 2026 20:29
18 lines
8692 bytes
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.

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.
Re: [PATCH net v2] net: usb: lan78xx: fix error handling in lan78xx_open()
#5727
Author: Andrew Lunn
Date: Tue, 20 Oct 2026 21:05
20 lines
9132 bytes
On Tue, Oct 20, 2026 at 10:26:14PM +0200, Stefano Munari wrote:
> A failed interrupt URB submission leaves NAPI enabled and EVENT_DEV_OPEN
> set. A subsequent open enables NAPI again, triggering BUG_ON() in
> napi_enable().
> 
> Clear EVENT_DEV_OPEN and disable NAPI on the submission error path.
> 
> Reproduced using failslab on a Raspberry Pi 3 Model B+ (LAN7515).
> With the fix, the injected allocation failure returns -ENOMEM and a
> subsequent open succeeds. Verified connectivity with ping and SSH.

Memory allocations for small blocks generally don't fail, so this is
theoretical, and very unlikely to happen. Please target net-next, and
drop the Fixes tag.

    Andrew

---
pw-bot: cr
Re: [PATCH net v2] net: usb: lan78xx: fix error handling in lan78xx_open()
#6181
Author: Stefano Munari
Date: Wed, 21 Oct 2026 20:45
34 lines
13408 bytes
Thanks Andrew. I'll send v3 to net-next without the Fixes tag once it reopens.

Is the Fixes tag being dropped because the bug is unlikely in
practice? For future patches, should similar bugs go to net-next, or
are they not worth fixing?

Stefano


On Tue, Oct 20, 2026 at 11:05 PM Andrew Lunn <andrew@lunn.ch> wrote:
>
> On Tue, Oct 20, 2026 at 10:26:14PM +0200, Stefano Munari wrote:
> > A failed interrupt URB submission leaves NAPI enabled and EVENT_DEV_OPEN
> > set. A subsequent open enables NAPI again, triggering BUG_ON() in
> > napi_enable().
> >
> > Clear EVENT_DEV_OPEN and disable NAPI on the submission error path.
> >
> > Reproduced using failslab on a Raspberry Pi 3 Model B+ (LAN7515).
> > With the fix, the injected allocation failure returns -ENOMEM and a
> > subsequent open succeeds. Verified connectivity with ping and SSH.
>
> Memory allocations for small blocks generally don't fail, so this is
> theoretical, and very unlikely to happen. Please target net-next, and
> drop the Fixes tag.
>
>     Andrew
>
> ---
> pw-bot: cr
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads