
From: Jian Shen <shenjian15@huawei.com> 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: Jian Shen <shenjian15@huawei.com> Signed-off-by: Yonglong Liu <liuyonglong@huawei.com> Reviewed-by: li yongxin <liyongxin1@huawei.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 263cb76f7e3f9..212e1ceb15675 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -4426,6 +4426,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)) { -- 2.25.1