diff options
author | Heiner Kallweit <hkallweit1@gmail.com> | 2018-09-18 22:55:36 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-09-20 07:06:46 +0300 |
commit | 124eee3f6955f7aa19b9e6ff5c9b6d37cb3d1e2c (patch) | |
tree | fb42d27e933440f5295eaace7a973b3e830011d1 /net/core | |
parent | 822143acf94f647aba7ed2e20e0e629485c1e43d (diff) | |
download | linux-124eee3f6955f7aa19b9e6ff5c9b6d37cb3d1e2c.tar.xz |
net: linkwatch: add check for netdevice being present to linkwatch_do_dev
When bringing down the netdevice (incl. detaching it) and calling
netif_carrier_off directly or indirectly the latter triggers an
asynchronous linkwatch event.
This linkwatch event eventually may fail to access chip registers in
the ndo_get_stats/ndo_get_stats64 callback because the device isn't
accessible any longer, see call trace in [0].
To prevent this scenario don't check for IFF_UP only, but also make
sure that the netdevice is present.
[0] https://lists.openwall.net/netdev/2018/03/15/62
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/link_watch.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/core/link_watch.c b/net/core/link_watch.c index e38e641e98d5..7f51efb2b3ab 100644 --- a/net/core/link_watch.c +++ b/net/core/link_watch.c @@ -155,7 +155,7 @@ static void linkwatch_do_dev(struct net_device *dev) clear_bit(__LINK_STATE_LINKWATCH_PENDING, &dev->state); rfc2863_policy(dev); - if (dev->flags & IFF_UP) { + if (dev->flags & IFF_UP && netif_device_present(dev)) { if (netif_carrier_ok(dev)) dev_activate(dev); else |