Article View: linux.kernel.netdev
Article #4875Re: [PATCH net] net: usb: lan78xx: fix error handling in lan78xx_open()
From: Nicolai Buchwitz
Date: Mon, 19 Oct 2026 11:25
Date: Mon, 19 Oct 2026 11:25
65 lines
8030 bytes
8030 bytes
Hi Stefano
On 16.10.2026 02:05, 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.
>
> Fixes: e110bc825897 ("net: usb: lan78xx: Convert to PHYLINK for
> improved PHY and MAC management")
> Signed-off-by: Stefano Munari <stefanomunari.sm@gmail.com>
> ---
> drivers/net/usb/lan78xx.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
> index 5655941f1478..6a95934bb3d3 100644
> --- a/drivers/net/usb/lan78xx.c
> +++ b/drivers/net/usb/lan78xx.c
> @@ -3484,6 +3484,8 @@ static int lan78xx_open(struct net_device *net)
> if (ret < 0) {
> netif_err(dev, ifup, dev->net,
> "intr submit %d\n", ret);
> + clear_bit(EVENT_DEV_OPEN, &dev->flags);
> + napi_disable(&dev->napi);
> goto done;
> }
> }
Looks correct to me. Maybe move the cleanup into an unwind label, so
the next error path added after napi_enable() doesn't miss it?
if (ret < 0) {
netif_err(dev, ifup, dev->net,
"intr submit %d\n", ret);
goto err_napi;
}
}
phylink_start(dev->phylink);
mutex_unlock(&dev->dev_mutex);
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;
Either way:
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Thanks,
Nicolai
Technical Details
Message-ID:
<7b05d39d4674c16065b03f88b1ccfd05@tipi-net.de>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-348462-linux-kernel-netdev=dewy.ruReferences:
<20261016000521.92868-1-stefanomunari.sm@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-348462-linux-kernel-netdev=dewy.ru From: nb@tipi-net.de (Nicolai Buchwitz) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net] net: usb: lan78xx: fix error handling in lan78xx_open() Date: Mon, 19 Oct 2026 13:25:12 +0200 Organization: Usenet Network Message-ID: <7b05d39d4674c16065b03f88b1ccfd05@tipi-net.de> References: <20261016000521.92868-1-stefanomunari.sm@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="3587819"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:Q7mGU1wTrUhJtVBdwB80rzhV9Ko= sha256:C+iSSMlm0euSfe7i0DqeNmLSEMaa3mynlWxMIJJ9FsA= sha1:CqBxrk16r1uQ6GUMpnw/TAqYGK4= sha256:t5mBI6XWHSJUkBNtYKC8TOxyCVbHD+srjM+VemlIYfY= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 088831109B6; Mon, 19 Oct 2026 14:29:36 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -1.95 X-Spam-Status: No, score=-1.95 tagged_above=-9999 required=6.31 tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=tipi-net.de X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id awpONeXKnfZs; Mon, 19 Oct 2026 14:29:33 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-348462-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=tipi-net.de X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 4E7C81109B5; Mon, 19 Oct 2026 14:29:25 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by tor.lore.kernel.org (Postfix) with ESMTP id 4E9B239D5E; Mon, 19 Oct 2026 11:25:21 +0000 (UTC) X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2EE324E3769; Mon, 19 Oct 2026 11:25:20 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tipi-net.de header.i=@tipi-net.de header.b="V838IofJ" X-Received: from mail.tipi-net.de (mail.tipi-net.de [194.13.80.246]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ECCE833D4E9; Mon, 19 Oct 2026 11:25:16 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.13.80.246 X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792409120; cv=none; b=eMjIbSJfd363j1zgPEJ4Z0+iDGrnwnJVHOdMBl/xVkXg2iRVXj2fEFZ448NNLVQxTfnUY3saMzJRdtiszaME1QHgekJxerAYNKLX0R0/eqZvnB0puA26VKPhfaVR7ikkaWeWYMhiFk9f7uuEnSjSD/Tr40bUgV+YAedVUd6VZtk= X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792409120; c=relaxed/simple; bh=1mOOSFujhvgs94vGgbMhMXlk/u+ISHgI+nzKorFbgV0=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type; b=GyhBRtT/O+edImhGKAtewYhkf5g1hKh/lH++1TrNNmiq9pgd2fcVfcn0cAQ8+nM5tqVsHgV0vb9mvnGK1kGE3uYxgHF1uB5l6dtAN2xa8T+8IDL5P2Fo9UVgbBTL9XwH+2PZCSQoJXmT9oX/JqTsaB+SaycnqRkDbVQhQPf0/zY= X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de; spf=pass smtp.mailfrom=tipi-net.de; dkim=pass (2048-bit key) header.d=tipi-net.de header.i=@tipi-net.de header.b=V838IofJ; arc=none smtp.client-ip=194.13.80.246 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tipi-net.de X-Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 9FCF0A156C; Mon, 19 Oct 2026 13:25:12 +0200 (CEST) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tipi-net.de; s=dkim; t=1792409114; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=J6+x4cQLsxMhtrH368z9koyzpirWhm9EMhYA6RfUa00=; b=V838IofJg4OOVIPaPOeCMA2XcWEXk5S2HYIGwII25aTJf/495+np1SbbzWZY/i2GDdeB24 yry+/x78IqUibweoGMUz3TXvc/2xon8NInTQZj1OWbVscnLfCFntS80/TH5AlvkIWyVm6+ gjYZ/MI/cSowaPmILQ9AvHRu+CLqZSW13r+P5qLxW1Z8yJ+B3CodbRIOEuKZHerza3Ss5D plyIhnAF6WktK0XblauT4XPbVH27Nxzi8LcB12g2VSxcZw7RQgRx12OFWWjn/qpHQYGf44 tODwgdZ4Hu1fgCtnA4NF0hRBcDPo0vwtYt2meoYoerJ3i04dEQqnYsih59oLfw== X-Precedence: bulk X-Mailing-List: netdev@vger.kernel.org X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-Cc: Thangaraj Samynathan <Thangaraj.S@microchip.com>, UNGLinuxDriver@microchip.com, Andrew Lunn <andrew+netdev@lunn.ch>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>, Oleksij Rempel <o.rempel@pengutronix.de>, netdev@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org X-In-Reply-To: <20261016000521.92868-1-stefanomunari.sm@gmail.com> X-Sender: nb@tipi-net.de X-Last-TLS-Session-Version: TLSv1.3