Skip to content
Snippets Groups Projects
Commit 22fff1d5 authored by Jian Shen's avatar Jian Shen Committed by Yang Yingliang
Browse files

net: hns3: add check for HNS3_NIC_STATE_INITED before net open


driver inclusion
category: bugfix
bugzilla: NA
CVE: NA

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

In a small chance, a VF reset failed, and the VF device was not
initialized. In the time window before it retry, if another task
calls hns3_reset_notify_up_enet(), it will access uninitialized
ring memory, and calltrace. So add check for HNS3_NIC_STATE_INITED
before calling hns3_nic_net_open() in hns3_reset_notify_up_enet().

Signed-off-by: default avatarJian Shen <shenjian15@huawei.com>
Signed-off-by: default avatarYonglong Liu <liuyonglong@huawei.com>
Reviewed-by: default avatarli yongxin <liyongxin1@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parent 4173565a
No related branches found
No related tags found
No related merge requests found
......@@ -4429,6 +4429,11 @@ static int hns3_reset_notify_up_enet(struct hnae3_handle *handle)
struct hns3_nic_priv *priv = netdev_priv(kinfo->netdev);
int ret = 0;
if (!test_bit(HNS3_NIC_STATE_INITED, &priv->state)) {
netdev_err(kinfo->netdev, "device is not initialized yet\n");
return -EFAULT;
}
clear_bit(HNS3_NIC_STATE_RESETTING, &priv->state);
if (netif_running(kinfo->netdev)) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment