lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250910091703.3575924-1-yicongsrfy@163.com>
Date: Wed, 10 Sep 2025 17:17:03 +0800
From: yicongsrfy@....com
To: linux@...linux.org.uk
Cc: andrew@...n.ch,
	davem@...emloft.net,
	edumazet@...gle.com,
	hkallweit1@...il.com,
	kuba@...nel.org,
	linux-kernel@...r.kernel.org,
	netdev@...r.kernel.org,
	pabeni@...hat.com,
	yicong@...inos.cn
Subject: Re: [PATCH] net: phy: avoid config_init failure on unattached PHY during resume

On Wed, 10 Sep 2025 09:15:59 +0100, "Russell King (Oracle)" <linux@...linux.org.uk> wrote:
>
> On Wed, Sep 10, 2025 at 10:58:26AM +0800, yicongsrfy@....com wrote:
> > From: Yi Cong <yicong@...inos.cn>
> >
> > When resuming a PHY device that is not attached to a MAC (i.e.
> > phydev->attached_dev is NULL), mdio_bus_phy_resume() may call into
> > phy_init_hw() -> phydev->drv->config_init(), which can return -EOPNOTSUPP
> > (-95) if the driver does not support initialization in this state.
> >
> > This results in log messages like:
> > [ 1905.106209] YT8531S Gigabit Ethernet xxxxmac_mii_bus-XXXX:00:01:
> > PM: dpm_run_callback(): mdio_bus_phy_resume+0x0/0x180 [libphy] returns -95
> > [ 1905.106232] YT8531S Gigabit Ethernet xxxxmac_mii_bus-XXXX:00:01:
> > PM: failed to resume: error -95
> >
> > In practice, only one PHY on the bus (e.g. XXXX:00:00) is typically
> > attached to a MAC interface; others (like XXXX:00:01) are probed but
> > not used, making such resume attempts unnecessary and misleading.
> >
> > Add an early return in mdio_bus_phy_resume() when !phydev->attached_dev,
> > to prevent unneeded hardware initialization and avoids false error reports.
>
> PHYs are allowed to be attached without a net device. Your PHY
> driver needs to cope with this condition.
>
> --
> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
> FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

Thank you for the reply!

My thought is, if a PHY device hasn't been attached to a net_device,
is it still necessary to go through the resume procedure?

My issue context is as follows:
After entering `mdio_bus_phy_resume`, the call flow proceeds to:
`phy_init_hw()`
    => `phydev->drv->config_init`
        => `yt8521_config_init`

Then, because `phydev->interface != PHY_INTERFACE_MODE_SGMII`, it attempts
to enter `ytphy_rgmii_clk_delay_config` to configure the RGMII tx/rx delay.
However, since this PHY device is not associated with any GMAC and is not
connected via an RGMII interface, the function returns `-EOPNOTSUPP`.

Of course, I could submit a fix patch to `motorcomm.c` to terminate
`config_init` early. But as I mentioned at the beginning, when a PHY
device hasn't been attached, do we really need to let it go through
the entire resume process?


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ