From: Ciara Loftus <ciara.loftus@intel.com>
To: dev@dpdk.org
Cc: Ciara Loftus <ciara.loftus@intel.com>, stable@dpdk.org
Subject: [PATCH 2/2] net/ice: fix shaper profile reference count tracking
Date: Fri, 1 May 2026 10:57:55 +0000 [thread overview]
Message-ID: <20260501105755.1136087-2-ciara.loftus@intel.com> (raw)
In-Reply-To: <20260501105755.1136087-1-ciara.loftus@intel.com>
Currently, when a TM node is added with a shaper profile assigned,
the profile's reference count is not incremented. Equally, when a node
is deleted, the count is not decremented. As a result, the guard that
blocks deletion of an in-use profile never triggers, allowing the profile
to be freed while nodes still hold a pointer to it.
Fix by maintaining the reference count correctly when nodes take or
release a shaper profile, so that deletion of an in-use profile is
properly rejected.
Fixes: 8c481c3bb65b ("net/ice: support queue and queue group bandwidth limit")
Cc: stable@dpdk.org
Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
---
drivers/net/intel/ice/ice_tm.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/net/intel/ice/ice_tm.c b/drivers/net/intel/ice/ice_tm.c
index 4dcfb15c27..d1f3d80ac7 100644
--- a/drivers/net/intel/ice/ice_tm.c
+++ b/drivers/net/intel/ice/ice_tm.c
@@ -456,6 +456,8 @@ ice_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id,
tm_node->parent = NULL;
tm_node->reference_count = 0;
tm_node->shaper_profile = shaper_profile;
+ if (shaper_profile != NULL)
+ shaper_profile->reference_count++;
tm_node->children = RTE_PTR_ADD(tm_node, sizeof(struct ice_tm_node));
tm_node->params = *params;
pf->tm_conf.root = tm_node;
@@ -518,6 +520,8 @@ ice_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id,
tm_node->parent = parent_node;
tm_node->level = level_id;
tm_node->shaper_profile = shaper_profile;
+ if (shaper_profile != NULL)
+ shaper_profile->reference_count++;
tm_node->children = RTE_PTR_ADD(tm_node, sizeof(struct ice_tm_node));
tm_node->parent->children[tm_node->parent->reference_count++] = tm_node;
tm_node->params = *params;
@@ -568,6 +572,8 @@ ice_tm_node_delete(struct rte_eth_dev *dev, uint32_t node_id,
/* root node */
if (tm_node->level == 0) {
+ if (tm_node->shaper_profile != NULL)
+ tm_node->shaper_profile->reference_count--;
rte_free(tm_node);
pf->tm_conf.root = NULL;
return 0;
@@ -582,6 +588,8 @@ ice_tm_node_delete(struct rte_eth_dev *dev, uint32_t node_id,
tm_node->parent->children[j] = tm_node->parent->children[j + 1];
tm_node->parent->reference_count--;
+ if (tm_node->shaper_profile != NULL)
+ tm_node->shaper_profile->reference_count--;
rte_free(tm_node);
return 0;
--
2.43.0
next prev parent reply other threads:[~2026-05-01 10:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-01 10:57 [PATCH 1/2] net/ice: properly handle TM hierarchy deletion Ciara Loftus
2026-05-01 10:57 ` Ciara Loftus [this message]
2026-05-06 15:40 ` [PATCH 2/2] net/ice: fix shaper profile reference count tracking Bruce Richardson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260501105755.1136087-2-ciara.loftus@intel.com \
--to=ciara.loftus@intel.com \
--cc=dev@dpdk.org \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox