On Tue 2026-06-23 10:20:38, Miroslav Benes wrote:
quoted
quoted
Anyway, could you send the fix separately since it is an existing issue,
please?
Does the following change look good to you ?
diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
index 28d15ba58a26..317a3c866c76 100644
--- a/kernel/livepatch/core.c
+++ b/kernel/livepatch/core.c
@@ -799,9 +799,6 @@ void klp_free_replaced_patches_async(struct
klp_patch *new_patch)
static int klp_init_func(struct klp_object *obj, struct klp_func *func)
{
- if (!func->old_name)
- return -EINVAL;
-
/*
* NOPs get the address later. The patched module must be loaded,
* see klp_init_object_loaded().@@ -1107,8 +1104,9 @@ static int __klp_enable_patch(struct klp_patch *patch)
*/
int klp_enable_patch(struct klp_patch *patch)
{
- int ret;
struct klp_object *obj;
+ struct klp_func *func;
+ int ret;
if (!patch || !patch->mod || !patch->objs)
return -EINVAL;@@ -1116,9 +1114,12 @@ int klp_enable_patch(struct klp_patch *patch)
klp_for_each_object_static(patch, obj) {
if (!obj->funcs)
return -EINVAL;
+ klp_for_each_func_static(obj, func) {
+ if (!func->old_name)
+ return -EINVAL;
+ }
}
-
if (!is_livepatch_module(patch->mod)) {
pr_err("module %s is not marked as a livepatch module\n",
patch->mod->name);
If you wrap it into klp_check_patch() which Petr proposed alongside
with all the checks at the beginning of klp_enable_patch() up to
is_livepatch_module(), then yes, I think.
+1
Best Regards,
Petr