Commit 99590ba5 authored by Josh Poimboeuf's avatar Josh Poimboeuf Committed by Jiri Kosina

livepatch: fix deferred module patching order

When applying multiple patches to a module, if the module is loaded
after the patches are loaded, the patches are applied in reverse order:

  $ insmod patch1.ko
  [   43.172992] livepatch: enabling patch 'patch1'

  $ insmod patch2.ko
  [   46.571563] livepatch: enabling patch 'patch2'

  $ modprobe nfsd
  [   52.888922] livepatch: applying patch 'patch2' to loading module 'nfsd'
  [   52.899847] livepatch: applying patch 'patch1' to loading module 'nfsd'

Fix the loading order by storing the klp_patches list in queue order.
Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent b9dfe0be
......@@ -739,7 +739,7 @@ static int klp_init_patch(struct klp_patch *patch)
goto free;
}
list_add(&patch->list, &klp_patches);
list_add_tail(&patch->list, &klp_patches);
mutex_unlock(&klp_mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment