From: Oleksij Rempel <o.rempel@pengutronix.de>
To: Paolo Abeni <pabeni@redhat.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Woojung Huh <woojung.huh@microchip.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
Russell King <rmk+kernel@armlinux.org.uk>,
Thangaraj Samynathan <Thangaraj.S@microchip.com>,
Rengarajan Sundararajan <Rengarajan.S@microchip.com>,
Dan Carpenter <dan.carpenter@linaro.org>,
kernel@pengutronix.de, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, UNGLinuxDriver@microchip.com,
Phil Elwell <phil@raspberrypi.org>,
Maxime Chevallier <maxime.chevallier@bootlin.com>,
Simon Horman <horms@kernel.org>
Subject: Re: [PATCH net-next v1 1/1] net: usb: lan78xx: fix possible NULL pointer dereference in lan78xx_phy_init()
Date: Tue, 1 Jul 2025 11:28:02 +0200 [thread overview]
Message-ID: <aGOqIlnVGPce8GLT@pengutronix.de> (raw)
In-Reply-To: <7c9c7be7-af3c-4f40-80b4-5b420ebbfca3@redhat.com>
On Tue, Jul 01, 2025 at 11:15:29AM +0200, Paolo Abeni wrote:
> On 6/26/25 12:37 PM, Oleksij Rempel wrote:
> > If no PHY device is found (e.g., for LAN7801 in fixed-link mode),
> > lan78xx_phy_init() may proceed to dereference a NULL phydev pointer,
> > leading to a crash.
> >
> > Update the logic to perform MAC configuration first, then check for the presence
> > of a PHY. For the fixed-link case, set up the fixed link and return early,
> > bypassing any code that assumes a valid phydev pointer.
> >
> > It is safe to move lan78xx_mac_prepare_for_phy() earlier because this function
> > only uses information from dev->interface, which is configured by
> > lan78xx_get_phy() beforehand. The function does not access phydev or any data
> > set up by later steps.
> >
> > Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> > Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
>
> Looks good, but this IMHO deserves a Fixes tag - yep, even for net-next!
>
> Could you please share it?
Fixes: e110bc825897 ("net: usb: lan78xx: Convert to PHYLINK for improved PHY and MAC management")
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2025-07-01 9:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-26 10:37 [PATCH net-next v1 1/1] net: usb: lan78xx: fix possible NULL pointer dereference in lan78xx_phy_init() Oleksij Rempel
2025-07-01 9:15 ` Paolo Abeni
2025-07-01 9:28 ` Oleksij Rempel [this message]
2025-07-01 10:50 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aGOqIlnVGPce8GLT@pengutronix.de \
--to=o.rempel@pengutronix.de \
--cc=Rengarajan.S@microchip.com \
--cc=Thangaraj.S@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew+netdev@lunn.ch \
--cc=dan.carpenter@linaro.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kernel@pengutronix.de \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maxime.chevallier@bootlin.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=phil@raspberrypi.org \
--cc=rmk+kernel@armlinux.org.uk \
--cc=woojung.huh@microchip.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).