From 6ff7ed8049ebf932643eee8680bb1d75691fa801 Mon Sep 17 00:00:00 2001 From: Huazhong Tan Date: Thu, 4 Apr 2019 16:17:57 +0800 Subject: [PATCH] net: hns3: prevent change MTU when resetting 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 Signed-off-by: Peng Li Signed-off-by: David S. Miller --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 476c23dc2c2e..0e31f740f1db 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -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; -- 2.34.1