Skip to content

Commit

Permalink
livepatch: fix deferred module patching order
Browse files Browse the repository at this point in the history
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: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Josh Poimboeuf authored and Jiri Kosina committed Jan 9, 2015
1 parent b9dfe0b commit 99590ba
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/livepatch/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 99590ba

Please sign in to comment.