diff options
author | Andrew Lunn <andrew@lunn.ch> | 2016-03-12 00:01:37 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-03-14 20:43:10 +0100 |
commit | b71be352f76ac3c0559feec2fd960ab9c31404c9 (patch) | |
tree | 4f49a80ac245645735c74989efe5d233a8697968 /net/dsa | |
parent | dsa: Rename mv88e6123_61_65 to mv88e6123 to be consistent (diff) | |
download | linux-b71be352f76ac3c0559feec2fd960ab9c31404c9.tar.xz linux-b71be352f76ac3c0559feec2fd960ab9c31404c9.zip |
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: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa')
-rw-r--r-- | net/dsa/slave.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 27bf03d11670..49056d90b179 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -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, struct fixed_phy_status *status) { - struct dsa_slave_priv *p = netdev_priv(dev); - struct dsa_switch *ds = p->parent; + struct dsa_slave_priv *p; + struct dsa_switch *ds; - if (ds->drv->fixed_link_update) - ds->drv->fixed_link_update(ds, p->port, status); + if (dev) { + p = netdev_priv(dev); + ds = p->parent; + if (ds->drv->fixed_link_update) + ds->drv->fixed_link_update(ds, p->port, status); + } return 0; } |