]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
net: hns3: Reset net device with rtnl_lock
authorHuazhong Tan <tanhuazhong@huawei.com>
Mon, 16 Jul 2018 15:36:20 +0000 (16:36 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Sep 2018 06:39:37 +0000 (08:39 +0200)
[ Upstream commit 6d4fab39533f1bcd933d82d1667ceea93e4de260 ]

Since current locking was not covering certain code where
netdev was being accessed or manipulated, this patch fixes
it.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c

index 6fd7ea8074b0c4b586a1c09d6c8ffd382d5eb8be..13f43b74fd6de33aed6abf35dd3e95b946ab313e 100644 (file)
@@ -2825,15 +2825,13 @@ static void hclge_clear_reset_cause(struct hclge_dev *hdev)
 static void hclge_reset(struct hclge_dev *hdev)
 {
        /* perform reset of the stack & ae device for a client */
-
+       rtnl_lock();
        hclge_notify_client(hdev, HNAE3_DOWN_CLIENT);
 
        if (!hclge_reset_wait(hdev)) {
-               rtnl_lock();
                hclge_notify_client(hdev, HNAE3_UNINIT_CLIENT);
                hclge_reset_ae_dev(hdev->ae_dev);
                hclge_notify_client(hdev, HNAE3_INIT_CLIENT);
-               rtnl_unlock();
 
                hclge_clear_reset_cause(hdev);
        } else {
@@ -2843,6 +2841,7 @@ static void hclge_reset(struct hclge_dev *hdev)
        }
 
        hclge_notify_client(hdev, HNAE3_UP_CLIENT);
+       rtnl_unlock();
 }
 
 static void hclge_reset_event(struct hnae3_handle *handle)