]> www.infradead.org Git - users/willy/xarray.git/commit
tcp: fix races in tcp_v[46]_err()
authorEric Dumazet <edumazet@google.com>
Tue, 28 May 2024 12:52:53 +0000 (12:52 +0000)
committerJakub Kicinski <kuba@kernel.org>
Thu, 30 May 2024 00:21:36 +0000 (17:21 -0700)
commitfde6f897f2a184546bf5516ac736523ef24dc6a7
treefc8014baaf67f7eb33fa5249a7c068a43438c7cc
parent5ce4645c23cf5f048eb8e9ce49e514bababdee85
tcp: fix races in tcp_v[46]_err()

These functions have races when they:

1) Write sk->sk_err
2) call sk_error_report(sk)
3) call tcp_done(sk)

As described in prior patches in this series:

An smp_wmb() is missing.
We should call tcp_done() before sk_error_report(sk)
to have consistent tcp_poll() results on SMP hosts.

Use tcp_done_with_error() where we centralized the
correct sequence.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Link: https://lore.kernel.org/r/20240528125253.1966136-5-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv4/tcp_ipv4.c
net/ipv6/tcp_ipv6.c