From: Jian Shen Date: Mon, 29 Jul 2019 02:53:22 +0000 (+0800) Subject: net: hns3: add reset checking before set channels X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=44950d28cccf3049696e02d0adebb10e112cee24;p=openwrt%2Fstaging%2Fblogic.git 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 Signed-off-by: Huazhong Tan Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 69f7ef810654..08af782f70b5 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -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;