summaryrefslogtreecommitdiff
path: root/kernel/bpf/mprog.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/bpf/mprog.c')
-rw-r--r--kernel/bpf/mprog.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/bpf/mprog.c b/kernel/bpf/mprog.c
index 32d2c4829eb8..007d98c799e2 100644
--- a/kernel/bpf/mprog.c
+++ b/kernel/bpf/mprog.c
@@ -253,6 +253,9 @@ int bpf_mprog_attach(struct bpf_mprog_entry *entry,
goto out;
}
idx = tidx;
+ } else if (bpf_mprog_total(entry) == bpf_mprog_max()) {
+ ret = -ERANGE;
+ goto out;
}
if (flags & BPF_F_BEFORE) {
tidx = bpf_mprog_pos_before(entry, &rtuple);