Skip to content

Commit

Permalink
tcp: fix access to sk->sk_state in tcp_poll()
Browse files Browse the repository at this point in the history
avoid direct access to sk->sk_state when tcp_poll() is called on a socket
using active TCP fastopen with deferred connect. Use local variable
'state', which stores the result of sk_state_load(), like it was done in
commit 00fd38d ("tcp: ensure proper barriers in lockless contexts").

Fixes: 19f6d3f ("net/tcp-fastopen: Add new API support")
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Acked-by: Wei Wang <weiwan@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Davide Caratti authored and David S. Miller committed May 1, 2017
1 parent d1f496f commit d68be71
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/ipv4/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ unsigned int tcp_poll(struct file *file, struct socket *sock, poll_table *wait)

if (tp->urg_data & TCP_URG_VALID)
mask |= POLLPRI;
} else if (sk->sk_state == TCP_SYN_SENT && inet_sk(sk)->defer_connect) {
} else if (state == TCP_SYN_SENT && inet_sk(sk)->defer_connect) {
/* Active TCP fastopen socket with defer_connect
* Return POLLOUT so application can call write()
* in order for kernel to generate SYN+data
Expand Down

0 comments on commit d68be71

Please sign in to comment.