livepatch: unpatch all klp_objects if klp_module_coming fails
authorJoe Lawrence <joe.lawrence@redhat.com>
Mon, 2 Oct 2017 15:56:48 +0000 (11:56 -0400)
committerJiri Kosina <jkosina@suse.cz>
Wed, 11 Oct 2017 13:38:46 +0000 (15:38 +0200)
commitef8daf8eeb5b8ab6bc356656163d19f20fb827ed
tree2ae9e01115e5aa8adfe4aa3870e0cf0c156d419f
parentdcba71086e0d1abf4f00cd381530b11d0db7fa1d
livepatch: unpatch all klp_objects if klp_module_coming fails

When an incoming module is considered for livepatching by
klp_module_coming(), it iterates over multiple patches and multiple
kernel objects in this order:

list_for_each_entry(patch, &klp_patches, list) {
klp_for_each_object(patch, obj) {

which means that if one of the kernel objects fails to patch,
klp_module_coming()'s error path needs to unpatch and cleanup any kernel
objects that were already patched by a previous patch.

Reported-by: Miroslav Benes <mbenes@suse.cz>
Suggested-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
kernel/livepatch/core.c