net: dsa: Fix NULL checking in dsa_slave_set_eee()
Subsystems (4)
PATCH 1/1 net: dsa: Fix NULL checking in dsa_slave_set_eee()
This function can't succeed if dp->pl is NULL. It will Oops inside the call to return phylink_ethtool_get_eee(dp->pl, e);
Fixes 1be52e97ed3e ("dsa: slave: eee: Allow ports to use phylink")
Signed-off-by Dan Carpenter <[email protected]>
--- net/dsa/slave.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/dsa/slave.c +2 -2
@@ -639,7 +639,7 @@ static int dsa_slave_set_eee(struct net_device *dev, struct ethtool_eee *e)int ret;/* Port's PHY and MAC both need to be EEE capable */ -if (!dev->phydev && !dp->pl) +if (!dev->phydev || !dp->pl)return -ENODEV ;if (!ds->ops->set_mac_eee)
@@ -659,7 +659,7 @@ static int dsa_slave_get_eee(struct net_device *dev, struct ethtool_eee *e)int ret;/* Port's PHY and MAC both need to be EEE capable */ -if (!dev->phydev && !dp->pl) +if (!dev->phydev || !dp->pl)return -ENODEV ;if (!ds->ops->get_mac_eee)
Signature · 1 line
2.17.1
Quoted 5 lines · Dan Carpenter
This function can't succeed if
dp->plis NULL. It will Oops inside the call to returnphylink_ethtool_get_eee(dp->pl, e);Fixes 1be52e97ed3e ("dsa: slave: eee: Allow ports to use phylink")Signed-off-by Dan Carpenter <[email protected]>
Reviewed-by Florian Fainelli <[email protected]>
thanks Dan!
Signature · 1 line
Florian
Quoted 5 lines · Dan Carpenter
This function can't succeed if
dp->plis NULL. It will Oops inside the call to returnphylink_ethtool_get_eee(dp->pl, e);Fixes 1be52e97ed3e ("dsa: slave: eee: Allow ports to use phylink")Signed-off-by Dan Carpenter <[email protected]>
Reviewed-by Vivien Didelot <[email protected]>
David Miller
maintainerFrom: Dan Carpenter <[email protected]>
Date: Wed, 6 Feb 2019 18:35:15 +0300
Quoted 5 lines
This function can't succeed if
dp->plis NULL. It will Oops inside the call to returnphylink_ethtool_get_eee(dp->pl, e);Fixes 1be52e97ed3e ("dsa: slave: eee: Allow ports to use phylink")Signed-off-by Dan Carpenter <[email protected]>
Applied and queued up for -stable.