diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2007-03-07 15:50:46 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-03-07 19:08:05 -0500 |
commit | 286930797d74b2c9a5beae84836044f6a836235f (patch) | |
tree | 95a12839a1ff2eb82914a20556ed6f7d614a9490 /net/ipv6 | |
parent | d644329bc9f10213a282387dfe4984ff891dd768 (diff) |
[IPV6]: Handle np->opt being NULL in ipv6_getsockopt_sticky().
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-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); |