lkml.org 
[lkml]   [2014]   [Jul]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/5] net/netfilter/ipvs/ip_vs_ctl.c: drop argument range check just before the check for equality

Hello,

On Tue, 22 Jul 2014, Dan Carpenter wrote:

> 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.

I'll change it to >= 256, to catch that we can
not hold such big size in unsigned char [gs]et_arglen and
also as an indication that we have to use allocated buffer
instead of stack.

> > - 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).

For now both set and get are privileged operations,
so we can keep it, it can catch if something wrong happens
with the structure sizes.

Regards

--
Julian Anastasov <ja@ssi.bg>


\
 
 \ /
  Last update: 2014-07-22 11:41    [W:0.047 / U:0.936 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site