]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
net: hns3: prevent change MTU when resetting
authorHuazhong Tan <tanhuazhong@huawei.com>
Thu, 4 Apr 2019 08:17:57 +0000 (16:17 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 4 Apr 2019 17:20:39 +0000 (10:20 -0700)
When resetting, the changing of MTU is not allowed, so this patch
adds checking reset status in hns3_nic_change_mtu() to do that.

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>
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c

index 476c23dc2c2e348d5f8b67d6fc92ef864fa706a9..0e31f740f1db7713ca1d789c985f3b3769b08e7d 100644 (file)
@@ -1591,6 +1591,9 @@ static int hns3_nic_change_mtu(struct net_device *netdev, int new_mtu)
        struct hnae3_handle *h = hns3_get_handle(netdev);
        int ret;
 
+       if (hns3_nic_resetting(netdev))
+               return -EBUSY;
+
        if (!h->ae_algo->ops->set_mtu)
                return -EOPNOTSUPP;