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>
This commit is contained in:
parent
e0b561ee78
commit
c4ce0da8ec
|
@ -314,12 +314,12 @@ static void notrace klp_ftrace_handler(unsigned long ip,
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
func = list_first_or_null_rcu(&ops->func_stack, struct klp_func,
|
func = list_first_or_null_rcu(&ops->func_stack, struct klp_func,
|
||||||
stack_node);
|
stack_node);
|
||||||
rcu_read_unlock();
|
|
||||||
|
|
||||||
if (WARN_ON_ONCE(!func))
|
if (WARN_ON_ONCE(!func))
|
||||||
return;
|
goto unlock;
|
||||||
|
|
||||||
klp_arch_set_pc(regs, (unsigned long)func->new_func);
|
klp_arch_set_pc(regs, (unsigned long)func->new_func);
|
||||||
|
unlock:
|
||||||
|
rcu_read_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int klp_disable_func(struct klp_func *func)
|
static int klp_disable_func(struct klp_func *func)
|
||||||
|
|
Loading…
Reference in New Issue