On Mon, 16 Nov 2026 06:58:43 -0000
"Renyong Wan" <[email protected]> wrote:
> v2 addresses the issues raised in the AI review of v1:
> - allocate the jumbo buffer once per device, fail the queue setup when
> there is no IOVA, and free it on device close
> - fix the leak in xsc_dev_init() and the unchecked rte_malloc_socket()
> - rename the jumbo buffer fields, they held the opposite of what their
> names say
>
> Renyong Wan (3):
> net/xsc: fix jumbo buffer allocation and leak
> net/xsc: fix leak and missing null check
> net/xsc: rename jumbo buffer fields
>
> drivers/net/xsc/xsc_dev.c | 2 ++
> drivers/net/xsc/xsc_dev.h | 4 +--
> drivers/net/xsc/xsc_ethdev.c | 6 ++++
> drivers/net/xsc/xsc_rx.c | 53 ++++++++++++++++++++----------------
> 4 files changed, 39 insertions(+), 26 deletions(-)
Still has one AI reported error.
Subject: Re: [PATCH v2 1/3] net/xsc: fix jumbo buffer allocation and leak
Series applies to main and each commit builds with -Dwerror=true.
The allocation rework in 1/3 and the rename in 3/3 look right.
Patches 2/3 and 3/3 have no findings.
[PATCH v2 1/3] net/xsc: fix jumbo buffer allocation and leak
Error: the leak is not fixed. xsc_dev_uninit() is only called from
the probe error path in xsc_ethdev_init(), where the jumbo buffer
can never have been allocated (rte_zmalloc'd xdev, port never
started). The normal remove path is xsc_ethdev_uninit(), which does
not call xsc_dev_uninit(); it frees xdev directly:
ret |= xsc_ethdev_close(eth_dev);
xsc_dev_pct_uninit(priv->xdev);
rte_free(priv->xdev);
So the buffer still leaks on every device removal. Free it there as
well (with 3/3 applied, jumbo_buf):
ret |= xsc_ethdev_close(eth_dev);
xsc_dev_pct_uninit(priv->xdev);
rte_free(priv->xdev->jumbo_buffer_pa);
rte_free(priv->xdev);
Calling xsc_dev_uninit() from xsc_ethdev_uninit() instead would run
xsc_dev_close() a second time, so the direct free is the simpler
fix. Keeping the rte_free() in xsc_dev_uninit() is harmless.
Update the commit message accordingly; "free it in xsc_dev_uninit()"
describes the path that does not run on close or removal.