Commit fe8bdc9b authored by Jason Baron's avatar Jason Baron Committed by Greg Kroah-Hartman

tcp: correct memory barrier usage in tcp_check_space()


[ Upstream commit 56d80622 ]

sock_reset_flag() maps to __clear_bit() not the atomic version clear_bit().
Thus, we need smp_mb(), smp_mb__after_atomic() is not sufficient.

Fixes: 3c715127 ("tcp: add memory barriers to write space paths")
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: default avatarJason Baron <jbaron@akamai.com>
Acked-by: default avatarEric Dumazet <edumazet@google.com>
Reported-by: default avatarOleg Nesterov <oleg@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 49c3164e
...@@ -5081,7 +5081,7 @@ static void tcp_check_space(struct sock *sk) ...@@ -5081,7 +5081,7 @@ static void tcp_check_space(struct sock *sk)
if (sock_flag(sk, SOCK_QUEUE_SHRUNK)) { if (sock_flag(sk, SOCK_QUEUE_SHRUNK)) {
sock_reset_flag(sk, SOCK_QUEUE_SHRUNK); sock_reset_flag(sk, SOCK_QUEUE_SHRUNK);
/* pairs with tcp_poll() */ /* pairs with tcp_poll() */
smp_mb__after_atomic(); smp_mb();
if (sk->sk_socket && if (sk->sk_socket &&
test_bit(SOCK_NOSPACE, &sk->sk_socket->flags)) test_bit(SOCK_NOSPACE, &sk->sk_socket->flags))
tcp_new_space(sk); tcp_new_space(sk);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment