summaryrefslogtreecommitdiff
path: root/kernel/trace
diff options
context:
space:
mode:
authorSean Young <sean@mess.org>2018-05-27 14:24:08 +0300
committerDaniel Borkmann <daniel@iogearbox.net>2018-05-30 13:37:38 +0300
commit170a7e3ea0709eae12c8f944b9f33c54fe80c6c1 (patch)
treee15d4fd9b40404cba75181c70d53f7ad3ef72f22 /kernel/trace
parent9ce64f192d161acff17c99ceec7d9ce3db9252fa (diff)
downloadlinux-170a7e3ea0709eae12c8f944b9f33c54fe80c6c1.tar.xz
bpf: bpf_prog_array_copy() should return -ENOENT if exclude_prog not found
This makes is it possible for bpf prog detach to return -ENOENT. Acked-by: Yonghong Song <yhs@fb.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/bpf_trace.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index 81fdf2fc94ac..af1486d9a0ed 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -1006,6 +1006,8 @@ void perf_event_detach_bpf_prog(struct perf_event *event)
old_array = event->tp_event->prog_array;
ret = bpf_prog_array_copy(old_array, event->prog, NULL, &new_array);
+ if (ret == -ENOENT)
+ goto unlock;
if (ret < 0) {
bpf_prog_array_delete_safe(old_array, event->prog);
} else {