Commit 92cb1b09 authored by Huazhong Tan's avatar Huazhong Tan Committed by Greg Kroah-Hartman

net: hns3: bugfix for rtnl_lock's range in the hclge_reset()

[ Upstream commit a963052e ]

Since hclge_reset_wait() is used to wait for the hardware to complete
the reset, it is not necessary to hold the rtnl_lock during
hclge_reset_wait(). So this patch releases the lock for the duration
of hclge_reset_wait().

Fixes: 6d4fab39 ("net: hns3: Reset net device with rtnl_lock")
Signed-off-by: default avatarHuazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 733edfd6
...@@ -2804,14 +2804,17 @@ static void hclge_reset(struct hclge_dev *hdev) ...@@ -2804,14 +2804,17 @@ static void hclge_reset(struct hclge_dev *hdev)
handle = &hdev->vport[0].nic; handle = &hdev->vport[0].nic;
rtnl_lock(); rtnl_lock();
hclge_notify_client(hdev, HNAE3_DOWN_CLIENT); hclge_notify_client(hdev, HNAE3_DOWN_CLIENT);
rtnl_unlock();
if (!hclge_reset_wait(hdev)) { if (!hclge_reset_wait(hdev)) {
rtnl_lock();
hclge_notify_client(hdev, HNAE3_UNINIT_CLIENT); hclge_notify_client(hdev, HNAE3_UNINIT_CLIENT);
hclge_reset_ae_dev(hdev->ae_dev); hclge_reset_ae_dev(hdev->ae_dev);
hclge_notify_client(hdev, HNAE3_INIT_CLIENT); hclge_notify_client(hdev, HNAE3_INIT_CLIENT);
hclge_clear_reset_cause(hdev); hclge_clear_reset_cause(hdev);
} else { } else {
rtnl_lock();
/* schedule again to check pending resets later */ /* schedule again to check pending resets later */
set_bit(hdev->reset_type, &hdev->reset_pending); set_bit(hdev->reset_type, &hdev->reset_pending);
hclge_reset_task_schedule(hdev); hclge_reset_task_schedule(hdev);
......
Markdown is supported
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