summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2014-06-19 00:34:57 +0200
committerDavid S. Miller <davem@davemloft.net>2014-06-19 02:04:15 +0200
commit6f9a093b66ce7cacc110d8737c03686e80ecfda6 (patch)
tree5a53f18d497fc955d613e8aa1d6aee50a5e47fa8 /net
parentnet: sctp: propagate sysctl errors from proc_do* properly (diff)
downloadlinux-6f9a093b66ce7cacc110d8737c03686e80ecfda6.tar.xz
linux-6f9a093b66ce7cacc110d8737c03686e80ecfda6.zip
net: filter: fix upper BPF instruction limit
The original checks (via sk_chk_filter) for instruction count uses ">", not ">=", so changing this in sk_convert_filter has the potential to break existing seccomp filters that used exactly BPF_MAXINSNS many instructions. Fixes: bd4cf0ed331a ("net: filter: rework/optimize internal BPF interpreter's instruction set") Signed-off-by: Kees Cook <keescook@chromium.org> Cc: stable@vger.kernel.org # v3.15+ Acked-by: Daniel Borkmann <dborkman@redhat.com> Acked-by: Alexei Starovoitov <ast@plumgrid.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/filter.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/core/filter.c b/net/core/filter.c
index 735fad897496..a44e12cdde4c 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -840,7 +840,7 @@ int sk_convert_filter(struct sock_filter *prog, int len,
BUILD_BUG_ON(BPF_MEMWORDS * sizeof(u32) > MAX_BPF_STACK);
BUILD_BUG_ON(BPF_REG_FP + 1 != MAX_BPF_REG);
- if (len <= 0 || len >= BPF_MAXINSNS)
+ if (len <= 0 || len > BPF_MAXINSNS)
return -EINVAL;
if (new_prog) {