Skip to content

Commit 50a0f3f

Browse files
Yang Yingliangpmladek
authored andcommitted
livepatch: Fix missing unlock on error in klp_enable_patch()
Add missing unlock when try_module_get() fails in klp_enable_patch(). Fixes: 5ef3dd2 ("livepatch: Fix kobject refcount bug on klp_init_patch_early failure path") Reported-by: Hulk Robot <[email protected]> Signed-off-by: Yang Yingliang <[email protected]> Acked-by: David Vernet <[email protected]> Reviewed-by: Petr Mladek <[email protected]> Signed-off-by: Petr Mladek <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 5ef3dd2 commit 50a0f3f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

kernel/livepatch/core.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1047,8 +1047,10 @@ int klp_enable_patch(struct klp_patch *patch)
10471047
return -EINVAL;
10481048
}
10491049

1050-
if (!try_module_get(patch->mod))
1050+
if (!try_module_get(patch->mod)) {
1051+
mutex_unlock(&klp_mutex);
10511052
return -ENODEV;
1053+
}
10521054

10531055
klp_init_patch_early(patch);
10541056

0 commit comments

Comments
 (0)