net: phylib: ensure phy device drivers do not match by DT
Subsystems (3)
PATCH 1/1 net: phylib: ensure phy device drivers do not match by DT
PHYLIB device drivers must match by either numerical PHY ID or by their .match_phy_device method. Matching by DT is not permitted.
Tested-by Andrew Lunn <[email protected]>
Reviewed-by Andrew Lunn <[email protected]>
Signed-off-by Russell King (Oracle) <[email protected]>
--- drivers/net/phy/phy_device.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/net/phy/phy_device.c +10 -0
@@ -3146,6 +3146,16 @@ int phy_driver_register(struct phy_driver *new_driver, struct module *owner)return -EINVAL ; } +/* PHYLIB device drivers must not match using a DT compatible table +* as this bypasses our checks that the mdiodev that is being matched +* is backed by a struct phy_device. If such a case happens, we will +* make out-of-bounds accesses and lockup in phydev->lock. +*/ +if (WARN (new_driver->mdiodrv.driver.of_match_table, +"%s: driver must not provide a DT match table\n" , + new_driver->name)) +return -EINVAL ; + new_driver->mdiodrv.flags |=MDIO_DEVICE_IS_PHY ; new_driver->mdiodrv.driver.name = new_driver->name; new_driver->mdiodrv.driver.bus = &mdio_bus_type;
Signature · 1 line
2.30.2
This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Quoted 9 lines · On Thu, 07 Oct 2021 14:23:32 +0100 you wrote:
PHYLIB device drivers must match by either numerical PHY ID or by their .match_phy_device method. Matching by DT is not permitted.
Tested-by Andrew Lunn <[email protected]>Reviewed-by Andrew Lunn <[email protected]>Signed-off-by Russell King (Oracle) <[email protected]>[...]
Here is the summary with links:
- [net-next] net: phylib: ensure phy device drivers do not match by DT
https://git.kernel.org/netdev/net-next/c/2b12d51c4fa8
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html