diff options
author | Eric Dumazet <edumazet@google.com> | 2024-08-27 01:52:49 +0000 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2024-08-28 17:08:16 -0700 |
commit | 3e5cbbb1fb9a64588a2c6ddc5e432a303d36a488 (patch) | |
tree | 8efed836d67b210fa4edf00c60f494fb8380d4b8 /net/ipv4/tcp_ipv4.c | |
parent | 0fa5e94a1811d68fbffa0725efe6d4ca62c03d12 (diff) | |
download | linux-3e5cbbb1fb9a64588a2c6ddc5e432a303d36a488.tar.gz linux-3e5cbbb1fb9a64588a2c6ddc5e432a303d36a488.tar.bz2 linux-3e5cbbb1fb9a64588a2c6ddc5e432a303d36a488.zip |
tcp: remove volatile qualifier on tw_substate
Using a volatile qualifier for a specific struct field is unusual.
Use instead READ_ONCE()/WRITE_ONCE() where necessary.
tcp_timewait_state_process() can change tw_substate while other
threads are reading this field.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Jason Xing <kerneljasonxing@gmail.com>
Link: https://patch.msgid.link/20240827015250.3509197-2-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/ipv4/tcp_ipv4.c')
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 5087e12209a1..7c29158e1abc 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -120,7 +120,7 @@ int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp) struct tcp_sock *tp = tcp_sk(sk); int ts_recent_stamp; - if (tw->tw_substate == TCP_FIN_WAIT2) + if (READ_ONCE(tw->tw_substate) == TCP_FIN_WAIT2) reuse = 0; if (reuse == 2) { @@ -2948,7 +2948,7 @@ static void get_timewait4_sock(const struct inet_timewait_sock *tw, seq_printf(f, "%4d: %08X:%04X %08X:%04X" " %02X %08X:%08X %02X:%08lX %08X %5d %8d %d %d %pK", - i, src, srcp, dest, destp, tw->tw_substate, 0, 0, + i, src, srcp, dest, destp, READ_ONCE(tw->tw_substate), 0, 0, 3, jiffies_delta_to_clock_t(delta), 0, 0, 0, 0, refcount_read(&tw->tw_refcnt), tw); } |