[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <39d7c6be-c3e9-4c2f-b814-e0b2e838ad41@lunn.ch>
Date: Thu, 7 Aug 2025 14:55:08 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Xu Yang <xu.yang_2@....com>
Cc: "Russell King (Oracle)" <linux@...linux.org.uk>, hkallweit1@...il.com,
o.rempel@...gutronix.de, pabeni@...hat.com, netdev@...r.kernel.org,
imx@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [RESEND] net: phy: fix NULL pointer dereference in
phy_polling_mode()
> diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
> index 9b0318fb50b5..9fba1cb17134 100644
> --- a/drivers/net/usb/asix_devices.c
> +++ b/drivers/net/usb/asix_devices.c
> @@ -676,6 +676,7 @@ static int ax88772_init_mdio(struct usbnet *dev)
> priv->mdio->read = &asix_mdio_bus_read;
> priv->mdio->write = &asix_mdio_bus_write;
> priv->mdio->name = "Asix MDIO Bus";
> + priv->mdio->phy_mask = ~BIT(priv->phy_addr);
> /* mii bus name is usb-<usb bus number>-<usb device number> */
> snprintf(priv->mdio->id, MII_BUS_ID_SIZE, "usb-%03d:%03d",
> dev->udev->bus->busnum, dev->udev->devnum);
>
> Is this the right thing to do?
This is what i was trying to do, i just put it in the wrong place
because i had the wrong device.
ax88772_init_phy() will only use the PHY at address priv->phy_addr, so
this appears to be safe.
The alternative is to have a custom asix_mdio_read() for this device,
which returns -ENODEV if the phy_id being read does not equal
priv->phy_addr. That will also prevent these extra PHYs from being
created.
Andrew
Powered by blists - more mailing lists