Skip to content

Commit

Permalink
livepatch: Module coming and going callbacks can proceed with all lis…
Browse files Browse the repository at this point in the history
…ted 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]>
  • Loading branch information
pmladek committed Feb 6, 2019
1 parent 49ee4dd commit a087cdd
Showing 1 changed file with 6 additions and 20 deletions.
26 changes: 6 additions & 20 deletions kernel/livepatch/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1141,21 +1141,14 @@ static void klp_cleanup_module_patches_limited(struct module *mod,
if (!klp_is_module(obj) || strcmp(obj->name, mod->name))
continue;

/*
* Only unpatch the module if the patch is enabled or
* is in transition.
*/
if (patch->enabled || patch == klp_transition_patch) {

if (patch != klp_transition_patch)
klp_pre_unpatch_callback(obj);
if (patch != klp_transition_patch)
klp_pre_unpatch_callback(obj);

pr_notice("reverting patch '%s' on unloading module '%s'\n",
patch->mod->name, obj->mod->name);
klp_unpatch_object(obj);
pr_notice("reverting patch '%s' on unloading module '%s'\n",
patch->mod->name, obj->mod->name);
klp_unpatch_object(obj);

klp_post_unpatch_callback(obj);
}
klp_post_unpatch_callback(obj);

klp_free_object_loaded(obj);
break;
Expand Down Expand Up @@ -1194,13 +1187,6 @@ int klp_module_coming(struct module *mod)
goto err;
}

/*
* Only patch the module if the patch is enabled or is
* in transition.
*/
if (!patch->enabled && patch != klp_transition_patch)
break;

pr_notice("applying patch '%s' to loading module '%s'\n",
patch->mod->name, obj->mod->name);

Expand Down

0 comments on commit a087cdd

Please sign in to comment.