net: hns3: add reset checking before set channels

hns3_set_channels() should check the resetting status firstly,
since the device will reinitialize when resetting. If the
reset has not completed, the hns3_set_channels() may access
invalid memory.

Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Jian Shen 2019-07-29 10:53:22 +08:00 committed by David S. Miller
parent dda91bd7ab
commit 44950d28cc

View File

@ -4378,6 +4378,9 @@ int hns3_set_channels(struct net_device *netdev,
u16 org_tqp_num;
int ret;
if (hns3_nic_resetting(netdev))
return -EBUSY;
if (ch->rx_count || ch->tx_count)
return -EINVAL;