Skip to content

Commit 61b304b

Browse files
committed
tracing/fprobe: Fix to check whether fprobe is registered correctly
Since commit ab51e15 ("fprobe: Introduce FPROBE_FL_KPROBE_SHARED flag for fprobe") introduced fprobe_kprobe_handler() for fprobe::ops::func, unregister_fprobe() fails to unregister the registered if user specifies FPROBE_FL_KPROBE_SHARED flag. Moreover, __register_ftrace_function() is possible to change the ftrace_ops::func, thus we have to check fprobe::ops::saved_func instead. To check it correctly, it should confirm the fprobe::ops::saved_func is either fprobe_handler() or fprobe_kprobe_handler(). Link: https://lore.kernel.org/all/166677683946.1459107.15997653945538644683.stgit@devnote3/ Fixes: cad9931 ("fprobe: Add ftrace based probe APIs") Cc: [email protected] Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
1 parent d05ea35 commit 61b304b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kernel/trace/fprobe.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,8 @@ int unregister_fprobe(struct fprobe *fp)
303303
{
304304
int ret;
305305

306-
if (!fp || fp->ops.func != fprobe_handler)
306+
if (!fp || (fp->ops.saved_func != fprobe_handler &&
307+
fp->ops.saved_func != fprobe_kprobe_handler))
307308
return -EINVAL;
308309

309310
/*

0 commit comments

Comments
 (0)