[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YZuvFVXuKFdwpFmY@shell.armlinux.org.uk>
Date: Mon, 22 Nov 2021 14:54:13 +0000
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Yinbo Zhu <zhuyinbo@...ngson.cn>
Cc: Andrew Lunn <andrew@...n.ch>,
Heiner Kallweit <hkallweit1@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Masahiro Yamada <masahiroy@...nel.org>,
Michal Marek <michal.lkml@...kovi.net>,
Nick Desaulniers <ndesaulniers@...gle.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-kbuild@...r.kernel.org
Subject: Re: [PATCH v1 2/2] net: mdio: fixup ethernet phy module auto-load
function
On Mon, Nov 22, 2021 at 08:14:58PM +0800, Yinbo Zhu wrote:
> the phy_id is only phy identifier, that phy module auto-load function
> should according the phy_id event rather than other information, this
> patch is remove other unnecessary information and add phy_id event in
> mdio_uevent function and ethernet phy module auto-load function will
> work well.
>
> Signed-off-by: Yinbo Zhu <zhuyinbo@...ngson.cn>
> ---
> drivers/net/phy/mdio_bus.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
> index 6865d93..999f0d4 100644
> --- a/drivers/net/phy/mdio_bus.c
> +++ b/drivers/net/phy/mdio_bus.c
> @@ -962,12 +962,12 @@ static int mdio_bus_match(struct device *dev, struct device_driver *drv)
>
> static int mdio_uevent(struct device *dev, struct kobj_uevent_env *env)
> {
> - int rc;
> + struct phy_device *pdev;
>
> - /* Some devices have extra OF data and an OF-style MODALIAS */
> - rc = of_device_uevent_modalias(dev, env);
> - if (rc != -ENODEV)
> - return rc;
> + pdev = to_phy_device(dev);
> +
> + if (add_uevent_var(env, "MODALIAS=mdio:p%08X", pdev->phy_id))
> + return -ENOMEM;
The MDIO bus contains more than just PHYs. This completely breaks
anything that isn't a PHY device - likely by performing an
out-of-bounds access.
This change also _totally_ breaks any MDIO devices that rely on
matching via the "of:" mechanism using the compatible specified in
DT. An example of that is the B53 DSA switch.
Sorry, but we've already learnt this lesson from a similar case with
SPI. Once one particular way of dealing with MODALIAS has been
established for auto-loading modules for a subsystem, it is very
difficult to change it without causing regressions.
We need a very clear description of the problem that these patches are
attempting to address, and then we need to see that effort has been
put in to verify that changing the auto-loading mechanism is safe to
do - such as auditing every single driver that use the MDIO subsystem.
>
> return 0;
> }
> @@ -991,7 +991,7 @@ static int mdio_uevent(struct device *dev, struct kobj_uevent_env *env)
> };
>
> struct bus_type mdio_bus_type = {
> - .name = "mdio_bus",
> + .name = "mdio",
This looks like an unrelated user-interface breaking change. This
changes the path of all MDIO devices and drivers in /sys/bus/mdio_bus/*
Thanks.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists