Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9029949ybi; Tue, 23 Jul 2019 20:22:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqz/XHtIIh4nCKo2S5ift80NYfilusuzfomVuiPSKMJSmjMBFrNt+yS3jdsZ+RjcOoeQ1fpr X-Received: by 2002:a63:2f44:: with SMTP id v65mr77793102pgv.185.1563938560542; Tue, 23 Jul 2019 20:22:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563938560; cv=none; d=google.com; s=arc-20160816; b=xtdW7krp5WlaB6lh32jLweKKAqLr6JIHzs7WmA5BGCqGdvAO9LKveVWuiHaydHfJdO xUkb76I9QDOtaUzckbhBbMMD01joF0uaJGVpNU42TtDRAxqKxIe03bU9ms/Avg+d5h/f Yfp8zCTmgROjtAZK2DiDkCULqeRxiD0rGG0ySEsbKIPEvhSiS+PdlDi2cPBenbu/dNIn DUWBIBh/RTAnLGCbII2xahWogwMpft/a/hZnC4rHBMv0ywn872jPWP+FrMRyb6QbQJcV zVuv9fmujbMvWzaAg1jZcDLeF2CZ1AnZXvq4GEoyCfCUWo8XpF7vd2UUPwccxas2p/qE LkQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=/2UTz+39XRC1SI/Sk5Kxk9sXeTL7hFq2Z2PaNXnbkB4=; b=p7KwMKET66sd5e/Mnde2LqnOSdRJQ4r6hbwi2yY7kPuZze/Z4OzsLqzJ0N3urGCt91 61qVRQirt0cqNzMBkb4aOxYl6svkLGCkKCiS7ZhkLn5UTBEntuN8+05RdMJKnT//Pfkd D4bjDyBmiyc8w0LUotRaThZaQpVvigWVbdDIlzlX2qu1Nviyd1+3ZL5QKb2L/Chot5ps 4v7L92TTD48Ek7jezywNIsMLC428Y0A+mLc6vvIEuVFsGQJ7PtXA2QFlYyXpJcqSPJwp jHdUoHW/00cfjz5eIl26Ojy8Z18eIoTXK3uUnTmjNyhw3Hvi3Untxk+T0mbutlEzq/DM +AgA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v16si14938352pfe.39.2019.07.23.20.22.26; Tue, 23 Jul 2019 20:22:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726496AbfGXDVA (ORCPT + 99 others); Tue, 23 Jul 2019 23:21:00 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:50694 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726393AbfGXDU5 (ORCPT ); Tue, 23 Jul 2019 23:20:57 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 91B422355C8D7087AAEB; Wed, 24 Jul 2019 11:20:52 +0800 (CST) Received: from localhost.localdomain (10.67.212.132) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.439.0; Wed, 24 Jul 2019 11:20:42 +0800 From: Huazhong Tan To: CC: , , , , , Jian Shen , Huazhong Tan Subject: [PATCH net-next 01/11] net: hns3: add reset checking before set channels Date: Wed, 24 Jul 2019 11:18:37 +0800 Message-ID: <1563938327-9865-2-git-send-email-tanhuazhong@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1563938327-9865-1-git-send-email-tanhuazhong@huawei.com> References: <1563938327-9865-1-git-send-email-tanhuazhong@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.212.132] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jian Shen 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 --- 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