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 5A821369D67; Wed, 20 May 2026 17:43:58 +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=1779299039; cv=none; b=usGCwqc50AGZkA1ozZszyHU6kwGZixo5R7SlwPPEE14ESljQEmuiaY4lolxiSPis2iYYTm8U5mHnZk9mHP9u62ljl4AW3o3nUBUZ+Vv35Fwog5DYk6qgGKL1E+N0hP4g2thTqPXbw5Vl8RdhJAGTpBAnP/VuUz8YBIjYmmGFzPE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779299039; c=relaxed/simple; bh=e1slj34NT5yoLZEGsHlXsHv/PNqK6Zd5TFuONa0p/aU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XndRRxAjpEzFyTz6rPuYlWiMA6jx7bS1Ll0DIFhEoqJQQ7XkECfaFgPmykyUkG5/11urUCmGqUHx87A4W0w12Emm2LtEF672jIvgq/0mXHgmfh9KhJ/VSFIExb9wkw2x91tPGE1jAtOgz4ixSO+yurqiRy4XhTENLLKxK+FKn10= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=vKCbQZPX; 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="vKCbQZPX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C04581F000E9; Wed, 20 May 2026 17:43:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779299038; bh=Xgx94cNeBpkcyVakK3hsQWz4avyWoyM0GKHtA2idNeU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=vKCbQZPXO4Z5J3yveINfBvL2JIrUlw54lbMJJV9xtcUdCDq8XVlZyK7csqU/OKNAs wJyKZ7s58VVK5qZxO5q5O9gixpoAbmOGQlN9EFZ/ABG2+U9Kr9YSSBSSbBWTAb+94L Yf1x2qRYGlwsFZPFx6EY/pt/rTkui2qSetGlkXnc= 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.18 639/957] tcp: annotate data-races around tp->dsack_dups Date: Wed, 20 May 2026 18:18:42 +0200 Message-ID: <20260520162148.387302226@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520162134.554764788@linuxfoundation.org> References: <20260520162134.554764788@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.18-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 35c444caab8a8..3a5801ba3df1a 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -4417,7 +4417,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 3e29134a54b19..90727e1e581e4 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -1213,7 +1213,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