diff options
author | Kees Cook <keescook@chromium.org> | 2014-06-18 15:34:57 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-07-28 08:08:22 -0700 |
commit | 72d49fe1104fc95712287460dcf50a9a96c499ca (patch) | |
tree | a860cb0cf3d1dd6df5476daeb985f29295ecd29f /net | |
parent | b95398560fec152137fcde54c96559a9b7f9003f (diff) |
net: filter: fix upper BPF instruction limit
[ Upstream commit 6f9a093b66ce7cacc110d8737c03686e80ecfda6 ]
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/filter.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/core/filter.c b/net/core/filter.c index 4aec7b93f1a..5310d5e0884 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -872,7 +872,7 @@ int sk_convert_filter(struct sock_filter *prog, int len, BUILD_BUG_ON(BPF_MEMWORDS * sizeof(u32) > MAX_BPF_STACK); BUILD_BUG_ON(FP_REG + 1 != MAX_BPF_REG); - if (len <= 0 || len >= BPF_MAXINSNS) + if (len <= 0 || len > BPF_MAXINSNS) return -EINVAL; if (new_prog) { |