From: Rita Ruvinsky <rita.ruvinsky@weka.io>
To: dev@dpdk.org
Cc: longli@microsoft.com, weh@microsoft.com,
Rita Ruvinsky <rita.ruvinsky@weka.io>,
stable@dpdk.org
Subject: [PATCH 2/2] net/mana: fix double free of mbuf on Rx WQE post failure
Date: Wed, 5 Aug 2026 18:44:07 +0300 [thread overview]
Message-ID: <20260805154407.1965063-2-rita.ruvinsky@weka.io> (raw)
In-Reply-To: <20260805154407.1965063-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>
---
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 f196d43aee..2bca004dfa 100644
--- a/drivers/net/mana/rx.c
+++ b/drivers/net/mana/rx.c
@@ -68,10 +68,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-06 13:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-05 15:44 [PATCH 1/2] net/mana: fix MR length truncation for chunks over 4GB Rita Ruvinsky
2026-08-05 15:44 ` Rita Ruvinsky [this message]
2026-08-06 0:31 ` [EXTERNAL] [PATCH 2/2] net/mana: fix double free of mbuf on Rx WQE post failure Long Li
2026-08-06 0:29 ` [EXTERNAL] [PATCH 1/2] net/mana: fix MR length truncation for chunks over 4GB Long Li
2026-08-06 17:02 ` 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=20260805154407.1965063-2-rita.ruvinsky@weka.io \
--to=rita.ruvinsky@weka.io \
--cc=dev@dpdk.org \
--cc=longli@microsoft.com \
--cc=stable@dpdk.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;
as well as URLs for NNTP newsgroup(s).