From: Zhang Tengfei <zhtfdev@gmail.com>
To: Jiawen Wu <jiawenwu@trustnetic.com>,
Zaiyu Wang <zaiyuwang@trustnetic.com>
Cc: dev@dpdk.org, Stephen Hemminger <stephen@networkplumber.org>,
Zhang Tengfei <zhtfdev@gmail.com>,
stable@dpdk.org
Subject: [PATCH] net/txgbe: fix use-after-free in flow destroy
Date: Thu, 10 Sep 2026 21:39:41 +0800 [thread overview]
Message-ID: <20260910133941.77565-1-zhtfdev@gmail.com> (raw)
TAILQ_FOREACH advances via the current node's next pointer. Removing
and freeing that node inside the loop reads freed memory on the next
iteration.
Find the matching entry first, then remove it after the loop.
Fixes: e342da2d438f ("net/txgbe: support destroying consistent filter")
Cc: stable@dpdk.org
Signed-off-by: Zhang Tengfei <zhtfdev@gmail.com>
---
drivers/net/txgbe/txgbe_flow.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/net/txgbe/txgbe_flow.c b/drivers/net/txgbe/txgbe_flow.c
index 1bb0d3978c..eaeb973c91 100644
--- a/drivers/net/txgbe/txgbe_flow.c
+++ b/drivers/net/txgbe/txgbe_flow.c
@@ -3667,11 +3667,13 @@ txgbe_flow_destroy(struct rte_eth_dev *dev,
}
TAILQ_FOREACH(txgbe_flow_mem_ptr, &txgbe_flow_list, entries) {
- if (txgbe_flow_mem_ptr->flow == pmd_flow) {
- TAILQ_REMOVE(&txgbe_flow_list,
- txgbe_flow_mem_ptr, entries);
- rte_free(txgbe_flow_mem_ptr);
- }
+ if (txgbe_flow_mem_ptr->flow == pmd_flow)
+ break;
+ }
+ if (txgbe_flow_mem_ptr != NULL) {
+ TAILQ_REMOVE(&txgbe_flow_list,
+ txgbe_flow_mem_ptr, entries);
+ rte_free(txgbe_flow_mem_ptr);
}
rte_free(flow);
--
2.55.0
next reply other threads:[~2026-09-10 13:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-10 13:39 Zhang Tengfei [this message]
2026-09-10 15:53 ` [PATCH] net/txgbe: fix use-after-free in flow destroy Stephen Hemminger
2026-09-10 16:15 ` dev zhang
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=20260910133941.77565-1-zhtfdev@gmail.com \
--to=zhtfdev@gmail.com \
--cc=dev@dpdk.org \
--cc=jiawenwu@trustnetic.com \
--cc=stable@dpdk.org \
--cc=stephen@networkplumber.org \
--cc=zaiyuwang@trustnetic.com \
/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