aboutsummaryrefslogtreecommitdiff
path: root/net/core
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-11-29 03:50:33 -0500
committerJeff Garzik <jgarzik@pobox.com>2005-11-29 03:50:33 -0500
commit2226340eb8df9c42f9fca74582d08d5117fc0cec (patch)
treec98370844715194600b79f886dbc391633f3e470 /net/core
parent2e06cb5859fdaeba0529806eb1bf161ffd0db201 (diff)
parent624f54be206adf970cd8eece16446b027913e533 (diff)
Merge branch 'master'
Diffstat (limited to 'net/core')
-rw-r--r--net/core/filter.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/core/filter.c b/net/core/filter.c
index 079c2edff78..2841bfce29d 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -116,8 +116,6 @@ int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen)
A /= X;
continue;
case BPF_ALU|BPF_DIV|BPF_K:
- if (fentry->k == 0)
- return 0;
A /= fentry->k;
continue;
case BPF_ALU|BPF_AND|BPF_X:
@@ -320,6 +318,10 @@ int sk_chk_filter(struct sock_filter *filter, int flen)
}
}
+ /* check for division by zero -Kris Katterjohn 2005-10-30 */
+ if (ftest->code == (BPF_ALU|BPF_DIV|BPF_K) && ftest->k == 0)
+ return -EINVAL;
+
/* check that memory operations use valid addresses. */
if (ftest->k >= BPF_MEMWORDS) {
/* but it might not be a memory operation... */