]> git.karo-electronics.de Git - karo-tx-linux.git/commit
tcp: fix fastopen races vs lockless listener
authorEric Dumazet <edumazet@google.com>
Mon, 5 Oct 2015 04:08:07 +0000 (21:08 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 5 Oct 2015 09:45:24 +0000 (02:45 -0700)
commit7656d842de93fd2d2de7b403062cad757cadf1df
treeca3dd9409538fcb415d5e7166269a0e6e89b26b1
parent3e087caa23ef36370bfb925d3bbca78e8302d3ce
tcp: fix fastopen races vs lockless listener

There are multiple races that need fixes :

1) skb_get() + queue skb + kfree_skb() is racy

An accept() can be done on another cpu, data consumed immediately.
tcp_recvmsg() uses __kfree_skb() as it is assumed all skb found in
socket receive queue are private.

Then the kfree_skb() in tcp_rcv_state_process() uses an already freed skb

2) tcp_reqsk_record_syn() needs to be done before tcp_try_fastopen()
for the same reasons.

3) We want to send the SYNACK before queueing child into accept queue,
otherwise we might reintroduce the ooo issue fixed in
commit 7c85af881044 ("tcp: avoid reorders for TFO passive connections")

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp_fastopen.c
net/ipv4/tcp_input.c