Re: [PATCH] perf iostat: Preserve the port count when growing the list fails

From: Namhyung Kim

Date: Mon Nov 09 2026 - 21:57:32 EST


On Fri, 06 Nov 2026 10:19:13 +0800, lirongqing wrote:

> The root port insertion helper increments nr_entries before reallocating
> its pointer array. If realloc() fails, both the scan and filter error
> paths free the list using the increased count, reading one pointer past
> the allocation. Failure of the first insertion instead dereferences a
> NULL array.
>
> Grow the array before changing the entry count or the port index so a
> failed insertion leaves the list valid for cleanup.
>
> [...]

Applied to perf-tools-next, thanks!

Best regards,
Namhyung