Netdev List
 help / color / mirror / Atom feed
From: Huazhong Tan <tanhuazhong@huawei.com>
To: <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<salil.mehta@huawei.com>, <yisen.zhuang@huawei.com>,
	<linuxarm@huawei.com>, <saeedm@mellanox.com>,
	Jian Shen <shenjian15@huawei.com>,
	Huazhong Tan <tanhuazhong@huawei.com>
Subject: [PATCH V3 net-next 01/10] net: hns3: add reset checking before set channels
Date: Sat, 27 Jul 2019 13:46:03 +0800	[thread overview]
Message-ID: <1564206372-42467-2-git-send-email-tanhuazhong@huawei.com> (raw)
In-Reply-To: <1564206372-42467-1-git-send-email-tanhuazhong@huawei.com>

From: Jian Shen <shenjian15@huawei.com>

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>
---
 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 69f7ef8..08af782 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;
 
-- 
2.7.4


  reply	other threads:[~2019-07-27  5:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-27  5:46 [PATCH V3 net-next 00/10] net: hns3: some code optimizations & bugfixes & features Huazhong Tan
2019-07-27  5:46 ` Huazhong Tan [this message]
2019-07-27  5:46 ` [PATCH V3 net-next 02/10] net: hns3: add a check for get_reset_level Huazhong Tan
2019-07-27  5:46 ` [PATCH V3 net-next 03/10] net: hns3: remove upgrade reset level when reset fail Huazhong Tan
2019-07-27  5:46 ` [PATCH V3 net-next 04/10] net: hns3: change GFP flag during lock period Huazhong Tan
2019-07-27  5:46 ` [PATCH V3 net-next 05/10] net: hns3: modify firmware version display format Huazhong Tan
2019-07-27  5:46 ` [PATCH V3 net-next 06/10] net: hns3: add debug messages to identify eth down cause Huazhong Tan
2019-07-28  2:03   ` David Miller
2019-07-29  1:21     ` tanhuazhong
2019-07-27  5:46 ` [PATCH V3 net-next 07/10] net: hns3: make hclge_service use delayed workqueue Huazhong Tan
2019-07-27  5:46 ` [PATCH V3 net-next 08/10] net: hns3: add interrupt affinity support for misc interrupt Huazhong Tan
2019-07-27  5:46 ` [PATCH V3 net-next 09/10] net: hns3: Add support for using order 1 pages with a 4K buffer Huazhong Tan
2019-07-27  5:46 ` [PATCH V3 net-next 10/10] net: hns3: use dev_info() instead of pr_info() Huazhong Tan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1564206372-42467-2-git-send-email-tanhuazhong@huawei.com \
    --to=tanhuazhong@huawei.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@mellanox.com \
    --cc=salil.mehta@huawei.com \
    --cc=shenjian15@huawei.com \
    --cc=yisen.zhuang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox