Commit 9ec0de0e authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/livepatching

Pull livepatching fixes from Jiri Kosina:
 "Two tiny fixes for livepatching infrastructure:

   - extending RCU critical section to cover all accessess to
     RCU-protected variable, by Petr Mladek

   - proper format string passing to kobject_init_and_add(), by Jiri
     Kosina"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/livepatching:
  livepatch: RCU protect struct klp_func all the time when used in klp_ftrace_handler()
  livepatch: fix format string in kobject_init_and_add()
parents c4bbb398 c4ce0da8
...@@ -314,12 +314,12 @@ static void notrace klp_ftrace_handler(unsigned long ip, ...@@ -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)
...@@ -731,7 +731,7 @@ static int klp_init_func(struct klp_object *obj, struct klp_func *func) ...@@ -731,7 +731,7 @@ static int klp_init_func(struct klp_object *obj, struct klp_func *func)
func->state = KLP_DISABLED; func->state = KLP_DISABLED;
return kobject_init_and_add(&func->kobj, &klp_ktype_func, return kobject_init_and_add(&func->kobj, &klp_ktype_func,
obj->kobj, func->old_name); obj->kobj, "%s", func->old_name);
} }
/* parts of the initialization that is done only when the object is loaded */ /* parts of the initialization that is done only when the object is loaded */
...@@ -807,7 +807,7 @@ static int klp_init_patch(struct klp_patch *patch) ...@@ -807,7 +807,7 @@ static int klp_init_patch(struct klp_patch *patch)
patch->state = KLP_DISABLED; patch->state = KLP_DISABLED;
ret = kobject_init_and_add(&patch->kobj, &klp_ktype_patch, ret = kobject_init_and_add(&patch->kobj, &klp_ktype_patch,
klp_root_kobj, patch->mod->name); klp_root_kobj, "%s", patch->mod->name);
if (ret) if (ret)
goto unlock; goto unlock;
......
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