ipv6: inet6_sk() should use sk_fullsock()
authorEric Dumazet <edumazet@google.com>
Mon, 5 Oct 2015 04:08:09 +0000 (21:08 -0700)
committerHuang, Tao <huangtao@rock-chips.com>
Tue, 27 Oct 2015 09:14:21 +0000 (17:14 +0800)
SYN_RECV & TIMEWAIT sockets are not full blown, they do not have a pinet6
pointer.

Bug: 24163529
Change-Id: I6ce67a190d67d200c6ebeb81d2daeb9c86cd7581
Fixes: ca6fb0651883 ("tcp: attach SYNACK messages to request sockets instead of listener")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
(cherry picked from commit feee3c175c23ae72ed17154caaa82a3002de0023)

include/linux/ipv6.h

index c4a36ab46cd5e5e088d1fdf28f44193df7f9fc72..5fabaa47574be6d6540da9a33d61b99af03b8206 100644 (file)
@@ -273,9 +273,9 @@ static inline struct inet6_timewait_sock *inet6_twsk(const struct sock *sk)
 }
 
 #if IS_ENABLED(CONFIG_IPV6)
-static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk)
+static inline struct ipv6_pinfo *inet6_sk(const struct sock *__sk)
 {
-       return inet_sk(__sk)->pinet6;
+       return sk_fullsock(__sk) ? inet_sk(__sk)->pinet6 : NULL;
 }
 
 static inline struct inet6_request_sock *