* [PATCH net] tcp: fix access to sk->sk_state in tcp_poll()
@ 2017-04-26 17:07 Davide Caratti
2017-04-26 17:24 ` Wei Wang
2017-05-01 2:25 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Davide Caratti @ 2017-04-26 17:07 UTC (permalink / raw)
To: David S. Miller, Alexey Kuznetsov, James Morris,
Hideaki YOSHIFUJI, Patrick McHardy, Wei Wang
Cc: netdev
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 00fd38d938db ("tcp: ensure proper barriers in lockless contexts").
Fixes: 19f6d3f3c842 ("net/tcp-fastopen: Add new API support")
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
---
net/ipv4/tcp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 40ba424..2dc7fcf 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -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
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] tcp: fix access to sk->sk_state in tcp_poll()
2017-04-26 17:07 [PATCH net] tcp: fix access to sk->sk_state in tcp_poll() Davide Caratti
@ 2017-04-26 17:24 ` Wei Wang
2017-05-01 2:25 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Wei Wang @ 2017-04-26 17:24 UTC (permalink / raw)
To: Davide Caratti
Cc: David S. Miller, Alexey Kuznetsov, James Morris,
Hideaki YOSHIFUJI, Patrick McHardy,
Linux Kernel Network Developers
On Wed, Apr 26, 2017 at 10:07 AM, Davide Caratti <dcaratti@redhat.com> wrote:
> 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 00fd38d938db ("tcp: ensure proper barriers in lockless contexts").
>
> Fixes: 19f6d3f3c842 ("net/tcp-fastopen: Add new API support")
> Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Acked-by: Wei Wang <weiwan@google.com>
Thanks for the fix.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] tcp: fix access to sk->sk_state in tcp_poll()
2017-04-26 17:07 [PATCH net] tcp: fix access to sk->sk_state in tcp_poll() Davide Caratti
2017-04-26 17:24 ` Wei Wang
@ 2017-05-01 2:25 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-05-01 2:25 UTC (permalink / raw)
To: dcaratti; +Cc: kuznet, jmorris, yoshfuji, kaber, weiwan, netdev
From: Davide Caratti <dcaratti@redhat.com>
Date: Wed, 26 Apr 2017 19:07:35 +0200
> 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 00fd38d938db ("tcp: ensure proper barriers in lockless contexts").
>
> Fixes: 19f6d3f3c842 ("net/tcp-fastopen: Add new API support")
> Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-05-01 2:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-26 17:07 [PATCH net] tcp: fix access to sk->sk_state in tcp_poll() Davide Caratti
2017-04-26 17:24 ` Wei Wang
2017-05-01 2:25 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.