[PATCH 08/15] net/dpaa2: fix buffer free on transmit SG packets

Ferruh Yigit ferruh.yigit at amd.com
Thu Oct 6 09:48:22 CEST 2022


On 9/28/2022 6:25 AM, Gagandeep Singh wrote:
> When using SG list to TX with external and direct buffers,
> HW free the direct buffers and driver free the external buffers.
> 
> Software scans the complete SG mbuf list to find the external
> buffers to free, but this is wrong as hardware can free the
> direct buffers if any present in the list and same can be
> re-allocated for other purpose in multi thread or high spead

s/spead/speed/

> running traffic environment with new data in it. So the software
> which is scanning the SG mbuf list, if that list has any direct
> buffer present then that direct buffer's next pointor can give

s/pointor/pointer/

> wrong pointer value, if already freed by hardware which
> can do the mempool corruption or memory leak.
> 
> In this patch instead of relying on user given SG mbuf list
> we are storing the buffers in an internal list which will
> be scanned by driver after transmit to free non-direct
> buffers.
> 
> This patch also fixes 2 more memory leak issues.
> 
> Driver is freeing complete SG list by checking external buffer
> flag in first segment only, but external buffer can be attached
> to any of the segment. Because of which driver either can double
> free buffers or there can be memory leak.
> 
> In case of indirect buffers, driver is modifying the original
> buffer list to free the indirect buffers but this orginal buffer

s/orginal/original/

same fixes needed for dpaa version of this patch, 14/15.

> list is being used even after transmit packets for software
> buffer cleanup. This can cause the buffer leak issue.
> 
> Fixes: 6bfbafe18d15 ("net/dpaa2: support external buffers in Tx")
> Cc: stable at dpdk.org
> 
> Signed-off-by: Gagandeep Singh <g.singh at nxp.com>

<...>



More information about the stable mailing list