Article View: linux.kernel.netdev
Article #5484Re: [PATCH net v2] net: usb: lan78xx: avoid NULL PHY dereference in WoL setup
From: Andrew Lunn
Date: Tue, 20 Oct 2026 12:17
Date: Tue, 20 Oct 2026 12:17
43 lines
9805 bytes
9805 bytes
On Tue, Oct 20, 2026 at 12:35:04PM +0530, Prashant Sengar wrote: > Hi Andrew, > > While testing the unconditional phylink_ethtool_set_wol() call, I > noticed that it returns -EOPNOTSUPP for the PHY-less LAN7801 > fixed-link configuration in my QEMU USB Raw Gadget setup. > > The NULL dereference is avoided, but lan78xx_set_wol() updates > pdata->wol and the USB wakeup policy before calling phylink. I > observed the following when disabling WoL: > > Before SET: WoL = 0x20, USB wakeup enabled > SET WoL=0: -EOPNOTSUPP > After SET: WoL = 0x00, USB wakeup disabled > > LAN78xx currently doesn't register a mac_wol_set callback with > phylink, although it has its own controller-side WoL handling during > suspend. > > I wanted to share this observation while investigating the WoL path. > Is this behavior expected for the fixed-link configuration, or am I > overlooking some existing handling? WoL with fixed link is not the usual setup developers have, so it is probably untested. There might be issues here. So the first question is Why does it return EOPNOTSUPP? With phylink, it splits into two parts. The MAC driver needs to indicate it supports WoL by providing mac_wol_set() in its phylink_mac_ops, and indicating what WoL modes the MAC supports. Does the lan7801 have that? https://elixir.bootlin.com/linux/v7.3/source/drivers/net/usb/lan78xx.c#L2608 suggests it does not. Try implementing it. Look at what stmmac does. The second part is what does the PHY provide? phylink_phy_supports_wol() does check for a NULL phydev, so it looks O.K. Andrew
Technical Details
Message-ID:
<7bff1292-9371-4e3e-8062-31a554aeee17@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-349274-linux-kernel-netdev=dewy.ruReferences:
<20261019193148.1381545-1-prashantsengar25031@gmail.com> <d9177176-75c2-4273-b5ba-d0c6afdad6c5@lunn.ch> <CABW1sBkKtBt0gipBNsNRWbwYy3GSDbe2d0TMBX8=whwu4WQmJg@mail.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-349274-linux-kernel-netdev=dewy.ru From: andrew@lunn.ch (Andrew Lunn) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v2] net: usb: lan78xx: avoid NULL PHY dereference in WoL setup Date: Tue, 20 Oct 2026 14:17:36 +0200 Organization: Usenet Network Message-ID: <7bff1292-9371-4e3e-8062-31a554aeee17@lunn.ch> References: <20261019193148.1381545-1-prashantsengar25031@gmail.com> <d9177176-75c2-4273-b5ba-d0c6afdad6c5@lunn.ch> <CABW1sBkKtBt0gipBNsNRWbwYy3GSDbe2d0TMBX8=whwu4WQmJg@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="3849115"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:z3/Qy7gx+8BduZD9EVMGLtyp/Ak= sha256:PUo+kueTH/b0XULgqtrtqUfzwUPFw0fX9QkbFbNY9UI= sha1:eHPjXVO8eFXs/4Cl57j1XrG5kRE= sha256:5XAzrKH3TcHqc8+EA/+J1Qnvmv/FeY4ietoXQgKpj4U= 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 C98CA110CE3; Tue, 20 Oct 2026 15:18:17 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.05 X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31 tests=[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 (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 SyNR150LejSQ; Tue, 20 Oct 2026 15:18:05 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-349274-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 97CCD110CA7; Tue, 20 Oct 2026 15:17:56 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 308E235B34; Tue, 20 Oct 2026 12:17:49 +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=1792498668; b=QQ4fRXJ4yLU7Ni/M2C1JLu+NlBgg8oH6gwy9GaXleW1vGPTCqcQ8q3MstvUfIhqlr5Ta K0rqkuFuLnJGGqEMwj3eZdzWO86rU0yKKd2Nn7KYYspq4rxWtRQsDpgfGAuD7KhgE8G0t hUsQURfjd9dc9UD9yk+ubkjWXnurhjPjFYvMDt9WTWnYbqife5SNowq3xcyMsEFEPlzIM yXtboYWbrWeWOwi7Buq5Ac1JkqDWF1mpIWnmk8mCT9JQhYN1sexf7KVp8nsOsEBOCe0F+ /HvxC7mTUFadSak87PjSlQQvgET5bnSdIn2p0XGFWBPkcfD2wlnqnooUgo8PJqtUhKg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792498668; 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=TQCzSCnGOaVxSul1Ib03g+n3z4QSIZt1e/MKG68ekUY=; b=fIC3dk7qAIK3+xXO31ZECu8a7VvMxtlUHcC75KXMGzsWa6guWCe4HXrgULv20hJvgN+N PNVKhn3eaDCugktzsbNJSYJcRykM1sgvVnkd8OVbMwX9wFtGxtL+cAf8zQ5fz7P8CV+I4 G1Rj5kt9L+Of/OmGOByGsYUu2Xg1rTP/4uZMSBF11rCc2KbAcKKcSsnnfgjJHkEVmAqaT bKmK4qUFRGsIhA0XpLyt05+JjqESJZwchTLOZZVcmG60LFlN6UPMU3FXAR/Nza5fiVRJ2 bXbI+DpMGKbIMVDF4n9TC/WqCHXDBTuQhEiR2qbtsDv3ne+wXFbRF+NiFWJYMQdNreQ== 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=OzU4Kzup; 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 7602E606A31F; Tue, 20 Oct 2026 12:17:48 +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=OzU4Kzup 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=1792498662; b=gz37Bxb2bqKKlcqVhDusvRH4nIZcunqT/2NPHPPyzP8wFXLsDAOvXW6JlM429r8nkXTf 7YcwZEUytn83iSgnzn9Wu+hVqs3Jdu7wWD8BW2X4MbinkkMLDnPP9f4ktT2d10gk3Cnht kHBOvN2puaMSqQ+M3t6PYYJqLk2Wc5K2l4nEMqU4p0KIPmG//ikgl7axWtiVCpBRGTQbI hUVBuRB/Dt74iiV8IZKZW4fNbFycg/PJkNlBgSqFBQyWCf95tMX4tASZ3Qe9WdUJ9PqoF epSPFOV0ZPmktQL4sG9+3NH4iirgi5QRtYCHScE+1BYI+55J6MOJUWU9p//rcQX9G/Q== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792498662; h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; bh=TQCzSCnGOaVxSul1Ib03g+n3z4QSIZt1e/MKG68ekUY=; b=3ihVUOfQwWeRwP72iGJJc77r13G+AgXMfoYKa522LoT5A994mmUvFEiRRVgv2J0APt+B J36JsNd0s5W+QEU3oeqnpfsmvD1DLzTK0huD7UyscQ/pkfBoPNHmrSphQbvoAWpCY88hu R+ve3Bof9HPCuEdyMLoQTjLNQ8bZJJC+AqFjWh1PvZgFh3Ua6NsJsPd5c27OsTAUdkFQB CtR0Ojcb8oeiQfK/4po2zyj1GuH1CbnZIMDckNoRY67/yGNjmgnN6NuyyYrBvFdtZrX8g Jt6HEtkLW2t0CgHOq1uo4xA8x7MrsScaybYcGoPf2LNMLNrT3+hDFARAwM179p++yCA== 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=OzU4Kzup; 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 63962606A319; Tue, 20 Oct 2026 12:17:41 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 63962606A319 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=TQCzSCnGOaVxSul1Ib03g+n3z4QSIZt1e/MKG68ekUY=; b=OzU4Kzuph/mTybi9iJzjDR/Doo nJtOprj56/DAD6eMpCOPj22KUSrMizAe4RECJa7OsjT4zwTf4qMQzkiels3v3iGPmWaJWQnw/QkZ8 bn0PJNrfTmZRnT4nNInS5qG+qlIz9yZ96BPq8Y3xYvFVKGeyAyn3+Czl9us+14IJzcWc=; X-Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from <andrew@lunn.ch>) id 1xJ8me-00BqSO-8c; Tue, 20 Oct 2026 14:17:36 +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: <CABW1sBkKtBt0gipBNsNRWbwYy3GSDbe2d0TMBX8=whwu4WQmJg@mail.gmail.com>