]> git.baikalelectronics.ru Git - kernel.git/commit
net: linkwatch: add check for netdevice being present to linkwatch_do_dev
authorHeiner Kallweit <hkallweit1@gmail.com>
Tue, 18 Sep 2018 19:55:36 +0000 (21:55 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 20 Sep 2018 04:06:46 +0000 (21:06 -0700)
commit9ec935fb6517e6a7a9570e17913de3dfd5fd8e3d
treefb42d27e933440f5295eaace7a973b3e830011d1
parent558182fcd2e4785b1b0886a89cf3380f73e7f8a3
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>
net/core/link_watch.c