From patchwork Sun Jan 7 20:49:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zhang X-Patchwork-Id: 135773 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 619DA437D5; Sun, 7 Jan 2024 13:21:43 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 33828402B1; Sun, 7 Jan 2024 13:21:43 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by mails.dpdk.org (Postfix) with ESMTP id B317D40263; Sun, 7 Jan 2024 13:21:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1704630101; x=1736166101; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=hwjCxiTzivd9AFioBCd8LRfXTbOoPnsRd0oGDFB2/dQ=; b=boc32Fd3iuBhhkpLk3wncSpx1PJ6EY6mm5LBmaM+rPnvzxjIWmNmWfKg VlPknaj9xu0ziIUPNgLBpbMBjn2YlyKBPYPSKSoDbxpZFWDDoDXNJA67g 0C0v6IwJ+ohq4PHSH8NDCblUryUBRpHJRFZzb3CzWb9xbd2yOmEdzL9N7 edEa7zTddb3FULXIbIzd+F/eXCtbKR5SfCw/zXWYpf/AN2dvxm3JMAm3y ZYk3p8QAK4fWg2RmnqDS2HJqu8YkNslkK5VZ9r4vBScrQqnKMHTqY/7zI 5mhTOzYwssyLL+w7bOJs7SwUIDnRInj7NB4I/vp4mnz0Im/2eIPq+nuNu Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10945"; a="19229623" X-IronPort-AV: E=Sophos;i="6.04,338,1695711600"; d="scan'208";a="19229623" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jan 2024 04:21:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10945"; a="1028161083" X-IronPort-AV: E=Sophos;i="6.04,338,1695711600"; d="scan'208";a="1028161083" Received: from dpdk-qzhan15-test02.sh.intel.com ([10.67.119.16]) by fmsmga006.fm.intel.com with ESMTP; 07 Jan 2024 04:21:38 -0800 From: Qi Zhang To: qiming.yang@intel.com, wenjun1.wu@intel.com Cc: dev@dpdk.org, Qi Zhang , stable@dpdk.org Subject: [PATCH] net/ice: fix memory leak Date: Sun, 7 Jan 2024 15:49:14 -0500 Message-Id: <20240107204914.483140-1-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Free memory for AQ buffer at icd_move_recfg_lan_txq Free memory for profile list at ice_tm_conf_uninit Fixes: 8c481c3bb65b ("net/ice: support queue and queue group bandwidth limit") Cc: stable@dpdk.org Signed-off-by: Qi Zhang Acked-by: Wenjun Wu --- drivers/net/ice/ice_tm.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/ice/ice_tm.c b/drivers/net/ice/ice_tm.c index b570798f07..c00ecb6a97 100644 --- a/drivers/net/ice/ice_tm.c +++ b/drivers/net/ice/ice_tm.c @@ -59,8 +59,15 @@ void ice_tm_conf_uninit(struct rte_eth_dev *dev) { struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); + struct ice_tm_shaper_profile *shaper_profile; struct ice_tm_node *tm_node; + /* clear profile */ + while ((shaper_profile = TAILQ_FIRST(&pf->tm_conf.shaper_profile_list))) { + TAILQ_REMOVE(&pf->tm_conf.shaper_profile_list, shaper_profile, node); + rte_free(shaper_profile); + } + /* clear node configuration */ while ((tm_node = TAILQ_FIRST(&pf->tm_conf.queue_list))) { TAILQ_REMOVE(&pf->tm_conf.queue_list, tm_node, node); @@ -636,6 +643,8 @@ static int ice_move_recfg_lan_txq(struct rte_eth_dev *dev, uint16_t buf_size = ice_struct_size(buf, txqs, 1); buf = (struct ice_aqc_move_txqs_data *)ice_malloc(hw, sizeof(*buf)); + if (buf == NULL) + return -ENOMEM; queue_parent_node = queue_sched_node->parent; buf->src_teid = queue_parent_node->info.node_teid; @@ -647,6 +656,7 @@ static int ice_move_recfg_lan_txq(struct rte_eth_dev *dev, NULL, buf, buf_size, &txqs_moved, NULL); if (ret || txqs_moved == 0) { PMD_DRV_LOG(ERR, "move lan queue %u failed", queue_id); + rte_free(buf); return ICE_ERR_PARAM; } @@ -656,12 +666,14 @@ static int ice_move_recfg_lan_txq(struct rte_eth_dev *dev, } else { PMD_DRV_LOG(ERR, "invalid children number %d for queue %u", queue_parent_node->num_children, queue_id); + rte_free(buf); return ICE_ERR_PARAM; } dst_node->children[dst_node->num_children++] = queue_sched_node; queue_sched_node->parent = dst_node; ice_sched_query_elem(hw, queue_sched_node->info.node_teid, &queue_sched_node->info); + rte_free(buf); return ret; }