]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[IPV6]: Ensure to truncate result and return full length for sticky options.
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Fri, 9 Mar 2007 04:48:23 +0000 (20:48 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 26 Apr 2007 05:24:17 +0000 (22:24 -0700)
Bug noticed by Chris Wright <chrisw@sous-sol.org>.

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/ipv6_sockglue.c

index eceed09e434d9d183c648a06df8b128181f490fe..1d56b465bddb761bd080fe34818b272f5ec664f6 100644 (file)
@@ -825,9 +825,9 @@ static int ipv6_getsockopt_sticky(struct sock *sk, struct ipv6_txoptions *opt,
                return 0;
 
        len = min_t(unsigned int, len, ipv6_optlen(hdr));
-       if (copy_to_user(optval, hdr, ipv6_optlen(hdr)))
+       if (copy_to_user(optval, hdr, len));
                return -EFAULT;
-       return len;
+       return ipv6_optlen(hdr);
 }
 
 static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,