diff options
author | Petr Mladek <pmladek@suse.cz> | 2015-02-18 18:02:13 +0100 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2015-02-22 23:02:56 +0100 |
commit | c4ce0da8ec62d83c96e29db7dadd6d3985344bb3 (patch) | |
tree | 1e7f1cc23c34e21a0238926df348a1d22f4f0cca /kernel | |
parent | e0b561ee78d82a4cc7792aa28fa4b1ea15325dcc (diff) | |
download | op-kernel-dev-c4ce0da8ec62d83c96e29db7dadd6d3985344bb3.zip op-kernel-dev-c4ce0da8ec62d83c96e29db7dadd6d3985344bb3.tar.gz |
livepatch: RCU protect struct klp_func all the time when used in klp_ftrace_handler()
func->new_func has been accessed after rcu_read_unlock() in klp_ftrace_handler()
and therefore the access was not protected.
Signed-off-by: Petr Mladek <pmladek@suse.cz>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/livepatch/core.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c index 69bf3aa..782172f 100644 --- a/kernel/livepatch/core.c +++ b/kernel/livepatch/core.c @@ -314,12 +314,12 @@ static void notrace klp_ftrace_handler(unsigned long ip, rcu_read_lock(); func = list_first_or_null_rcu(&ops->func_stack, struct klp_func, stack_node); - rcu_read_unlock(); - if (WARN_ON_ONCE(!func)) - return; + goto unlock; klp_arch_set_pc(regs, (unsigned long)func->new_func); +unlock: + rcu_read_unlock(); } static int klp_disable_func(struct klp_func *func) |