[PATCH nf-next v2] netfilter: conntrack: Add missing modification about data-race around ct->timeout

From: Chenguang Zhao

Date: Tue Nov 18 2025 - 22:01:32 EST


struct nf_conn)->timeout can be read/written locklessly,
add READ_ONCE()/WRITE_ONCE() to prevent load/store tearing.

The patch 'commit 802a7dc5cf1b ("netfilter: conntrack: annotate
data-races around ct->timeout")'fixed it, but there was a
missing part that this patch completes it.

Fixes: 802a7dc5cf1b ("netfilter: conntrack: annotate data-races around ct->timeout")
Signed-off-by: Chenguang Zhao <zhaochenguang@xxxxxxxxxx>
---
net/netfilter/nf_conntrack_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 344f88295976..df4426adc9c8 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -1297,7 +1297,7 @@ __nf_conntrack_confirm(struct sk_buff *skb)
/* Timeout is relative to confirmation time, not original
setting time, otherwise we'd get timer wrap in
weird delay cases. */
- ct->timeout += nfct_time_stamp;
+ WRITE_ONCE(ct->timeout, READ_ONCE(ct->timeout) + nfct_time_stamp);

__nf_conntrack_insert_prepare(ct);

--
2.25.1