Article View: linux.kernel.netdev
Article #5668Re: [PATCH net v3] net: usb: lan78xx: avoid NULL PHY dereference in WoL setup
From: Andrew Lunn
Date: Tue, 20 Oct 2026 19:32
Date: Tue, 20 Oct 2026 19:32
37 lines
9444 bytes
9444 bytes
On Tue, Oct 20, 2026 at 11:42:37PM +0530, Prashant Sengar wrote:
> LAN7801 supports fixed-link configurations without an attached PHY.
> However, lan78xx_set_wol() unconditionally passes netdev->phydev
> to phy_ethtool_set_wol(), causing a NULL pointer dereference when
> a userspace WoL request reaches this path.
>
> Report no WoL capabilities when no PHY is attached, and return
> -EOPNOTSUPP from lan78xx_set_wol() before modifying the wakeup
> configuration. Keep the existing phylib WoL handling for devices
> with an attached PHY.
>
> The issue was reproduced using USB Raw Gadget and dummy_hcd in QEMU.
> An ETHTOOL_SWOL ioctl triggered a kernel Oops with the original
> driver. With this change, the PHY-less configuration no longer
> advertises unsupported WoL operations, avoiding the crash.
>
> Fixes: e110bc825897 ("net: usb: lan78xx: Convert to PHYLINK for improved PHY and MAC management")
> Signed-off-by: Prashant Sengar <prashantsengar25031@gmail.com>
> @@ -1807,6 +1814,7 @@ static int lan78xx_set_wol(struct net_device *netdev,
>
> ret = phy_ethtool_set_wol(netdev->phydev, wol);
>
> +
> exit_pm_put:
> usb_autopm_put_interface(dev->intf);
Please avoid changes like this.
Once fixed, please add: Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
---
pw-bot: cr
Technical Details
Message-ID:
<9b6cff4a-3717-4d70-8a7d-6d2f040b798c@lunn.ch>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-349510-linux-kernel-netdev=dewy.ruReferences:
<20261020181237.2374075-1-prashantsengar25031@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-349510-linux-kernel-netdev=dewy.ru From: andrew@lunn.ch (Andrew Lunn) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v3] net: usb: lan78xx: avoid NULL PHY dereference in WoL setup Date: Tue, 20 Oct 2026 21:32:59 +0200 Organization: Usenet Network Message-ID: <9b6cff4a-3717-4d70-8a7d-6d2f040b798c@lunn.ch> References: <20261020181237.2374075-1-prashantsengar25031@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="3937320"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:/92C7tzpgBl+bspqwzBKuTAt0is= sha256:ToN/aPQsP0StZN8ZwWvZFKwKBimKjZoJkwiIrCoBRko= sha1:Hk+N7LbmTko/1xB5jz9a3lQ3Ssw= sha256:LQ45B2873fx3jikAX9Pn5tUTz1OKgTJSviUwYJtUh6A= Content-Disposition: inline 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 0284B110E0C; Tue, 20 Oct 2026 22:34:40 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -1.949 X-Spam-Status: No, score=-1.949 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, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key) header.d=lunn.ch 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 jH1rkAEJoQ2W; Tue, 20 Oct 2026 22:34:37 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-349510-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=lunn.ch X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 66430110E07; Tue, 20 Oct 2026 22:34:28 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 2AD0435D73; Tue, 20 Oct 2026 19:33:21 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1792524798; b=qIsix407YkMXor8kynh37K25IwiwYR1jla6tscG/EAohXA8KIxYAC6yFQwcQvFcrP8s/ lT2r6nlgsGyBTTTUgymvHVyEOkuEczu70TzBfP+ZiHj3yFR9K7gwNr73IxD6EJQSUmzno Tu8lJDhRYmI4GmgRHMVzKk9uU2xmGzIUW3Z4SkuPjceYIRGM6CPvWygtWcnAaqWgJzYEF IVxVk7ZRnnx1khH+tnOyp/iCz0FfaVqzqdhILHlXN11PRzwSyyNkBx6AbgX0Vnvy8VqGj lAFbBQzC3M8W8Vu2TX9FRWYw7p9RTPwl23NY9mbplep54OTSSyL0fjgobPN2EkyGD/Q== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792524798; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:Date: From:To:Cc:Subject:Message-ID:References:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=ZI2XOhYhSS+ON68+ycU1NaNTWPtxOOczoynazLMcOec=; b=nlJ1Os5znUT0UbYH5+hUcqZyM2ZkxDw0DxGvB0HPhJN6V4mAwbSgS5HoG7YHiQ8wcTns DTAbNjX7NzEe8bsoi897QMRUlWXh5REjcBKrnL/IssEAHdBOnci8UqiDt+jOaDHXpxMdR 2OlgEXrHaDTQTaUPFdpwigAKsHw6FD/JKHXRRSDboPN2JREq4kvgvI7ogKFHIR0Awfz/C uILCDTNgDJKB6DZ4zGgtbLbTKuH8ieR0uNbrmyVGf//czt9789u8X84BJq/G8a8asty7C sfqJoyjaGePEbZMXj9MZOk7m+G1vO9UczIW0XZsk95q469Ka6KDYK50Uy8v9hKBwhww== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b="Ck1M7/DE"; dmarc=pass header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CA45C606A31C; Tue, 20 Oct 2026 19:33:18 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=Ck1M7/DE X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=156.67.10.101 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792524783; b=GPAF9bWPcy5/bUhkw/beLUyGCxT7aACGtsvbdIJ8YWAWX/tT4jnvF8JcOEDvIK9Hl6zT 30HVF3mBN+dMPrf4jAuq+Eeujy0/jY2ryIr16MNSGeJEu8q7PSGfLkOhnzrvMNTm7G/W0 IHPCXzFMy+vBnk+sqiki+yuaq/LNE49aMbXDioKJMZ2J3mAdFykb2f36i6gnx9VNawUpc cE/06s3FXe9KlQd4NQ6mqbqVQ4bSRyIzwiCk22zw5ABRb6kmgrVglyEmrrPEYMzLNe64n mLbb9mCggk1M3cD7RJkwBLa4/W3Ge8q/155+PE3c/1dOJxFfUS66MQqg4x2B3V6merA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792524783; h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; bh=ZI2XOhYhSS+ON68+ycU1NaNTWPtxOOczoynazLMcOec=; b=hN2/MANa7iAMwHpez2N8VbJqOSl5Hj2vkyYnahCb2db3hQHok2GDFcKMo4INJDJQj22j 6DipQO0OZJhGu/3g3zrgEK/MxZ8Kdhh3XNeCbH+fev4eiimPctgxn7caCIo1sG592fdvH jNjdluBffWIqpOZWy/1rFFFB/zcOobK8Dxoo1ZuDy6o7jWbEDEvqAkoIA2PqDQ0yBkceE e24Ld9EtY3GScZpiBDPa9LyEDbdtF3BkoBn1hJtw7ITny0qu2+//plpk9c08BhQTe/ipr xAKMtaF4GyxKGi9lzkRBuaMosRSGx4xbrwjJs2ZLJy+G0dM+UfsZtc6Uy9ODMx98lrg== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b="Ck1M7/DE"; arc=none smtp.remote-ip=156.67.10.101 X-Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 685F8606A319; Tue, 20 Oct 2026 19:33:03 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 685F8606A319 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch X-DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=ZI2XOhYhSS+ON68+ycU1NaNTWPtxOOczoynazLMcOec=; b=Ck1M7/DEzX3otab1/vZLj5+glh JtHxK8DuJsK8W172OphKQJHHORFhLFqv7/rWaQAztGFA3PAc6aMpUemJTWoEqbBvi/qHiLelD6NoP eNU1WfAiR8RH45pWI+6mTMbb9m2PHU/1L7AkfCOawTPZyE4PdV2Gtr3QJlng7QZL7A7M=; X-Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from <andrew@lunn.ch>) id 1xJFZz-00BuiX-3P; Tue, 20 Oct 2026 21:32:59 +0200 X-Cc: netdev@vger.kernel.org, Thangaraj.S@microchip.com, UNGLinuxDriver@microchip.com, andrew+netdev@lunn.ch, linux-usb@vger.kernel.org X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-In-Reply-To: <20261020181237.2374075-1-prashantsengar25031@gmail.com>