Re: [PATCH] livepatch/klp-build: Fix wrong index in error cleanup loop

Miroslav Benes <[email protected]> Wed, 1 Jul 2026 13:16:09 +0200 (CEST)
Newsgroups org.kernel.vger.live-patching,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Wed, 1 Jul 2026, Shihao Ren wrote:

> In the funcs allocation failure path, the cleanup loop iterates with
> 'j' but frees objs[i].funcs, which uses the outer loop index 'i'
> instead of the loop variable 'j'. As a result the just-failed (NULL)
> entry is freed repeatedly, while the funcs buffers already allocated
> for objs[0..i-1] are leaked.
> 
> Use objs[j].funcs so the previously allocated entries are correctly
> released.
> 
> Fixes: 59adee07b568 ("livepatch/klp-build: Add stub init code for livepatch modules")
> Signed-off-by: Shihao Ren <[email protected]>

Acked-by: Miroslav Benes <[email protected]>

M