[PATCH net 0/2] net: phy: xilinx-gmii2rgmii: Fix PHY data ownership and removal

Vineeth Karumanchi vineeth.karumanchi at amd.com
Thu Oct 1 00:47:16 PDT 2026


The Xilinx GMII-to-RGMII converter copies the attached PHY driver and
replaces its read_status and set_loopback callbacks. This series addresses
two problems in that arrangement: overwriting driver data belonging to
the external PHY, and leaving phydev->drv pointing at freed converter
memory after converter removal.

Patch 1 retrieves the converter private data from its embedded phy_driver
using container_of_const(), preserving the external PHY's MDIO driver-data
field. It fixes the overwrite introduced by commit 168f7a161608 ("net: phy:
gmii2rgmii: Dont use priv field in phy device").

Patch 2 stores private data on the converter's own MDIO device and adds a
remove callback. It restores the original PHY driver under phydev->lock
and releases the reference acquired by of_phy_find_device(). This addresses
the stale pointer observed during PHY state-machine polling after
converter-only unbind. The missing removal cleanup dates back to commit
f411a6160bd4 ("net: phy: Add gmiitorgmii converter support"). Apply the
patches in order.

Vineeth Karumanchi (2):
  net: phy: xilinx-gmii2rgmii: Avoid overwriting PHY drvdata
  net: phy: xilinx-gmii2rgmii: Restore PHY driver on remove

 drivers/net/phy/xilinx_gmii2rgmii.c | 31 +++++++++++++++++++++++++----
 1 file changed, 27 insertions(+), 4 deletions(-)


base-commit: 7375d38364a9aa66fb31716bcefef38aecad75d8
-- 
2.43.0




More information about the linux-arm-kernel mailing list