diff options
| author | Yafang Shao <laoar.shao@gmail.com> | 2026-08-16 17:04:41 +0800 |
|---|---|---|
| committer | Josh Poimboeuf <jpoimboe@kernel.org> | 2026-08-31 17:50:06 -0700 |
| commit | 4825ef699cda4c6f2f0586b17a5e225560481da6 (patch) | |
| tree | 63e57205a67a64c36d8e088d28397a9a4d38f742 /scripts/livepatch | |
| parent | cee9395acd8043be0644b25c34bfa86623f2b935 (diff) | |
| download | linux-4825ef699cda4c6f2f0586b17a5e225560481da6.tar.gz linux-4825ef699cda4c6f2f0586b17a5e225560481da6.zip | |
klp-build: Fix wrong index in funcs cleanup error path
In the object allocation loop, when kzalloc() for funcs fails, the
cleanup loop uses `objs[i].funcs` instead of `objs[j].funcs`. Since
`objs[i].funcs` is still NULL at that point, it repeatedly calls
kfree(NULL) and leaks all previously allocated funcs arrays.
Fixes: 59adee07b568 ("livepatch/klp-build: Add stub init code for livepatch modules")
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Acked-by: Song Liu <song@kernel.org>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Acked-by: Miroslav Benes <mbenes@suse.cz>
Link: https://patch.msgid.link/20260816090442.18128-2-laoar.shao@gmail.com
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Diffstat (limited to 'scripts/livepatch')
| -rw-r--r-- | scripts/livepatch/init.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/livepatch/init.c b/scripts/livepatch/init.c index f14d8c8fb35f..16aff8f736eb 100644 --- a/scripts/livepatch/init.c +++ b/scripts/livepatch/init.c @@ -51,7 +51,7 @@ static int __init livepatch_mod_init(void) if (!funcs) { ret = -ENOMEM; for (int j = 0; j < i; j++) - kfree(objs[i].funcs); + kfree(objs[j].funcs); goto err_free_objs; } |
