[PATCH v2] mbuf: fix mbuf operations history recording
Thomas Monjalon
thomas at monjalon.net
Mon Jun 1 15:31:22 CEST 2026
11/05/2026 15:39, Morten Brørup:
> This addresses two bugs in mbuf operations history recording.
>
> 1. With mbuf operations history recording enabled, when allocating mbufs
> from a mempool failed, the array of fetched mbuf pointers was not set, but
> it was dereferenced for mbuf operations history recording anyway, which
> would trigger a segmentation fault or cause undefined behavior.
>
> This was fixed by changing how the return value from the mempool
> allocation is checked, so the function returns early on failure, and only
> proceeds on success.
>
> 2. When allocating a bulk of mbufs using rte_pktmbuf_alloc_bulk(), two
> mbuf library allocation operations were recorded on the mbuf, because the
> function calls rte_mbuf_raw_alloc_bulk() for allocation, and both
> functions record a mbuf library allocation operation.
>
> This was fixed by not recording a mbuf library allocation operation in
> rte_pktmbuf_alloc_bulk().
>
> 3. When freeing a bulk of segmented mbufs, the free operations were only
> recorded on the first segments.
>
> This was fixed by freeing the pending bulks of segments using
> rte_mbuf_raw_free_bulk(), which records the free operation on the mbufs,
> instead of calling rte_mempool_put_bulk() directly.
> The bulk operation recording at the start of the function, which only
> affected the first segments of segmented packets, was removed.
>
> Fixes: d265a24a32a4 ("mbuf: record mbuf operations history")
> Cc: stable at dpdk.org
>
> Signed-off-by: Morten Brørup <mb at smartsharesystems.com>
> Acked-by: Thomas Monjalon <thomas at monjalon.net>
> Acked-by: Konstantin Ananyev <konstantin.ananyev at huawei.com>
Applied, thanks.
More information about the dev
mailing list