diff options
| author | Jakub Kicinski <kuba@kernel.org> | 2026-10-16 18:44:47 -0700 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2026-10-16 18:44:48 -0700 |
| commit | 8b0244ca4fa4e717ffe6874f7eadc59ebb6ae5ba (patch) | |
| tree | 9ade698d325cfb61a9acac4d87d2ab7cbb1dd0f5 /include | |
| parent | b4423835d9c528c242531c7ba455b4f687906acb (diff) | |
| parent | 7151b86654fa635101cabe7f55511f54c3adcf84 (diff) | |
Merge branch 'net-phy-fix-a-second-attach-of-an-attached-phy-and-the-module-put-on-detach'
Aleksei Sviridkin says:
====================
net: phy: fix a second attach of an attached PHY and the module put on detach
Two phylib fixes found on a Keenetic KN-1012 (MT7981) while chasing a
PHY driver unbind race. A second attach of an attached PHY tears down
the first consumer, and a detach after a driver unbind leaks the module
reference.
1: refuse a second attach before the driver module is taken or the
generic driver bound.
2: put the module the attach pinned, not whatever driver is bound at
detach.
Patch 1 goes first: with patch 2 alone, the second attach error path
leaves the first consumer's module reference pinned.
====================
Link: https://patch.msgid.link/20261013151200.2473464-1-f@lex.la
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/phy.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/phy.h b/include/linux/phy.h index 7c5098a0dd6c..a5a419bc400e 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -578,6 +578,7 @@ struct phy_oatc14_sqi_capability { * * @mdio: MDIO bus this PHY is on * @drv: Pointer to the driver for this PHY instance + * @drv_owner: Driver module phy_attach_direct() took a reference on * @devlink: Create a link between phy dev and mac dev, if the external phy * used by current mac interface is managed by another mac interface. * @phyindex: Unique id across the phy's parent tree of phys to address the PHY @@ -689,6 +690,7 @@ struct phy_device { /* Information about the PHY type */ /* And management functions */ const struct phy_driver *drv; + struct module *drv_owner; struct device_link *devlink; |
