mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 18:21:24 +02:00
selftests/livepatch: fix resource leak in test_klp_syscall init error path
In livepatch_init(), if klp_enable_patch() fails, the previously created kobject and sysfs file are never cleaned up, causing a resource leak. Capture the return value and add proper cleanup on the error path. Signed-off-by: Rui Qi <qirui.001@bytedance.com> Acked-by: Miroslav Benes <mbenes@suse.cz> Reviewed-by: Petr Mladek <pmladek@suse.com> Link: https://patch.msgid.link/20260604083208.1071428-1-qirui.001@bytedance.com Signed-off-by: Petr Mladek <pmladek@suse.com>
This commit is contained in:
parent
ed8f317671
commit
7203abb3f8
|
|
@ -109,7 +109,11 @@ static int livepatch_init(void)
|
|||
*/
|
||||
npids = npids_pending;
|
||||
|
||||
return klp_enable_patch(&patch);
|
||||
ret = klp_enable_patch(&patch);
|
||||
if (ret)
|
||||
kobject_put(klp_kobj);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void livepatch_exit(void)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user