LVS
lvs-devel
Google
 
Web LinuxVirtualServer.org

Re: [PATCH 3/5] net/netfilter/ipvs/ip_vs_ctl.c: drop argument range chec

To: Julian Anastasov <ja@xxxxxx>
Subject: Re: [PATCH 3/5] net/netfilter/ipvs/ip_vs_ctl.c: drop argument range check just before the check for equality
Cc: Andrey Utkin <andrey.krieger.utkin@xxxxxxxxx>, "linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>, kernel-janitors@xxxxxxxxxxxxxxx, coreteam@xxxxxxxxxxxxx, netfilter-devel@xxxxxxxxxxxxxxx, lvs-devel@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxxxxxx, dcb314@xxxxxxxxxxx, David Miller <davem@xxxxxxxxxxxxx>, kadlec@xxxxxxxxxxxxxxxxx, Patrick McHardy <kaber@xxxxxxxxx>, pablo@xxxxxxxxxxxxx, Simon Horman <horms@xxxxxxxxxxxx>, wensong@xxxxxxxxxxxx
From: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Date: Tue, 22 Jul 2014 10:42:14 +0300
On Mon, Jul 21, 2014 at 11:01:56PM +0300, Julian Anastasov wrote:
> @@ -2333,13 +2339,12 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, void 
> __user *user, unsigned int len)
>       struct ip_vs_dest_user_kern udest;
>       struct netns_ipvs *ipvs = net_ipvs(net);
>  
> +     BUILD_BUG_ON(sizeof(arg) > 256);

256 is off-by-one because u8 ranges from 0-255 so we are never able to
copy 256 bytes into the "arg" buffer.

> -     if (copylen > 128)
> +     if (*len < (int) copylen || *len < 0) {
> +             pr_err("get_ctl: len %d < %u\n", *len, copylen);

Don't let users flood dmesg.  Just return an error.  (This can be
triggered by non-root as well).

>               return -EINVAL;
> +     }

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe lvs-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

<Prev in Thread] Current Thread [Next in Thread>