Re: [PATCH] net: phy: realtek: fix listing of sysfs directory tree

From: Andrew Lunn

Date: Mon Nov 16 2026 - 19:47:41 EST


> [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;
>

This is a kernel wide problem, so i don't think this patch needs to
address it.

> 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"

Maybe turn this into a patch series and address all these, one patch
each. That way, if we have any ABI issues, it is easy to revert just
one driver.

Andrew