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 50430f79f8c..1c6d328165b 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) if (copy_from_user(&uprog, arg, sizeof(uprog))) return -EFAULT; - if (uprog.len > BPF_MAXINSNS) - return -EINVAL; - if (!uprog.len) { *p = NULL; return 0; diff --git a/net/core/filter.c b/net/core/filter.c index 2841bfce29d..3a10e0bc90e 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) struct sock_filter *ftest; int pc; - if (((unsigned int)flen >= (~0U / sizeof(struct sock_filter))) || flen == 0) + if (flen == 0 || flen > BPF_MAXINSNS) return -EINVAL; /* check the filter code now */ @@ -360,7 +360,7 @@ int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk) int err; /* Make sure new filter is there and in the right amounts. */ - if (fprog->filter == NULL || fprog->len > BPF_MAXINSNS) + if (fprog->filter == NULL) return -EINVAL; fp = sock_kmalloc(sk, fsize+sizeof(*fp), GFP_KERNEL); |