mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-16 12:14:06 +00:00
net: phy: fix null dereference in phy_attach_direct
Commitbc66fa87d4
("net: phy: Add link between phy dev and mac dev") introduced a link between net devices and phy devices. It fails to check whether dev is NULL, leading to a NULL dereference error. Fixes:bc66fa87d4
("net: phy: Add link between phy dev and mac dev") Signed-off-by: Colin Foster <colin.foster@in-advantage.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
6117929209
commit
73a8760222
1 changed files with 1 additions and 1 deletions
|
@ -1517,7 +1517,7 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
|
|||
* another mac interface, so we should create a device link between
|
||||
* phy dev and mac dev.
|
||||
*/
|
||||
if (phydev->mdio.bus->parent && dev->dev.parent != phydev->mdio.bus->parent)
|
||||
if (dev && phydev->mdio.bus->parent && dev->dev.parent != phydev->mdio.bus->parent)
|
||||
phydev->devlink = device_link_add(dev->dev.parent, &phydev->mdio.dev,
|
||||
DL_FLAG_PM_RUNTIME | DL_FLAG_STATELESS);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue