提交 0c093ccd 编写于 作者: Y Yang Yingliang 提交者: Zheng Zengkai

livepatch: Fix missing unlock on error in klp_enable_patch()

mainline inclusion
from mainline-v5.17-rc1
commit 50a0f3f5
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I4TF7T
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=50a0f3f55e382b313e7cbebdf8ccf1593296e16f

--------------------------------

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: NHulk Robot <hulkci@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Acked-by: NDavid Vernet <void@manifault.com>
Reviewed-by: NPetr Mladek <pmladek@suse.com>
Signed-off-by: NPetr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20211225025115.475348-1-yangyingliang@huawei.comSigned-off-by: NZheng Yejian <zhengyejian1@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 2220964a
......@@ -1447,8 +1447,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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册