]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[IPV6] fix ipv6_getsockopt_sticky copy_to_user leak
authorChris Wright <chrisw@sous-sol.org>
Sun, 11 Mar 2007 06:43:46 +0000 (07:43 +0100)
committerAdrian Bunk <bunk@stusta.de>
Sun, 11 Mar 2007 06:43:46 +0000 (07:43 +0100)
User supplied len < 0 can cause leak of kernel memory.
Use unsigned compare instead.

Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
net/ipv6/ipv6_sockglue.c

index 4c2a9a2e905320862d9748c877ca707798396616..0ca2526dd2e731f71ce0d3797400692e0a34dbd4 100644 (file)
@@ -640,7 +640,7 @@ static int ipv6_getsockopt_sticky(struct sock *sk, struct ipv6_txoptions *opt,
                return 0;
        hdr = opt->hopopt;
 
-       len = min_t(int, len, ipv6_optlen(hdr));
+       len = min_t(unsigned int, len, ipv6_optlen(hdr));
        if (copy_to_user(optval, hdr, ipv6_optlen(hdr)))
                return -EFAULT;
        return len;