]> git.baikalelectronics.ru Git - 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)
committerDavid S. Miller <davem@davemloft.net>
Thu, 29 Apr 2021 22:41:43 +0000 (15:41 -0700)
commit3bbcbb4f5de136ff77dab77a3c7c0ceec93a7541
tree3a00a7cca5f853e58ed2ab64bbf1c8f334d02fa4
parent5c7b68c09331b8542a1f256128d46fcf4a38bcd9
net: hns3: add check for HNS3_NIC_STATE_INITED in hns3_reset_notify_up_enet()

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: 6beb7a136b6b ("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>
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c