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) | |||
116 | A /= X; | 116 | A /= X; |
117 | continue; | 117 | continue; |
118 | case BPF_ALU|BPF_DIV|BPF_K: | 118 | case BPF_ALU|BPF_DIV|BPF_K: |
119 | if (fentry->k == 0) | ||
120 | return 0; | ||
121 | A /= fentry->k; | 119 | A /= fentry->k; |
122 | continue; | 120 | continue; |
123 | case BPF_ALU|BPF_AND|BPF_X: | 121 | case BPF_ALU|BPF_AND|BPF_X: |
@@ -320,6 +318,10 @@ int sk_chk_filter(struct sock_filter *filter, int flen) | |||
320 | } | 318 | } |
321 | } | 319 | } |
322 | 320 | ||
321 | /* check for division by zero -Kris Katterjohn 2005-10-30 */ | ||
322 | if (ftest->code == (BPF_ALU|BPF_DIV|BPF_K) && ftest->k == 0) | ||
323 | return -EINVAL; | ||
324 | |||
323 | /* check that memory operations use valid addresses. */ | 325 | /* check that memory operations use valid addresses. */ |
324 | if (ftest->k >= BPF_MEMWORDS) { | 326 | if (ftest->k >= BPF_MEMWORDS) { |
325 | /* but it might not be a memory operation... */ | 327 | /* but it might not be a memory operation... */ |