aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/livepatch/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/livepatch/core.c')
-rw-r--r--kernel/livepatch/core.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
index ff7f47d026ac..01ca08804f51 100644
--- a/kernel/livepatch/core.c
+++ b/kernel/livepatch/core.c
@@ -248,11 +248,12 @@ static int klp_find_external_symbol(struct module *pmod, const char *name,
248 /* first, check if it's an exported symbol */ 248 /* first, check if it's an exported symbol */
249 preempt_disable(); 249 preempt_disable();
250 sym = find_symbol(name, NULL, NULL, true, true); 250 sym = find_symbol(name, NULL, NULL, true, true);
251 preempt_enable();
252 if (sym) { 251 if (sym) {
253 *addr = sym->value; 252 *addr = sym->value;
253 preempt_enable();
254 return 0; 254 return 0;
255 } 255 }
256 preempt_enable();
256 257
257 /* otherwise check if it's in another .o within the patch module */ 258 /* otherwise check if it's in another .o within the patch module */
258 return klp_find_object_symbol(pmod->name, name, addr); 259 return klp_find_object_symbol(pmod->name, name, addr);
@@ -314,12 +315,12 @@ static void notrace klp_ftrace_handler(unsigned long ip,
314 rcu_read_lock(); 315 rcu_read_lock();
315 func = list_first_or_null_rcu(&ops->func_stack, struct klp_func, 316 func = list_first_or_null_rcu(&ops->func_stack, struct klp_func,
316 stack_node); 317 stack_node);
317 rcu_read_unlock();
318
319 if (WARN_ON_ONCE(!func)) 318 if (WARN_ON_ONCE(!func))
320 return; 319 goto unlock;
321 320
322 klp_arch_set_pc(regs, (unsigned long)func->new_func); 321 klp_arch_set_pc(regs, (unsigned long)func->new_func);
322unlock:
323 rcu_read_unlock();
323} 324}
324 325
325static int klp_disable_func(struct klp_func *func) 326static int klp_disable_func(struct klp_func *func)
@@ -731,7 +732,7 @@ static int klp_init_func(struct klp_object *obj, struct klp_func *func)
731 func->state = KLP_DISABLED; 732 func->state = KLP_DISABLED;
732 733
733 return kobject_init_and_add(&func->kobj, &klp_ktype_func, 734 return kobject_init_and_add(&func->kobj, &klp_ktype_func,
734 obj->kobj, func->old_name); 735 obj->kobj, "%s", func->old_name);
735} 736}
736 737
737/* parts of the initialization that is done only when the object is loaded */ 738/* parts of the initialization that is done only when the object is loaded */
@@ -807,7 +808,7 @@ static int klp_init_patch(struct klp_patch *patch)
807 patch->state = KLP_DISABLED; 808 patch->state = KLP_DISABLED;
808 809
809 ret = kobject_init_and_add(&patch->kobj, &klp_ktype_patch, 810 ret = kobject_init_and_add(&patch->kobj, &klp_ktype_patch,
810 klp_root_kobj, patch->mod->name); 811 klp_root_kobj, "%s", patch->mod->name);
811 if (ret) 812 if (ret)
812 goto unlock; 813 goto unlock;
813 814