summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLi Qiang <liq3ea@163.com>2022-11-04 08:49:31 +0900
committerMasami Hiramatsu (Google) <mhiramat@kernel.org>2022-11-04 08:49:31 +0900
commit4a6f316d6855a434f56dbbeba05e14c01acde8f8 (patch)
tree3b8675c2f6394755118a8858aecbb24802d873ea
parent0e792b89e6800cd9cb4757a76a96f7ef3e8b6294 (diff)
downloadlinux-stable-4a6f316d6855a434f56dbbeba05e14c01acde8f8.tar.gz
linux-stable-4a6f316d6855a434f56dbbeba05e14c01acde8f8.tar.bz2
linux-stable-4a6f316d6855a434f56dbbeba05e14c01acde8f8.zip
kprobe: reverse kp->flags when arm_kprobe failed
In aggregate kprobe case, when arm_kprobe failed, we need set the kp->flags with KPROBE_FLAG_DISABLED again. If not, the 'kp' kprobe will been considered as enabled but it actually not enabled. Link: https://lore.kernel.org/all/20220902155820.34755-1-liq3ea@163.com/ Fixes: 12310e343755 ("kprobes: Propagate error from arm_kprobe_ftrace()") Cc: stable@vger.kernel.org Signed-off-by: Li Qiang <liq3ea@163.com> Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
-rw-r--r--kernel/kprobes.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 3220b0a2fb4a..cd9f5a66a690 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -2429,8 +2429,11 @@ int enable_kprobe(struct kprobe *kp)
if (!kprobes_all_disarmed && kprobe_disabled(p)) {
p->flags &= ~KPROBE_FLAG_DISABLED;
ret = arm_kprobe(p);
- if (ret)
+ if (ret) {
p->flags |= KPROBE_FLAG_DISABLED;
+ if (p != kp)
+ kp->flags |= KPROBE_FLAG_DISABLED;
+ }
}
out:
mutex_unlock(&kprobe_mutex);