diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index fdf3308b0335..8a06f97320e0 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c @@ -215,7 +215,7 @@ static ssize_t speed_show(struct device *dev, if (!rtnl_trylock()) return restart_syscall(); - if (netif_running(netdev) && netif_device_present(netdev)) { + if (netif_running(netdev)) { struct ethtool_link_ksettings cmd; if (!__ethtool_get_link_ksettings(netdev, &cmd)) diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c index e31d1247b9f0..442c4c343e15 100644 --- a/net/ethtool/ioctl.c +++ b/net/ethtool/ioctl.c @@ -445,6 +445,9 @@ int __ethtool_get_link_ksettings(struct net_device *dev, if (!dev->ethtool_ops->get_link_ksettings) return -EOPNOTSUPP; + if (!netif_device_present(dev)) + return -ENODEV; + memset(link_ksettings, 0, sizeof(*link_ksettings)); return dev->ethtool_ops->get_link_ksettings(dev, link_ksettings); }