From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
stable@dpdk.org,
Konstantin Ananyev <konstantin.ananyev@huawei.com>,
Allain Legacy <allain.legacy@windriver.com>
Subject: [PATCH 1/2] ip_frag: fix unsafe TAILQ usage
Date: Wed, 8 Apr 2026 09:16:16 -0700 [thread overview]
Message-ID: <20260408161947.285185-2-stephen@networkplumber.org> (raw)
In-Reply-To: <20260408161947.285185-1-stephen@networkplumber.org>
The frag table next pointer was being access after TAILQ_REMOVE().
This is not safe since it depends on TAILQ_REMOVE() not changing
next pointer. Fix by using RTE_TAILQ_FOREACH_SAFE().
Fixes: 95908f52393d ("ip_frag: free mbufs on reassembly table destroy")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/ip_frag/ip_frag_common.h | 1 +
lib/ip_frag/rte_ip_frag_common.c | 20 ++++++++++----------
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/lib/ip_frag/ip_frag_common.h b/lib/ip_frag/ip_frag_common.h
index 51fc9d47fb..34be5bb6ab 100644
--- a/lib/ip_frag/ip_frag_common.h
+++ b/lib/ip_frag/ip_frag_common.h
@@ -8,6 +8,7 @@
#include <sys/queue.h>
#include <rte_common.h>
+#include <rte_tailq.h>
#if defined(RTE_ARCH_ARM64)
#include <rte_cmp_arm64.h>
diff --git a/lib/ip_frag/rte_ip_frag_common.c b/lib/ip_frag/rte_ip_frag_common.c
index ee9aa93027..79ac45289b 100644
--- a/lib/ip_frag/rte_ip_frag_common.c
+++ b/lib/ip_frag/rte_ip_frag_common.c
@@ -135,18 +135,18 @@ rte_ip_frag_table_del_expired_entries(struct rte_ip_frag_tbl *tbl,
struct rte_ip_frag_death_row *dr, uint64_t tms)
{
uint64_t max_cycles;
- struct ip_frag_pkt *fp;
+ struct ip_frag_pkt *fp, *tmp;
max_cycles = tbl->max_cycles;
- TAILQ_FOREACH(fp, &tbl->lru, lru)
- if (max_cycles + fp->start < tms) {
- /* check that death row has enough space */
- if (RTE_IP_FRAG_DEATH_ROW_MBUF_LEN - dr->cnt >=
- fp->last_idx)
- ip_frag_tbl_del(tbl, dr, fp);
- else
- return;
- } else
+ RTE_TAILQ_FOREACH_SAFE(fp, &tbl->lru, lru, tmp) {
+ if (max_cycles + fp->start >= tms)
+ return;
+
+ /* check that death row has enough space */
+ if (RTE_IP_FRAG_DEATH_ROW_MBUF_LEN - dr->cnt < fp->last_idx)
return;
+
+ ip_frag_tbl_del(tbl, dr, fp);
+ }
}
--
2.53.0
next prev parent reply other threads:[~2026-04-08 16:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-08 16:16 [PATCH 0/2] ip_frag: TAILQ and hash fixes Stephen Hemminger
2026-04-08 16:16 ` Stephen Hemminger [this message]
2026-04-08 16:16 ` [PATCH 2/2] ip_frag: randomize hash seed Stephen Hemminger
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=20260408161947.285185-2-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=allain.legacy@windriver.com \
--cc=dev@dpdk.org \
--cc=konstantin.ananyev@huawei.com \
--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