diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv6/ipv6_sockglue.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index 286c86735aed..4e0561a082d0 100644 --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c | |||
@@ -795,11 +795,15 @@ int compat_ipv6_setsockopt(struct sock *sk, int level, int optname, | |||
795 | EXPORT_SYMBOL(compat_ipv6_setsockopt); | 795 | EXPORT_SYMBOL(compat_ipv6_setsockopt); |
796 | #endif | 796 | #endif |
797 | 797 | ||
798 | static int ipv6_getsockopt_sticky(struct sock *sk, struct ipv6_opt_hdr *hdr, | 798 | static int ipv6_getsockopt_sticky(struct sock *sk, struct ipv6_txoptions *opt, |
799 | char __user *optval, int len) | 799 | char __user *optval, int len) |
800 | { | 800 | { |
801 | if (!hdr) | 801 | struct ipv6_opt_hdr *hdr; |
802 | |||
803 | if (!opt || !opt->hopopt) | ||
802 | return 0; | 804 | return 0; |
805 | hdr = opt->hopopt; | ||
806 | |||
803 | len = min_t(int, len, ipv6_optlen(hdr)); | 807 | len = min_t(int, len, ipv6_optlen(hdr)); |
804 | if (copy_to_user(optval, hdr, ipv6_optlen(hdr))) | 808 | if (copy_to_user(optval, hdr, ipv6_optlen(hdr))) |
805 | return -EFAULT; | 809 | return -EFAULT; |
@@ -940,7 +944,7 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname, | |||
940 | { | 944 | { |
941 | 945 | ||
942 | lock_sock(sk); | 946 | lock_sock(sk); |
943 | len = ipv6_getsockopt_sticky(sk, np->opt->hopopt, | 947 | len = ipv6_getsockopt_sticky(sk, np->opt, |
944 | optval, len); | 948 | optval, len); |
945 | release_sock(sk); | 949 | release_sock(sk); |
946 | return put_user(len, optlen); | 950 | return put_user(len, optlen); |