ipv6: inet6_sk() should use sk_fullsock()
authorEric Dumazet <edumazet@google.com>
Mon, 5 Oct 2015 04:08:09 +0000 (21:08 -0700)
committerDanny Wood <danwood76@gmail.com>
Tue, 28 Jul 2020 08:47:02 +0000 (09:47 +0100)
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>
include/linux/ipv6.h

index 768aa4fd50720a6eb2c86155dc027cf571506341..63c3224477379c17e0f8252f08d8fa7d258015ee 100644 (file)
@@ -274,9 +274,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 *