Commit 348b81b6 authored by Eric Dumazet's avatar Eric Dumazet Committed by Jakub Kicinski

tcp: annotate data-races around tp->tcp_tx_delay

do_tcp_getsockopt() reads tp->tcp_tx_delay while another cpu
might change its value.

Fixes: a842fe14 ("tcp: add optional per socket transmit delay")
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/20230719212857.3943972-2-edumazet@google.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent ac528649
...@@ -3674,7 +3674,7 @@ int do_tcp_setsockopt(struct sock *sk, int level, int optname, ...@@ -3674,7 +3674,7 @@ int do_tcp_setsockopt(struct sock *sk, int level, int optname,
case TCP_TX_DELAY: case TCP_TX_DELAY:
if (val) if (val)
tcp_enable_tx_delay(); tcp_enable_tx_delay();
tp->tcp_tx_delay = val; WRITE_ONCE(tp->tcp_tx_delay, val);
break; break;
default: default:
err = -ENOPROTOOPT; err = -ENOPROTOOPT;
...@@ -4154,7 +4154,7 @@ int do_tcp_getsockopt(struct sock *sk, int level, ...@@ -4154,7 +4154,7 @@ int do_tcp_getsockopt(struct sock *sk, int level,
break; break;
case TCP_TX_DELAY: case TCP_TX_DELAY:
val = tp->tcp_tx_delay; val = READ_ONCE(tp->tcp_tx_delay);
break; break;
case TCP_TIMESTAMP: case TCP_TIMESTAMP:
......
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