Skip to content

Commit a087cdd

Browse files
committed
livepatch: Module coming and going callbacks can proceed with all listed patches
Livepatches can no longer get enabled and disabled repeatedly. The list klp_patches contains only enabled patches and eventually the patch in transition. The module coming and going callbacks do no longer need to check for these state. They have to proceed with all listed patches. Suggested-by: Josh Poimboeuf <[email protected]> Acked-by: Miroslav Benes <[email protected]> Acked-by: Joe Lawrence <[email protected]> Signed-off-by: Petr Mladek <[email protected]>
1 parent 49ee4dd commit a087cdd

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

kernel/livepatch/core.c

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,21 +1141,14 @@ static void klp_cleanup_module_patches_limited(struct module *mod,
11411141
if (!klp_is_module(obj) || strcmp(obj->name, mod->name))
11421142
continue;
11431143

1144-
/*
1145-
* Only unpatch the module if the patch is enabled or
1146-
* is in transition.
1147-
*/
1148-
if (patch->enabled || patch == klp_transition_patch) {
1149-
1150-
if (patch != klp_transition_patch)
1151-
klp_pre_unpatch_callback(obj);
1144+
if (patch != klp_transition_patch)
1145+
klp_pre_unpatch_callback(obj);
11521146

1153-
pr_notice("reverting patch '%s' on unloading module '%s'\n",
1154-
patch->mod->name, obj->mod->name);
1155-
klp_unpatch_object(obj);
1147+
pr_notice("reverting patch '%s' on unloading module '%s'\n",
1148+
patch->mod->name, obj->mod->name);
1149+
klp_unpatch_object(obj);
11561150

1157-
klp_post_unpatch_callback(obj);
1158-
}
1151+
klp_post_unpatch_callback(obj);
11591152

11601153
klp_free_object_loaded(obj);
11611154
break;
@@ -1194,13 +1187,6 @@ int klp_module_coming(struct module *mod)
11941187
goto err;
11951188
}
11961189

1197-
/*
1198-
* Only patch the module if the patch is enabled or is
1199-
* in transition.
1200-
*/
1201-
if (!patch->enabled && patch != klp_transition_patch)
1202-
break;
1203-
12041190
pr_notice("applying patch '%s' to loading module '%s'\n",
12051191
patch->mod->name, obj->mod->name);
12061192

0 commit comments

Comments
 (0)