Skip to content

Commit

Permalink
net: hns3: adjust hns3_uninit_phy()'s location in the hns3_client_uni…
Browse files Browse the repository at this point in the history
…nit()

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: c8a8045 ("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>
  • Loading branch information
Huazhong Tan authored and David S. Miller committed May 29, 2019
1 parent acfc3d5 commit 0d2f68c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit 0d2f68c

Please sign in to comment.