]> Git Repo - linux.git/blobdiff - kernel/livepatch/patch.c
scsi: ibmvfc: Complete commands outside the host/queue lock
[linux.git] / kernel / livepatch / patch.c
index b552cf2d85f83ad46c5f94aa90d6fd068befd529..e8029aea67f1d80f7bf488b85e0a1df1e5a75437 100644 (file)
@@ -40,14 +40,18 @@ struct klp_ops *klp_find_ops(void *old_func)
 static void notrace klp_ftrace_handler(unsigned long ip,
                                       unsigned long parent_ip,
                                       struct ftrace_ops *fops,
-                                      struct pt_regs *regs)
+                                      struct ftrace_regs *fregs)
 {
        struct klp_ops *ops;
        struct klp_func *func;
        int patch_state;
+       int bit;
 
        ops = container_of(fops, struct klp_ops, fops);
 
+       bit = ftrace_test_recursion_trylock(ip, parent_ip);
+       if (WARN_ON_ONCE(bit < 0))
+               return;
        /*
         * A variant of synchronize_rcu() is used to allow patching functions
         * where RCU is not watching, see klp_synchronize_transition().
@@ -113,10 +117,11 @@ static void notrace klp_ftrace_handler(unsigned long ip,
        if (func->nop)
                goto unlock;
 
-       klp_arch_set_pc(regs, (unsigned long)func->new_func);
+       klp_arch_set_pc(fregs, (unsigned long)func->new_func);
 
 unlock:
        preempt_enable_notrace();
+       ftrace_test_recursion_unlock(bit);
 }
 
 /*
@@ -194,8 +199,10 @@ static int klp_patch_func(struct klp_func *func)
                        return -ENOMEM;
 
                ops->fops.func = klp_ftrace_handler;
-               ops->fops.flags = FTRACE_OPS_FL_SAVE_REGS |
-                                 FTRACE_OPS_FL_DYNAMIC |
+               ops->fops.flags = FTRACE_OPS_FL_DYNAMIC |
+#ifndef CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS
+                                 FTRACE_OPS_FL_SAVE_REGS |
+#endif
                                  FTRACE_OPS_FL_IPMODIFY |
                                  FTRACE_OPS_FL_PERMANENT;
 
This page took 0.03069 seconds and 4 git commands to generate.