From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 32D00405C2B; Wed, 20 May 2026 18:42:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779302571; cv=none; b=ckjBxRArOcGziv/PPYcnQwFTIZDHo2OEsZ/YMKqEC3Pw9Bt0yZwBY6LjTkPtRBj7VqPQG1EveHkV2k3GeQiPGq577/lBXAh9EIoZN9N9Du+2n97jXXFZCbepuyEIYyCEKk98Avp3JjwtDSdT5+G5DE2KVw8pT2b0RLkwZYJv3Ig= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779302571; c=relaxed/simple; bh=/FjoGGaBbY8wDXyHcQKGQRSWzhpYynhYAi9MHqrXTao=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uJ856nmzSwL6s7BB8lfzD3YE71I0BIQDxvrZJouz+afQRZC/zWUTl3/URtEyDrwEpGSkENAJqHASGCz/qU31p3rk0Y0FHiSpnUYdgM2fB7m/JnZT52aiU6LG8cWTh5trPCRI/s3zt2QnnWA+Jh7R+Ibf8dw3jVj3kcIbrNynerg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=LdAlIF0o; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="LdAlIF0o" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 786601F000E9; Wed, 20 May 2026 18:42:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779302570; bh=WRicJ7dpmMNyWz+V164XOTS9ABJx6X2G/tsNWZggDls=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=LdAlIF0opHBTprtTCoyHpQUcDsjmfSpAehtjr12ctRz/0R2zZEkZeAy39hTg/D1Ua rW1MFaTxRcm6LDdpKJxLeupMwass63itD8CPOTvz0dPwcSQJrOltrtloe15GcG5M3r rQf5L//mWEM8aFsoIF8H6ma8xOBMPoSs0kEBUilY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Eric Dumazet , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.6 318/508] tcp: annotate data-races around tp->dsack_dups Date: Wed, 20 May 2026 18:22:21 +0200 Message-ID: <20260520162105.527427405@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520162058.573354582@linuxfoundation.org> References: <20260520162058.573354582@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet [ Upstream commit a984705ca88b976bf1087978fd98b7f3993da88c ] tcp_get_timestamping_opt_stats() intentionally runs lockless, we must add READ_ONCE() and WRITE_ONCE() annotations to keep KCSAN happy. Fixes: 7e10b6554ff2 ("tcp: add dsack blocks received stats") Signed-off-by: Eric Dumazet Link: https://patch.msgid.link/20260416200319.3608680-10-edumazet@google.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/ipv4/tcp.c | 2 +- net/ipv4/tcp_input.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 2ab4b8f4d8d10..51e71407f4b89 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -3990,7 +3990,7 @@ struct sk_buff *tcp_get_timestamping_opt_stats(const struct sock *sk, TCP_NLA_PAD); nla_put_u64_64bit(stats, TCP_NLA_BYTES_RETRANS, READ_ONCE(tp->bytes_retrans), TCP_NLA_PAD); - nla_put_u32(stats, TCP_NLA_DSACK_DUPS, tp->dsack_dups); + nla_put_u32(stats, TCP_NLA_DSACK_DUPS, READ_ONCE(tp->dsack_dups)); nla_put_u32(stats, TCP_NLA_REORD_SEEN, tp->reord_seen); nla_put_u32(stats, TCP_NLA_SRTT, tp->srtt_us >> 3); nla_put_u16(stats, TCP_NLA_TIMEOUT_REHASH, tp->timeout_rehash); diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 359d36be04829..eb1bf58634741 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -1041,7 +1041,7 @@ static u32 tcp_dsack_seen(struct tcp_sock *tp, u32 start_seq, else if (tp->tlp_high_seq && tp->tlp_high_seq == end_seq) state->flag |= FLAG_DSACK_TLP; - tp->dsack_dups += dup_segs; + WRITE_ONCE(tp->dsack_dups, tp->dsack_dups + dup_segs); /* Skip the DSACK if dup segs weren't retransmitted by sender */ if (tp->dsack_dups > tp->total_retrans) return 0; -- 2.53.0