]> git.baikalelectronics.ru Git - kernel.git/commit
tcp: fastopen: tcp_connect() must refresh the route
authorEric Dumazet <edumazet@google.com>
Tue, 8 Aug 2017 08:41:58 +0000 (01:41 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 9 Aug 2017 03:39:52 +0000 (20:39 -0700)
commit6986c92861aac97fc98eabb83ed260a20f081889
tree936eba4cb998c96ebaaf92b1069f0e0ced39093d
parent61ea2c48761a85d0f13e86057e33c2ee6ebe96b7
tcp: fastopen: tcp_connect() must refresh the route

With new TCP_FASTOPEN_CONNECT socket option, there is a possibility
to call tcp_connect() while socket sk_dst_cache is either NULL
or invalid.

 +0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 4
 +0 fcntl(4, F_SETFL, O_RDWR|O_NONBLOCK) = 0
 +0 setsockopt(4, SOL_TCP, TCP_FASTOPEN_CONNECT, [1], 4) = 0
 +0 connect(4, ..., ...) = 0

<< sk->sk_dst_cache becomes obsolete, or even set to NULL >>

 +1 sendto(4, ..., 1000, MSG_FASTOPEN, ..., ...) = 1000

We need to refresh the route otherwise bad things can happen,
especially when syzkaller is running on the host :/

Fixes: 2629f61e43482 ("net/tcp-fastopen: Add new API support")
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Wei Wang <weiwan@google.com>
Cc: Yuchung Cheng <ycheng@google.com>
Acked-by: Wei Wang <weiwan@google.com>
Acked-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp_output.c