diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 917b92ae23821a..6d2a8623ec7b53 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -1762,7 +1762,13 @@ static int __unregister_kprobe_top(struct kprobe *p) if ((list_p != p) && (list_p->post_handler)) goto noclean; } - ap->post_handler = NULL; + /* + * For the kprobe-on-ftrace case, we keep the + * post_handler setting to identify this aggrprobe + * armed with kprobe_ipmodify_ops. + */ + if (!kprobe_ftrace(ap)) + ap->post_handler = NULL; } noclean: /*