]> git.baikalelectronics.ru Git - kernel.git/commit
net: phy: Avoid NPD upon phy_detach() when driver is unbound
authorFlorian Fainelli <f.fainelli@gmail.com>
Thu, 17 Sep 2020 03:43:09 +0000 (20:43 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 17 Sep 2020 23:55:35 +0000 (16:55 -0700)
commitb3c45404acadb0acd00ab07dada9c995bf1db902
tree2b8fc7d5d78328acf2312d1274cfc28291a0df9b
parentf3cd33189d23dfe166035545fb0dbfa6708a4042
net: phy: Avoid NPD upon phy_detach() when driver is unbound

If we have unbound the PHY driver prior to calling phy_detach() (often
via phy_disconnect()) then we can cause a NULL pointer de-reference
accessing the driver owner member. The steps to reproduce are:

echo unimac-mdio-0:01 > /sys/class/net/eth0/phydev/driver/unbind
ip link set eth0 down

Fixes: dddbb3b6621b ("net: phy: Fix lack of reference count on PHY driver")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/phy_device.c