diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index e9ea0695efb42..173ea92124f8c 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c @@ -214,7 +214,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 53e2ef6ada8f3..1e9e70a633d1c 100644 --- a/net/ethtool/ioctl.c +++ b/net/ethtool/ioctl.c @@ -433,6 +433,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); }