diff options
-rw-r--r-- | drivers/net/ppp_generic.c | 3 | ||||
-rw-r--r-- | net/core/filter.c | 4 |
2 files changed, 2 insertions, 5 deletions
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index 50430f79f8cf..1c6d328165bb 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c | |||
@@ -524,9 +524,6 @@ static int get_filter(void __user *arg, struct sock_filter **p) | |||
524 | if (copy_from_user(&uprog, arg, sizeof(uprog))) | 524 | if (copy_from_user(&uprog, arg, sizeof(uprog))) |
525 | return -EFAULT; | 525 | return -EFAULT; |
526 | 526 | ||
527 | if (uprog.len > BPF_MAXINSNS) | ||
528 | return -EINVAL; | ||
529 | |||
530 | if (!uprog.len) { | 527 | if (!uprog.len) { |
531 | *p = NULL; | 528 | *p = NULL; |
532 | return 0; | 529 | return 0; |
diff --git a/net/core/filter.c b/net/core/filter.c index 2841bfce29d6..3a10e0bc90e8 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
@@ -293,7 +293,7 @@ int sk_chk_filter(struct sock_filter *filter, int flen) | |||
293 | struct sock_filter *ftest; | 293 | struct sock_filter *ftest; |
294 | int pc; | 294 | int pc; |
295 | 295 | ||
296 | if (((unsigned int)flen >= (~0U / sizeof(struct sock_filter))) || flen == 0) | 296 | if (flen == 0 || flen > BPF_MAXINSNS) |
297 | return -EINVAL; | 297 | return -EINVAL; |
298 | 298 | ||
299 | /* check the filter code now */ | 299 | /* check the filter code now */ |
@@ -360,7 +360,7 @@ int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk) | |||
360 | int err; | 360 | int err; |
361 | 361 | ||
362 | /* Make sure new filter is there and in the right amounts. */ | 362 | /* Make sure new filter is there and in the right amounts. */ |
363 | if (fprog->filter == NULL || fprog->len > BPF_MAXINSNS) | 363 | if (fprog->filter == NULL) |
364 | return -EINVAL; | 364 | return -EINVAL; |
365 | 365 | ||
366 | fp = sock_kmalloc(sk, fsize+sizeof(*fp), GFP_KERNEL); | 366 | fp = sock_kmalloc(sk, fsize+sizeof(*fp), GFP_KERNEL); |