diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2017-02-17 16:07:34 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-02-20 10:15:11 -0500 |
commit | 25149ef9d25cafc4f4fe9f4461f18f876f397417 (patch) | |
tree | acc10c699ffcb5ceed825af9f051971f94387b09 /include | |
parent | 7b9a88a390dacb37b051a7b09b9a08f546edf5eb (diff) |
net: phy: Check phydev->drv
There are number of function calls, originating from user-space,
typically through the Ethernet driver that can make us crash by
dereferencing phydev->drv which will be NULL once we unbind the driver
from the PHY.
There are still functional issues that prevent an unbind then rebind to
work, but these will be addressed separately.
Suggested-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/phy.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/phy.h b/include/linux/phy.h index d9bdf53e0514..772476028a65 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -807,6 +807,9 @@ int phy_stop_interrupts(struct phy_device *phydev); static inline int phy_read_status(struct phy_device *phydev) { + if (!phydev->drv) + return -EIO; + return phydev->drv->read_status(phydev); } |