Skip to content

Commit

Permalink
pasemi_mac: ethtool get settings fix
Browse files Browse the repository at this point in the history
Not all pasemi mac interfaces can have a phy attached.
For example, XAUI has no phy and phydev is NULL for it.
In this case ethtool get settings causes kernel crash.
Fix it by returning -EOPNOTSUPP if there's no PHY attached.

Signed-off-by: Valentine Barshak <vbarshak@ru.mvista.com>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Valentine Barshak authored and David S. Miller committed Oct 7, 2009
1 parent 6e43650 commit 4968286
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/net/pasemi_mac_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ pasemi_mac_ethtool_get_settings(struct net_device *netdev,
struct pasemi_mac *mac = netdev_priv(netdev);
struct phy_device *phydev = mac->phydev;

if (!phydev)
return -EOPNOTSUPP;

return phy_ethtool_gset(phydev, cmd);
}

Expand Down

0 comments on commit 4968286

Please sign in to comment.