Commit e5268f12 authored by YOSHIFUJI Hideaki's avatar YOSHIFUJI Hideaki Committed by David S. Miller

[IPV6]: Ensure to truncate result and return full length for sticky options.

Bug noticed by Chris Wright <chrisw@sous-sol.org>.
Signed-off-by: default avatarYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4c6510a7
...@@ -825,9 +825,9 @@ static int ipv6_getsockopt_sticky(struct sock *sk, struct ipv6_txoptions *opt, ...@@ -825,9 +825,9 @@ static int ipv6_getsockopt_sticky(struct sock *sk, struct ipv6_txoptions *opt,
return 0; return 0;
len = min_t(unsigned int, len, ipv6_optlen(hdr)); 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 -EFAULT;
return len; return ipv6_optlen(hdr);
} }
static int do_ipv6_getsockopt(struct sock *sk, int level, int optname, static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment