From: Chris Wright Date: Sat, 10 Mar 2007 00:19:17 +0000 (-0800) Subject: [IPV6] fix ipv6_getsockopt_sticky copy_to_user leak X-Git-Tag: v2.6.21-rc4~50^2 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d2b02ed9487ed25832d19534575052e43f8e0c4f;p=linux-2.6 [IPV6] fix ipv6_getsockopt_sticky copy_to_user leak User supplied len < 0 can cause leak of kernel memory. Use unsigned compare instead. Signed-off-by: Chris Wright Signed-off-by: David S. Miller --- diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index b82333b922..f5f9582a8d 100644 --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c @@ -804,7 +804,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;