]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
net: hns3: add check for HNS3_NIC_STATE_INITED in hns3_reset_notify_up_enet()
authorJian Shen <shenjian15@huawei.com>
Thu, 29 Apr 2021 08:34:52 +0000 (16:34 +0800)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 18 Jun 2021 09:07:17 +0000 (11:07 +0200)
commit8d8054dd48f5eee5bba2870576bac289d7318d81
tree068e19b24e0eebaa5cd98b2012f983f0fcf1e129
parent4a5822a263d39c8eb6ad62e204297312b8f644eb
net: hns3: add check for HNS3_NIC_STATE_INITED in hns3_reset_notify_up_enet()

BugLink: https://bugs.launchpad.net/bugs/1931292
[ Upstream commit b4047aac4ec1066bab6c71950623746d7bcf7154 ]

In some cases, the device is not initialized because reset failed.
If another task calls hns3_reset_notify_up_enet() before reset
retry, it will cause an error since uninitialized pointer access.
So add check for HNS3_NIC_STATE_INITED before calling
hns3_nic_net_open() in hns3_reset_notify_up_enet().

Fixes: bb6b94a896d4 ("net: hns3: Add reset interface implementation in client")
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c