Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3718681imu; Tue, 18 Dec 2018 03:05:44 -0800 (PST) X-Google-Smtp-Source: AFSGD/X9UT44uKC+iB19JgX7x51/lDUy6uKVyCO+uKR24QeUm+vP7LwiCeDKcREZ22n0lrTg8Uee X-Received: by 2002:a17:902:bd0b:: with SMTP id p11mr16151595pls.259.1545131144388; Tue, 18 Dec 2018 03:05:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545131144; cv=none; d=google.com; s=arc-20160816; b=qTESUz40X6NbijpClEhsiMF/b/bxF2zdHNNDZ+nzgD79XxGyHUTbHlcppTSF4UvuRu 4W4JndnZJ1Y8ylKrl+iOuZVRYGE4F1U0tnwIGNPXT7hr/mg+4TBQsdO47SmEzPLymDRd XMCJn2/qG8Aa3ANTz6IWfJ2Nq3TZ1fl7snKZ/AqzAsRTN/ueULYSxhV43OHmDOf1fOFJ U+i59pQViSB7mY7L9MTbpscWNwAYFIJ0KZBNG3Da5aL4R6jfI8tjIwsr09TH4Eyu1Tav t8ro96wPS5da9Wkc2JN2a987b899xw385ybBjB1XeeFFajc/JH5QFSI3YLO4yG32UPvj A++g== 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=WKwnrsJPbdpyD0aJNXHeXPyjq2L7DWAjM37EJChooFw=; b=xF+hvzhEQxCPoNnlHOAzIkve904xrDYLQyK7thW/SZDGckyJQeCde5YMEVzylSzjBF CxJgFHTHAza1CsRb1BtKMdFKlCVNyt41POGZj7RhoTnXG3NhOkTkKoPevi8usRv3BufA ekbKHhxRkqtc/K7ZfqiTRNusDp9uVEYrAHkqCipopvBPXX9rQinjJHp6IUGI1imhx+BO PUJ0aKO+w7Rrr0u8+1+aOmVPXa77UK+6t4lC55aOgjyKAqwXXSHUx9Eqgn+pVo8jUUqt k3DJgGAsYA/DTKLRjSBkPlj8neSRjaMprm8UY0/78wbNnXxhNUnsCIYz2rex4q3JdEtf /Y0g== 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 x18si13203123pfm.39.2018.12.18.03.05.26; Tue, 18 Dec 2018 03:05:44 -0800 (PST) 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 S1726842AbeLRLC5 (ORCPT + 99 others); Tue, 18 Dec 2018 06:02:57 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:38231 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726589AbeLRLCJ (ORCPT ); Tue, 18 Dec 2018 06:02:09 -0500 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id F2DC128B437EB; Tue, 18 Dec 2018 19:02:03 +0800 (CST) Received: from linux-ioko.site (10.71.200.31) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.408.0; Tue, 18 Dec 2018 19:01:56 +0800 From: Peng Li To: CC: , , , , , Subject: [PATCH net-next 01/12] net: hns3: fix error handling int the hns3_get_vector_ring_chain Date: Tue, 18 Dec 2018 19:37:48 +0800 Message-ID: <1545133079-79605-2-git-send-email-lipeng321@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1545133079-79605-1-git-send-email-lipeng321@huawei.com> References: <1545133079-79605-1-git-send-email-lipeng321@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.71.200.31] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Huazhong Tan When hns3_get_vector_ring_chain() failed in the hns3_nic_init_vector_data(), it should do the error handling instead of return directly. Also, cur_chain should be freed instead of chain and head->next should be set to NULL in error handling of hns3_get_vector_ring_chain. This patch fixes them. Fixes: 73b907a083b8 ("net: hns3: bugfix for buffer not free problem during resetting") Signed-off-by: Huazhong Tan Signed-off-by: Peng Li --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 69142a3..2081e2e 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -2993,9 +2993,10 @@ static int hns3_get_vector_ring_chain(struct hns3_enet_tqp_vector *tqp_vector, cur_chain = head->next; while (cur_chain) { chain = cur_chain->next; - devm_kfree(&pdev->dev, chain); + devm_kfree(&pdev->dev, cur_chain); cur_chain = chain; } + head->next = NULL; return -ENOMEM; } @@ -3086,7 +3087,7 @@ static int hns3_nic_init_vector_data(struct hns3_nic_priv *priv) ret = hns3_get_vector_ring_chain(tqp_vector, &vector_ring_chain); if (ret) - return ret; + goto map_ring_fail; ret = h->ae_algo->ops->map_ring_to_vector(h, tqp_vector->vector_irq, &vector_ring_chain); -- 1.9.1