Commit 1c613be
net: phy: prevent stale pointer dereference in phy_init()
mdio_bus_init() and phy_driver_register() both have error paths, and if
those are ever hit, ethtool will have a stale pointer to the
phy_ethtool_phy_ops stub structure, which references memory from a
module that failed to load (phylib).
It is probably hard to force an error in this code path even manually,
but the error teardown path of phy_init() should be the same as
phy_exit(), which is now simply not the case.
Fixes: 55d8f05 ("net: phy: Register ethtool PHY operations")
Link: https://lore.kernel.org/netdev/ZLaiJ4G6TaJYGJyU@shell.armlinux.org.uk/
Suggested-by: Russell King (Oracle) <linux@armlinux.org.uk>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Link: https://lore.kernel.org/r/20230720000231.1939689-1-vladimir.oltean@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>1 parent 7998c0a commit 1c613be
1 file changed
+14
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3451 | 3451 | | |
3452 | 3452 | | |
3453 | 3453 | | |
| 3454 | + | |
| 3455 | + | |
3454 | 3456 | | |
3455 | 3457 | | |
3456 | | - | |
| 3458 | + | |
3457 | 3459 | | |
3458 | | - | |
3459 | 3460 | | |
3460 | 3461 | | |
3461 | 3462 | | |
3462 | 3463 | | |
3463 | | - | |
| 3464 | + | |
3464 | 3465 | | |
3465 | 3466 | | |
3466 | | - | |
3467 | | - | |
| 3467 | + | |
| 3468 | + | |
| 3469 | + | |
| 3470 | + | |
| 3471 | + | |
3468 | 3472 | | |
3469 | | - | |
3470 | | - | |
| 3473 | + | |
| 3474 | + | |
| 3475 | + | |
| 3476 | + | |
| 3477 | + | |
3471 | 3478 | | |
3472 | 3479 | | |
3473 | 3480 | | |
| |||
0 commit comments