Skip to content

Commit f668f5f

Browse files
edumazetdavem330
authored andcommitted
ipv4: use sk_fullsock() in ipv4_conntrack_defrag()
Before converting a 'socket pointer' into inet socket, use sk_fullsock() to detect timewait or request sockets. Fixes: ca6fb06 ("tcp: attach SYNACK messages to request sockets instead of listener") Signed-off-by: Eric Dumazet <[email protected]> Reported-by: Dmitry Vyukov <[email protected]> Tested-by: Dmitry Vyukov <[email protected]> Cc: Pablo Neira Ayuso <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 805c4bc commit f668f5f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

net/ipv4/netfilter/nf_defrag_ipv4.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,9 @@ static unsigned int ipv4_conntrack_defrag(void *priv,
6767
const struct nf_hook_state *state)
6868
{
6969
struct sock *sk = skb->sk;
70-
struct inet_sock *inet = inet_sk(skb->sk);
7170

72-
if (sk && (sk->sk_family == PF_INET) &&
73-
inet->nodefrag)
71+
if (sk && sk_fullsock(sk) && (sk->sk_family == PF_INET) &&
72+
inet_sk(sk)->nodefrag)
7473
return NF_ACCEPT;
7574

7675
#if IS_ENABLED(CONFIG_NF_CONNTRACK)

0 commit comments

Comments
 (0)