Commit b71be352 authored by Andrew Lunn's avatar Andrew Lunn Committed by David S. Miller

dsa: slave: Don't reference NULL pointer during phy_disconnect

When the phy is disconnected, the parent pointer to the netdev it was
attached to is set to NULL. The code then tries to suspend the phy,
but dsa_slave_fixed_link_update needs the parent pointer to determine
which switch the phy is connected to. So it dereferenced a NULL
pointer. Check for this condition.
Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ca3dfa51
...@@ -896,11 +896,15 @@ static void dsa_slave_adjust_link(struct net_device *dev) ...@@ -896,11 +896,15 @@ static void dsa_slave_adjust_link(struct net_device *dev)
static int dsa_slave_fixed_link_update(struct net_device *dev, static int dsa_slave_fixed_link_update(struct net_device *dev,
struct fixed_phy_status *status) struct fixed_phy_status *status)
{ {
struct dsa_slave_priv *p = netdev_priv(dev); struct dsa_slave_priv *p;
struct dsa_switch *ds = p->parent; struct dsa_switch *ds;
if (ds->drv->fixed_link_update) if (dev) {
ds->drv->fixed_link_update(ds, p->port, status); p = netdev_priv(dev);
ds = p->parent;
if (ds->drv->fixed_link_update)
ds->drv->fixed_link_update(ds, p->port, status);
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment