patch 'mbuf: fix packet copy' has been queued to stable release 24.11.5
Kevin Traynor
ktraynor at redhat.com
Thu Feb 26 11:08:34 CET 2026
On 20/02/2026 14:56, luca.boccassi at gmail.com wrote:
> Hi,
>
> FYI, your patch has been queued to stable release 24.11.5
>
> Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
> It will be pushed if I get no objections before 02/22/26. So please
> shout if anyone has objections.
>
fyi Luca
https://inbox.dpdk.org/dev/20251119120403.907511-1-mb@smartsharesystems.com/T/#me51645cb6f8d3549ce9786ca5ddffee2d7d6a504
> Also note that after the patch there's a diff of the upstream commit vs the
> patch applied to the branch. This will indicate if there was any rebasing
> needed to apply to the stable branch. If there were code changes for rebasing
> (ie: not only metadata diffs), please double check that the rebase was
> correctly done.
>
> Queued patches are on a temporary branch at:
> https://github.com/bluca/dpdk-stable
>
> This queued commit can be viewed at:
> https://github.com/bluca/dpdk-stable/commit/b40186145941819b7ebb6360efe383433afde39b
>
> Thanks.
>
> Luca Boccassi
>
> ---
> From b40186145941819b7ebb6360efe383433afde39b Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Morten=20Br=C3=B8rup?= <mb at smartsharesystems.com>
> Date: Tue, 20 Jan 2026 07:24:14 +0000
> Subject: [PATCH] mbuf: fix packet copy
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> [ upstream commit 8a75c9af639b68a594d1f0e58b650c54974cf3db ]
>
> Requests for copying the at the end of a packet incorrectly returned NULL,
> as if copying past the end of a packet.
>
> When allocating the mbuf for the copy from a mempool using pinned external
> buffers, the external flag in this mbuf was not preserved.
>
> Fixes: c3a90c381daa ("mbuf: add a copy routine")
>
> Signed-off-by: Morten Brørup <mb at smartsharesystems.com>
> Acked-by: Konstantin Ananyev <konstantin.ananyev at huawei.com>
> ---
> app/test/test_mbuf.c | 20 ++++++++++++++++++++
> lib/mbuf/rte_mbuf.c | 10 +++++++---
> 2 files changed, 27 insertions(+), 3 deletions(-)
>
> diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c
> index 17be977f31..19b49cec12 100644
> --- a/app/test/test_mbuf.c
> +++ b/app/test/test_mbuf.c
> @@ -541,6 +541,26 @@ test_pktmbuf_copy(struct rte_mempool *pktmbuf_pool,
>
> rte_pktmbuf_free(copy2);
>
> + /* test offset copy at the end */
> + copy2 = rte_pktmbuf_copy(copy, pktmbuf_pool,
> + 2 * sizeof(uint32_t), UINT32_MAX);
> + if (copy2 == NULL)
> + GOTO_FAIL("cannot copy at the end of the copy\n");
> +
> + if (rte_pktmbuf_pkt_len(copy2) != 0)
> + GOTO_FAIL("copy at the end, length incorrect\n");
> +
> + if (rte_pktmbuf_data_len(copy2) != 0)
> + GOTO_FAIL("copy at the end, data length incorrect\n");
> +
> + rte_pktmbuf_free(copy2);
> +
> + /* test offset copy past the end */
> + copy2 = rte_pktmbuf_copy(copy, pktmbuf_pool,
> + 2 * sizeof(uint32_t) + 1, UINT32_MAX);
> + if (copy2 != NULL)
> + GOTO_FAIL("can copy past the end of the copy\n");
> +
> /* test truncation copy */
> copy2 = rte_pktmbuf_copy(copy, pktmbuf_pool,
> 0, sizeof(uint32_t));
> diff --git a/lib/mbuf/rte_mbuf.c b/lib/mbuf/rte_mbuf.c
> index 559d5ad8a7..d41d2bac3d 100644
> --- a/lib/mbuf/rte_mbuf.c
> +++ b/lib/mbuf/rte_mbuf.c
> @@ -599,7 +599,7 @@ rte_pktmbuf_copy(const struct rte_mbuf *m, struct rte_mempool *mp,
> __rte_mbuf_sanity_check(m, 1);
>
> /* check for request to copy at offset past end of mbuf */
> - if (unlikely(off >= m->pkt_len))
> + if (unlikely(off > m->pkt_len))
> return NULL;
>
> mc = rte_pktmbuf_alloc(mp);
> @@ -612,8 +612,12 @@ rte_pktmbuf_copy(const struct rte_mbuf *m, struct rte_mempool *mp,
>
> __rte_pktmbuf_copy_hdr(mc, m);
>
> - /* copied mbuf is not indirect or external */
> - mc->ol_flags = m->ol_flags & ~(RTE_MBUF_F_INDIRECT|RTE_MBUF_F_EXTERNAL);
> + /*
> + * copy flags except indirect and external,
> + * while preserving flags of newly allocated mbuf
> + * (specifically RTE_MBUF_F_EXTERNAL if using pinned external buffer)
> + */
> + mc->ol_flags |= m->ol_flags & ~(RTE_MBUF_F_INDIRECT | RTE_MBUF_F_EXTERNAL);
>
> prev = &mc->next;
> m_last = mc;
More information about the stable
mailing list