Merge tag 'probes-fixes-v6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-block.git] / kernel / trace / fprobe.c
index 2571f7f3d5f28866bd2d6a2053146c3a4180a595..b70de44e6d3dc38b01c07e104030847f4b8c01d4 100644 (file)
@@ -46,7 +46,7 @@ static inline void __fprobe_handler(unsigned long ip, unsigned long parent_ip,
        }
 
        if (fp->entry_handler)
-               ret = fp->entry_handler(fp, ip, ftrace_get_regs(fregs), entry_data);
+               ret = fp->entry_handler(fp, ip, parent_ip, ftrace_get_regs(fregs), entry_data);
 
        /* If entry_handler returns !0, nmissed is not counted. */
        if (rh) {
@@ -114,7 +114,7 @@ recursion_unlock:
 }
 
 static void fprobe_exit_handler(struct rethook_node *rh, void *data,
-                               struct pt_regs *regs)
+                               unsigned long ret_ip, struct pt_regs *regs)
 {
        struct fprobe *fp = (struct fprobe *)data;
        struct fprobe_rethook_node *fpr;
@@ -135,7 +135,7 @@ static void fprobe_exit_handler(struct rethook_node *rh, void *data,
                return;
        }
 
-       fp->exit_handler(fp, fpr->entry_ip, regs,
+       fp->exit_handler(fp, fpr->entry_ip, ret_ip, regs,
                         fp->entry_data_size ? (void *)fpr->data : NULL);
        ftrace_test_recursion_unlock(bit);
 }
@@ -350,6 +350,14 @@ int register_fprobe_syms(struct fprobe *fp, const char **syms, int num)
 }
 EXPORT_SYMBOL_GPL(register_fprobe_syms);
 
+bool fprobe_is_registered(struct fprobe *fp)
+{
+       if (!fp || (fp->ops.saved_func != fprobe_handler &&
+                   fp->ops.saved_func != fprobe_kprobe_handler))
+               return false;
+       return true;
+}
+
 /**
  * unregister_fprobe() - Unregister fprobe from ftrace
  * @fp: A fprobe data structure to be unregistered.
@@ -362,8 +370,7 @@ int unregister_fprobe(struct fprobe *fp)
 {
        int ret;
 
-       if (!fp || (fp->ops.saved_func != fprobe_handler &&
-                   fp->ops.saved_func != fprobe_kprobe_handler))
+       if (!fprobe_is_registered(fp))
                return -EINVAL;
 
        if (fp->rethook)