From: Rita Ruvinsky <rita.ruvinsky@weka.io>
To: dev@dpdk.org
Cc: longli@microsoft.com, weh@microsoft.com,
stephen@networkplumber.org, Rita Ruvinsky <rita.ruvinsky@weka.io>,
stable@dpdk.org
Subject: [PATCH v2 2/2] net/mana: fix double free of mbuf on Rx WQE post failure
Date: Thu, 6 Aug 2026 20:26:40 +0300 [thread overview]
Message-ID: <20260806172640.2456451-2-rita.ruvinsky@weka.io> (raw)
In-Reply-To: <20260806172640.2456451-1-rita.ruvinsky@weka.io>
mana_post_rx_wqe() frees the mbuf when mana_alloc_pmd_mr() fails, but
the caller already frees the un-posted range starting at that same
mbuf via rte_pktmbuf_free_bulk(&mbufs[i], batch_count - i), so the
mbuf is returned to the mempool twice and can be handed out to two
consumers at once.
The free was correct before the bulk allocation rework, when this
function allocated the mbuf itself. Now that the caller owns it, leave
the mbuf to the caller on every error path.
Fixes: eeb37809601b ("net/mana: use bulk mbuf allocation for Rx WQEs")
Cc: stable@dpdk.org
Signed-off-by: Rita Ruvinsky <rita.ruvinsky@weka.io>
Reviewed-by: Long Li <longli@microsoft.com>
---
v2:
- Rebased on main (no functional change to this patch).
- Added Reviewed-by from Long Li.
drivers/net/mana/rx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/mana/rx.c b/drivers/net/mana/rx.c
index aedb05d46f..274c6e88ce 100644
--- a/drivers/net/mana/rx.c
+++ b/drivers/net/mana/rx.c
@@ -73,10 +73,10 @@ mana_post_rx_wqe(struct mana_rxq *rxq, struct rte_mbuf *mbuf)
int ret;
struct mana_mr_cache *mr;
+ /* Don't free mbuf on error: the caller bulk-frees it from &mbufs[i]. */
mr = mana_alloc_pmd_mr(&rxq->mr_btree, priv, mbuf);
if (!mr) {
DP_LOG(ERR, "failed to register RX MR");
- rte_pktmbuf_free(mbuf);
return -ENOMEM;
}
--
2.43.0
next prev parent reply other threads:[~2026-08-07 13:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-06 17:26 [PATCH v2 1/2] net/mana: fix MR length truncation for chunks over 4GB Rita Ruvinsky
2026-08-06 17:26 ` Rita Ruvinsky [this message]
2026-08-11 3:57 ` 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=20260806172640.2456451-2-rita.ruvinsky@weka.io \
--to=rita.ruvinsky@weka.io \
--cc=dev@dpdk.org \
--cc=longli@microsoft.com \
--cc=stable@dpdk.org \
--cc=stephen@networkplumber.org \
--cc=weh@microsoft.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