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 <hulkci@huawei.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Acked-by: David Vernet <void@manifault.com> Reviewed-by: Petr Mladek <pmladek@suse.com> Signed-off-by: Petr Mladek <pmladek@suse.com> Link: https://lore.kernel.org/r/20211225025115.475348-1-yangyingliang@huawei.com
1 parent 5ef3dd2 commit 50a0f3f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

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)