Commit 50a0f3f5 authored by Yang Yingliang's avatar Yang Yingliang Committed by Petr Mladek

livepatch: Fix missing unlock on error in klp_enable_patch()

Add missing unlock when try_module_get() fails in klp_enable_patch().

Fixes: 5ef3dd20 ("livepatch: Fix kobject refcount bug on klp_init_patch_early failure path")
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Acked-by: default avatarDavid Vernet <void@manifault.com>
Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
Signed-off-by: default avatarPetr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20211225025115.475348-1-yangyingliang@huawei.com
parent 5ef3dd20
......@@ -1047,8 +1047,10 @@ int klp_enable_patch(struct klp_patch *patch)
return -EINVAL;
}
if (!try_module_get(patch->mod))
if (!try_module_get(patch->mod)) {
mutex_unlock(&klp_mutex);
return -ENODEV;
}
klp_init_patch_early(patch);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment