Commit e6cd4562 authored by Heiner Kallweit's avatar Heiner Kallweit Committed by Yang Yingliang
Browse files

net: linkwatch: add check for netdevice being present to linkwatch_do_dev

mainline inclusion
from mainline-v5.1-rc1
commit 124eee3f
category: bugfix
bugzilla: NA
CVE: NA

------------------------------------------------------

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: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Tested-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Reviewed-by: default avatarWeiwei Deng <dengweiwei@huawei.com>
Reviewed-by: default avatarZhaohui Zhong <zhongzhaohui@huawei.com>
Reviewed-by: default avatarYonglong Liu <liuyonglong@huawei.com>
Signed-off-by: default avatarYou Shengzui <youshengzui@huawei.com>
Reviewed-by: default avatarYueHaibing <yuehaibing@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parent 2f554490
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment