diff --git a/net/ethtool/netlink.h b/net/ethtool/netlink.h index 81b8fa020bcb..6c128268b290 100644 --- a/net/ethtool/netlink.h +++ b/net/ethtool/netlink.h @@ -246,6 +246,9 @@ struct ethnl_reply_data { static inline int ethnl_ops_begin(struct net_device *dev) { + if (dev && dev->reg_state == NETREG_UNREGISTERING) + return -ENODEV; + if (dev && dev->ethtool_ops->begin) return dev->ethtool_ops->begin(dev); else