diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-11-29 03:50:33 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-11-29 03:50:33 -0500 |
commit | 2226340eb8df9c42f9fca74582d08d5117fc0cec (patch) | |
tree | c98370844715194600b79f886dbc391633f3e470 /net/core | |
parent | 2e06cb5859fdaeba0529806eb1bf161ffd0db201 (diff) | |
parent | 624f54be206adf970cd8eece16446b027913e533 (diff) |
Merge branch 'master'
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/filter.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/net/core/filter.c b/net/core/filter.c index 079c2edff789..2841bfce29d6 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... */ |