summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHuazhong Tan2019-05-28 11:03:01 +0200
committerDavid S. Miller2019-05-29 02:39:01 +0200
commit0d2f68c7bcf4c7bbdd6f810f7b6e658f43d4461e (patch)
tree04c6ad8209faf8f7561b083293be2956e04d862f
parentnet: hns3: stop schedule reset service while unloading driver (diff)
downloadkernel-qcow2-linux-0d2f68c7bcf4c7bbdd6f810f7b6e658f43d4461e.tar.gz
kernel-qcow2-linux-0d2f68c7bcf4c7bbdd6f810f7b6e658f43d4461e.tar.xz
kernel-qcow2-linux-0d2f68c7bcf4c7bbdd6f810f7b6e658f43d4461e.zip
net: hns3: adjust hns3_uninit_phy()'s location in the hns3_client_uninit()
hns3_uninit_phy() should be called before checking HNS3_NIC_STATE_INITED flags, otherwise when this checking fails, there is nobody to call hns3_uninit_phy(). Fixes: c8a8045b2d0a ("net: hns3: Fix NULL deref when unloading driver") Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/hisilicon/hns3/hns3_enet.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index 5e12705bae34..f6dc3054bcd1 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -3901,6 +3901,8 @@ static void hns3_client_uninit(struct hnae3_handle *handle, bool reset)
hns3_client_stop(handle);
+ hns3_uninit_phy(netdev);
+
if (!test_and_clear_bit(HNS3_NIC_STATE_INITED, &priv->state)) {
netdev_warn(netdev, "already uninitialized\n");
goto out_netdev_free;
@@ -3910,8 +3912,6 @@ static void hns3_client_uninit(struct hnae3_handle *handle, bool reset)
hns3_force_clear_all_rx_ring(handle);
- hns3_uninit_phy(netdev);
-
hns3_nic_uninit_vector_data(priv);
ret = hns3_nic_dealloc_vector_data(priv);