Re: [PATCH 1/6] powerpc/spufs: fix spu_context leak in coredump
From: Arnd Bergmann
Date: Mon Aug 03 2026 - 05:12:49 EST
On Sun, Aug 2, 2026, at 17:51, Junrui Luo via B4 Relay wrote:
> From: Junrui Luo <moonafterrain@xxxxxxxxxxx>
>
> coredump_next_context() returns a spu_context with a reference taken by
> get_spu_context(), which the caller must drop.
> spufs_coredump_extra_notes_size() does so on all of its exits, but
> spufs_coredump_extra_notes_write() never calls put_spu_context(), so
> every context dumped through elf_coredump_extra_notes_write() leaks a
> reference, including on the success path.
>
> Fix by dropping the reference on each of the three exits of the loop,
> mirroring ..._size().
>
> Fixes: 38b407be172d ("powerpc/spufs: Rework fcheck() usage")
> Reported-by: Yuhao Jiang <danisjiang@xxxxxxxxx>
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Junrui Luo <moonafterrain@xxxxxxxxxxx>
Reviewed-by: Arnd Bergmann <arnd@xxxxxxxx>