From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 63FBB489EF for ; Mon, 27 Oct 2025 17:21:35 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5E95940655; Mon, 27 Oct 2025 17:21:35 +0100 (CET) Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) by mails.dpdk.org (Postfix) with ESMTP id 51F3D40662 for ; Mon, 27 Oct 2025 17:21:33 +0100 (CET) Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-474975af41dso33923065e9.2 for ; Mon, 27 Oct 2025 09:21:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761582093; x=1762186893; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AGqK8FpiHExM3ul1yj4cyjz2/ZeTVKakWIgsU0CekS4=; b=lkib2oEHoMKhv/7j6mVLfFtkA+hWWB1xPAWuwIcm6jZKPObAH0tHgk1tloXsDOraFL 6+Wl2g65sdn513DrqaH2aOuR6kkhp36mm35L90QEWCun/4ZvgcGrSYRrcaLjQehQqiAY rpGadwSdii2fWyGCNVgsiBMK5jZVmsny9i8dlYt2sjRhYLAIW1oTp4/cBtq6VM5k+o3b 7Vw1Q66S25te/s48XNQ7H5YA8ZLAKvWkXYvLmLlRJWO1YBW/QYhYSSCbtnw6ZOASeM8R nt3n19Y+Fdl2+oHpNKYg4puDHwb8Bp3PIrkLRQ6L06l4lMDkp5+B5tVK5m/y9NuUVpKf m3SQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761582093; x=1762186893; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AGqK8FpiHExM3ul1yj4cyjz2/ZeTVKakWIgsU0CekS4=; b=CqQm8Z0qk+NcGZFIlI1koFIl4ra4+BiytfjH38RjB2quoujcCtn8vExCMrjZq5Yx9t E99a6IjhKckm6bgrlCykNQx9we/pdXh81n3VqlF3kA+lkpbu0lrr3YMW/oKbGNGDk1By ZM9H4xb/E5I7e2OYoKIWWxnbHTPB9uh4pMChiisil9bHGKcye27SVr7bkNdkmGRDXTu/ F9x38C2xyFTl6y5lx+tYKRuzf2iQ/AN5U0wG48qcigGpcrbW7HuAIB8eAUgEPYL/rm+D Z05e9V77KfXzQSepYp5PmSoTERdTEy8t8QeHF8bH81Ug/BFolJ89x+NbNZjtgjeXnWh+ Xe0g== X-Forwarded-Encrypted: i=1; AJvYcCU+40zcVQjNFt1IcuGJhIDlbybAdlb2MbgtfxRg5YR711n7/CvZDnyxp1vC3TckRFE4sziQfGA=@dpdk.org X-Gm-Message-State: AOJu0YxXWNHyo/Uhtzo45iXj1Ty3xLscTqY+GVZvkRdO2P/wg2Qf8/+d IgiO9rWm5lmHhdcbCoZJRtG4T4XjHddnLyyBxLXSjy6SP6Mo+qezoxd7 X-Gm-Gg: ASbGncti1kcuEgoAFGOeZsi1ooyrQDVpueqehi+9IDuS1mEmWjg9Nd6FfEa8PBni7tQ RPaRmtRYzAyeIKcSIzdOjvblNJSXNFwTnjsNVpbowKLb8RDsKUCZ3zDl3I5BWvYvZ7/ml6Ta4it xySr7CH/25n+wAophZBXLMq1+hX0jRR2LroEBixWjxaEyX+7KmNWr0vgxIFqPdkcomT+8xRKQNJ IIevOOZuPyN9fymmipf6SaDBg7d1lCkv/e8ECNanPhtisdMdcBxrrmuapVfitlqF9daRM8e+Uz5 0ghEbvhfqiUfpm3J8tFZi3fGNuV/wrn3pmNTYpVuRNmjMLj+aJTcdYJOfAMwyyDGZywELkgykn3 +Px228pQ03zQk277nG+ZsoEjlMF0Se+XUd02XodT8UGg8o6iJdnTgDwCNAHK00HWWDRtEampA+2 U69IG63w== X-Google-Smtp-Source: AGHT+IEThdznyqfROFrFCi/XnUThejtS5x9hsqCtuFmR9SxBF6yA6K2k7LDjD79JL47NeVo2VijtSg== X-Received: by 2002:a05:600c:4446:b0:46e:4a30:2b0f with SMTP id 5b1f17b1804b1-47717e6ab4bmr2138545e9.29.1761582092820; Mon, 27 Oct 2025 09:21:32 -0700 (PDT) Received: from localhost ([2a01:4b00:d036:ae00:6fc5:c3bc:147e:832c]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-475ddccaaf5sm69856635e9.3.2025.10.27.09.21.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Oct 2025 09:21:32 -0700 (PDT) From: luca.boccassi@gmail.com To: Pandi Kumar Maharajan Cc: Anatoly Burakov , Bruce Richardson , dpdk stable Subject: patch 'net/ice/base: fix memory leak in recipe handling' has been queued to stable release 22.11.11 Date: Mon, 27 Oct 2025 16:19:05 +0000 Message-ID: <20251027162001.3710450-27-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251027162001.3710450-1-luca.boccassi@gmail.com> References: <20251027162001.3710450-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 22.11.11 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 10/29/25. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/a7ddf77e1a325caec25f01105343048f4b0afda4 Thanks. Luca Boccassi --- >From a7ddf77e1a325caec25f01105343048f4b0afda4 Mon Sep 17 00:00:00 2001 From: Pandi Kumar Maharajan Date: Tue, 2 Sep 2025 18:26:54 +0100 Subject: [PATCH] net/ice/base: fix memory leak in recipe handling [ upstream commit baf3de23be970346378d5159a81782bfb6eb927b ] Advanced filter operations (apply/remove GENEVE/VXLAN filters) trigger the call chain: ice_add_adv_rule()/ice_rem_adv_rule() -> ice_find_recp() -> ice_get_recp_frm_fw(). Each call to ice_get_recp_frm_fw() creates new linked list entries for SW recipe tracking without cleaning up previous entries for the same recipe ID. The linked list then continuously grows with each filter add/remove operation, leading to excessive heap usage over time. Fix the memory leak by adding logic to remove the duplicate entries before adding new ones for the same recipe ID. Fixes: fed0c5ca5f19 ("net/ice/base: support programming a new switch recipe") Signed-off-by: Pandi Kumar Maharajan Signed-off-by: Anatoly Burakov Acked-by: Bruce Richardson --- drivers/net/ice/base/ice_switch.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c index 0ab3abe276..f85f03fba1 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -2209,6 +2209,7 @@ ice_get_recp_frm_fw(struct ice_hw *hw, struct ice_sw_recipe *recps, u8 rid, bool *refresh_required) { ice_declare_bitmap(result_bm, ICE_MAX_FV_WORDS); + struct ice_recp_grp_entry *rg, *tmprg_entry; struct ice_aqc_recipe_data_elem *tmp; u16 num_recps = ICE_MAX_NUM_RECIPES; struct ice_prot_lkup_ext *lkup_exts; @@ -2250,6 +2251,15 @@ ice_get_recp_frm_fw(struct ice_hw *hw, struct ice_sw_recipe *recps, u8 rid, */ lkup_exts = &recps[rid].lkup_exts; + /* Remove duplicate entries */ + LIST_FOR_EACH_ENTRY_SAFE(rg, tmprg_entry, &recps[rid].rg_list, + ice_recp_grp_entry, l_entry) { + if (rg->rid == rid) { + LIST_DEL(&rg->l_entry); + ice_free(hw, rg); + } + } + for (sub_recps = 0; sub_recps < num_recps; sub_recps++) { struct ice_aqc_recipe_data_elem root_bufs = tmp[sub_recps]; struct ice_recp_grp_entry *rg_entry; -- 2.47.3 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-10-27 15:54:35.871149831 +0000 +++ 0027-net-ice-base-fix-memory-leak-in-recipe-handling.patch 2025-10-27 15:54:34.803949751 +0000 @@ -1 +1 @@ -From baf3de23be970346378d5159a81782bfb6eb927b Mon Sep 17 00:00:00 2001 +From a7ddf77e1a325caec25f01105343048f4b0afda4 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit baf3de23be970346378d5159a81782bfb6eb927b ] + @@ -18 +19,0 @@ -Cc: stable@dpdk.org @@ -24 +25 @@ - drivers/net/intel/ice/base/ice_switch.c | 10 ++++++++++ + drivers/net/ice/base/ice_switch.c | 10 ++++++++++ @@ -27,5 +28,5 @@ -diff --git a/drivers/net/intel/ice/base/ice_switch.c b/drivers/net/intel/ice/base/ice_switch.c -index f16bec044c..628473f100 100644 ---- a/drivers/net/intel/ice/base/ice_switch.c -+++ b/drivers/net/intel/ice/base/ice_switch.c -@@ -2435,6 +2435,7 @@ ice_get_recp_frm_fw(struct ice_hw *hw, struct ice_sw_recipe *recps, u8 rid, +diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c +index 0ab3abe276..f85f03fba1 100644 +--- a/drivers/net/ice/base/ice_switch.c ++++ b/drivers/net/ice/base/ice_switch.c +@@ -2209,6 +2209,7 @@ ice_get_recp_frm_fw(struct ice_hw *hw, struct ice_sw_recipe *recps, u8 rid, @@ -39 +40 @@ -@@ -2481,6 +2482,15 @@ ice_get_recp_frm_fw(struct ice_hw *hw, struct ice_sw_recipe *recps, u8 rid, +@@ -2250,6 +2251,15 @@ ice_get_recp_frm_fw(struct ice_hw *hw, struct ice_sw_recipe *recps, u8 rid,