From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 601C8A052B; Tue, 28 Jul 2020 15:11:33 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3D9C21C00E; Tue, 28 Jul 2020 15:11:33 +0200 (CEST) Received: from huawei.com (szxga05-in.huawei.com [45.249.212.191]) by dpdk.org (Postfix) with ESMTP id 056531C00D; Tue, 28 Jul 2020 15:11:31 +0200 (CEST) Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 1191393690DB0E73F2E4; Tue, 28 Jul 2020 21:11:29 +0800 (CST) Received: from localhost (10.174.185.168) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.487.0; Tue, 28 Jul 2020 21:11:18 +0800 From: wangyunjian To: CC: , , , , Yunjian Wang , Date: Tue, 28 Jul 2020 21:11:12 +0800 Message-ID: <9b51e0a97aa6be6c9e64ed4f1e7cc1a2f0553f4d.1595936682.git.wangyunjian@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.185.168] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH 1/2] net/ice: fix memory leak when releasing vsi X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Yunjian Wang At the end of the vsi release, we should free the 'rss_lut' and 'rss_key' for the vsi. Fixes: 50370662b727 ("net/ice: support device and queue ops") Cc: stable@dpdk.org Signed-off-by: Yunjian Wang --- drivers/net/ice/ice_ethdev.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 3534d18ca..5f3882826 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -2280,9 +2280,10 @@ ice_release_vsi(struct ice_vsi *vsi) struct ice_hw *hw; struct ice_vsi_ctx vsi_ctx; enum ice_status ret; + int error = 0; if (!vsi) - return 0; + return error; hw = ICE_VSI_TO_HW(vsi); @@ -2295,12 +2296,13 @@ ice_release_vsi(struct ice_vsi *vsi) ret = ice_free_vsi(hw, vsi->idx, &vsi_ctx, false, NULL); if (ret != ICE_SUCCESS) { PMD_INIT_LOG(ERR, "Failed to free vsi by aq, %u", vsi->vsi_id); - rte_free(vsi); - return -1; + error = -1; } + rte_free(vsi->rss_lut); + rte_free(vsi->rss_key); rte_free(vsi); - return 0; + return error; } void -- 2.23.0