ipv6: inet6_sk() should use sk_fullsock()
authorEric Dumazet <edumazet@google.com>
Mon, 5 Oct 2015 04:08:09 +0000 (21:08 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 5 Oct 2015 09:45:25 +0000 (02:45 -0700)
SYN_RECV & TIMEWAIT sockets are not full blown, they do not have a pinet6
pointer.

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>
include/linux/ipv6.h

index f1f32af6d9b96c8d21f55fe6e875673c15e0eab2..0ef2a97ccdb50bc83baaf727f37d2fa034eea036 100644 (file)
@@ -264,9 +264,9 @@ struct tcp6_timewait_sock {
 };
 
 #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 raw6_sock *raw6_sk(const struct sock *sk)