mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] net: phy: realtek: fix listing of sysfs directory tree
@ 2026-11-15 21:40 Mateusz Jończyk
  2026-11-15 23:00 ` Andrew Lunn
  2026-11-16 21:43 ` netdev-bot+sashiko
  0 siblings, 2 replies; 3+ messages in thread
From: Mateusz Jończyk @ 2026-11-15 21:40 UTC (permalink / raw)
  To: Andrew Lunn, Javen Xu
  Cc: Heiner Kallweit, Russell King, Jakub Kicinski, Maxime Chevallier,
	netdev, linux-kernel, Mateusz Jończyk, stable

On git master, listing the contents of sysfs produces an error:

	root@mateusz-debian:/sys# LANG=C find -iname foobar
	find: './module/realtek/drivers': Input/output error
	root@mateusz-debian:/sys# LANG=C ls -1 ./module/realtek/drivers
	ls: reading directory './module/realtek/drivers': Input/output error
	'mdio_bus:Generic FE-GE Realtek PHY'
	'mdio_bus:RTL8201CP Ethernet'
	'mdio_bus:RTL8201F Fast Ethernet'
	'mdio_bus:RTL8208 Fast Ethernet'
	'mdio_bus:RTL8211B Gigabit Ethernet'
	[...]

Investigation shows that the forward slash in the driver name is the
culprit. Fix it.

Cc: stable@vger.kernel.org
Fixes: f0667918d5fc ("net: phy: realtek: add support for RTL8261D")
Signed-off-by: Mateusz Jończyk <mat.jonczyk@o2.pl>
---
 drivers/net/phy/realtek/realtek_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/phy/realtek/realtek_main.c b/drivers/net/phy/realtek/realtek_main.c
index ca2d515b77b3..a39ad18382f2 100644
--- a/drivers/net/phy/realtek/realtek_main.c
+++ b/drivers/net/phy/realtek/realtek_main.c
@@ -3483,7 +3483,7 @@ static struct phy_driver realtek_drvs[] = {
 		.write_mmd	= genphy_write_mmd_unsupported,
 	}, {
 		PHY_ID_MATCH_EXACT(RTL_8261C_CG),
-		.name			= "Realtek RTL8261C/D 10Gbps PHY",
+		.name			= "Realtek RTL8261C_RTL8261D 10Gbps PHY",
 		.probe			= rtl8261x_probe,
 		.config_init		= rtl8261x_config_init,
 		.get_features		= rtl8261x_get_features,
-- 
2.47.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: phy: realtek: fix listing of sysfs directory tree
  2026-11-15 21:40 [PATCH] net: phy: realtek: fix listing of sysfs directory tree Mateusz Jończyk
@ 2026-11-15 23:00 ` Andrew Lunn
  2026-11-16 21:43 ` netdev-bot+sashiko
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2026-11-15 23:00 UTC (permalink / raw)
  To: Mateusz Jończyk
  Cc: Javen Xu, Heiner Kallweit, Russell King, Jakub Kicinski,
	Maxime Chevallier, netdev, linux-kernel, stable

On Sun, Nov 15, 2026 at 10:40:45PM +0100, Mateusz Jończyk wrote:
> On git master, listing the contents of sysfs produces an error:
> 
> 	root@mateusz-debian:/sys# LANG=C find -iname foobar
> 	find: './module/realtek/drivers': Input/output error
> 	root@mateusz-debian:/sys# LANG=C ls -1 ./module/realtek/drivers
> 	ls: reading directory './module/realtek/drivers': Input/output error
> 	'mdio_bus:Generic FE-GE Realtek PHY'
> 	'mdio_bus:RTL8201CP Ethernet'
> 	'mdio_bus:RTL8201F Fast Ethernet'
> 	'mdio_bus:RTL8208 Fast Ethernet'
> 	'mdio_bus:RTL8211B Gigabit Ethernet'
> 	[...]
> 
> Investigation shows that the forward slash in the driver name is the
> culprit. Fix it.
> 
> Cc: stable@vger.kernel.org
> Fixes: f0667918d5fc ("net: phy: realtek: add support for RTL8261D")
> Signed-off-by: Mateusz Jończyk <mat.jonczyk@o2.pl>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: phy: realtek: fix listing of sysfs directory tree
  2026-11-15 21:40 [PATCH] net: phy: realtek: fix listing of sysfs directory tree Mateusz Jończyk
  2026-11-15 23:00 ` Andrew Lunn
@ 2026-11-16 21:43 ` netdev-bot+sashiko
  1 sibling, 0 replies; 3+ messages in thread
From: netdev-bot+sashiko @ 2026-11-16 21:43 UTC (permalink / raw)
  To: mat.jonczyk
  Cc: andrew, javen_xu, hkallweit1, linux, kuba, maxime.chevallier,
	netdev, linux-kernel, stable

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 1 · Medium: 0 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [High] The patch renames one Realtek PHY driver ("Realtek RTL8261C/D
  10Gbps PHY" -> "Realtek RTL8261C_RTL8261D 10Gbps PHY" in realtek_drvs,…

--

net: phy: realtek: fix listing of sysfs directory tree

This commit renames the RTL8261C/D PHY driver from "Realtek RTL8261C/D
10Gbps PHY" to "Realtek RTL8261C_RTL8261D 10Gbps PHY". The '/' in the old
name makes reading /sys/module/realtek/drivers fail with EIO. It is tagged
for stable.

> diff --git a/drivers/net/phy/realtek/realtek_main.c b/drivers/net/phy/realtek/realtek_main.c
> index ca2d515b77b36..a39ad18382f25 100644
> --- a/drivers/net/phy/realtek/realtek_main.c
> +++ b/drivers/net/phy/realtek/realtek_main.c
> @@ -3483,7 +3483,7 @@ static struct phy_driver realtek_drvs[] = {
>  		.write_mmd	= genphy_write_mmd_unsupported,
>  	}, {
>  		PHY_ID_MATCH_EXACT(RTL_8261C_CG),
> -		.name			= "Realtek RTL8261C/D 10Gbps PHY",
> +		.name			= "Realtek RTL8261C_RTL8261D 10Gbps PHY",

[Severity: High]

This fixes one driver, but does it leave the root cause in place?

The symlink name under /sys/module/<mod>/drivers is built from the raw
driver name in make_driver_name():

drivers/base/module.c:make_driver_name() {
	driver_name = kasprintf(GFP_KERNEL, "%s:%s", drv->bus->name, drv->name);
	...
}

module_add_driver() then creates the link under that name:

	ret = sysfs_create_link(mk->drivers_dir, &drv->p->kobj, driver_name);

kernfs accepts the '/'. When the directory is read, verify_dirent_name()
in fs/readdir.c rejects the name and getdents fails for the whole
directory:

	if (memchr(name, '/', len))
		return -EIO;

The driver kobject itself is not affected, because
kobject_set_name_vargs() already does strreplace(t, '/', '!'). Only the
module drivers symlink name skips that replacement.

At this commit, several other tristate PHY drivers still have '/' in
their names:

  drivers/net/phy/smsc.c: "SMSC LAN8710/LAN8720"
  drivers/net/phy/qcom/at803x.c: "Qualcomm Atheros AR8031/AR8033"
  drivers/net/phy/marvell.c: "Marvell 88E308X/88E609X Family"
  drivers/net/phy/davicom.c: "Davicom DM9161B/C"
  drivers/net/phy/intel-xway.c: "Intel XWAY PHY11G (PEF 7071/PEF 7072) v1.3"
    (plus three more entries in the same file)
  drivers/net/phy/microchip_t1s.c: "LAN865X Rev.B0/B1 Internal Phy"
  drivers/net/phy/xpowers/acx00.c: "X-Powers AC200/AC300 EPHY"

If any of these is built as a module and loaded, find /sys and
ls /sys/module/<mod>/drivers should still fail with EIO. That is the same
symptom quoted in the commit message.

Could the '/' be replaced in make_driver_name() instead, the same way
kobject_set_name_vargs() does it? That would fix every bus and any future
driver name. It would also avoid renaming the user-visible
/sys/bus/mdio_bus/drivers/ entry for this PHY in a stable backport.

>  		.probe			= rtl8261x_probe,
>  		.config_init		= rtl8261x_config_init,
>  		.get_features		= rtl8261x_get_features,

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261115214045.3704-1-mat.jonczyk%40o2.pl

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-16 21:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-15 21:40 [PATCH] net: phy: realtek: fix listing of sysfs directory tree Mateusz Jończyk
2026-11-15 23:00 ` Andrew Lunn
2026-11-16 21:43 ` netdev-bot+sashiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®