Skip to content

Commit f5cd601

Browse files
Hao Chendavem330
authored andcommitted
net: hns3: add netdev reset check for hns3_set_tunable()
When pci device reset failed, it does uninit operation and priv->ring is NULL, it causes accessing NULL pointer error. Add netdev reset check for hns3_set_tunable() to fix it. Fixes: 99f6b5f ("net: hns3: use bounce buffer when rx page can not be reused") Signed-off-by: Hao Chen <chenhao288@hisilicon.com> Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 671cb8c commit f5cd601

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1766,9 +1766,6 @@ static int hns3_set_tx_spare_buf_size(struct net_device *netdev,
17661766
struct hnae3_handle *h = priv->ae_handle;
17671767
int ret;
17681768

1769-
if (hns3_nic_resetting(netdev))
1770-
return -EBUSY;
1771-
17721769
h->kinfo.tx_spare_buf_size = data;
17731770

17741771
ret = hns3_reset_notify(h, HNAE3_DOWN_CLIENT);
@@ -1799,6 +1796,11 @@ static int hns3_set_tunable(struct net_device *netdev,
17991796
struct hnae3_handle *h = priv->ae_handle;
18001797
int i, ret = 0;
18011798

1799+
if (hns3_nic_resetting(netdev) || !priv->ring) {
1800+
netdev_err(netdev, "failed to set tunable value, dev resetting!");
1801+
return -EBUSY;
1802+
}
1803+
18021804
switch (tuna->id) {
18031805
case ETHTOOL_TX_COPYBREAK:
18041806
priv->tx_copybreak = *(u32 *)data;

0 commit comments

Comments
 (0)