]> git.ipfire.org Git - thirdparty/linux.git/commit
selftests/livepatch: fix resource leak in test_klp_syscall init error path
authorRui Qi <qirui.001@bytedance.com>
Thu, 4 Jun 2026 08:32:08 +0000 (16:32 +0800)
committerPetr Mladek <pmladek@suse.com>
Tue, 9 Jun 2026 10:38:33 +0000 (12:38 +0200)
commit7203abb3f8bd61e021cce076dafdda7bcfd9f2c2
treec3b707cdfbbaf5825233e9fca0dacdfb7ef27500
parented8f317671d9a6bd1daf2f0cb152e126eae2bf10
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>
tools/testing/selftests/livepatch/test_modules/test_klp_syscall.c