tcp: Fix race in tcp_poll
commit898e8970e487714b1014fa40f07d0fde3e5a2e6c
authorTom Marshall <tdm.code@gmail.com>
Mon, 20 Sep 2010 22:42:05 +0000 (20 15:42 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 29 Oct 2010 04:44:09 +0000 (28 21:44 -0700)
tree4bc1cd003081e31dffb8ac71e8102ecc977cb220
parent3765ba02027246e3a709990cda1b95d031e87404
tcp: Fix race in tcp_poll

[ Upstream commit a4d258036ed9b2a1811c3670c6099203a0f284a0 ]

If a RST comes in immediately after checking sk->sk_err, tcp_poll will
return POLLIN but not POLLOUT.  Fix this by checking sk->sk_err at the end
of tcp_poll.  Additionally, ensure the correct order of operations on SMP
machines with memory barriers.

Signed-off-by: Tom Marshall <tdm.code@gmail.com>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
net/ipv4/tcp.c
net/ipv4/tcp_input.c