Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp1941576imn; Mon, 1 Aug 2022 05:51:40 -0700 (PDT) X-Google-Smtp-Source: AGRyM1urWTWbp9p3GcXHHlEtcYk2+Ympia6SJ/VyAL8U32aD5m4ioxmbWl79+kEK43MARjulwcvW X-Received: by 2002:a05:6402:54:b0:43b:5cbd:d5db with SMTP id f20-20020a056402005400b0043b5cbdd5dbmr16205182edu.264.1659358300729; Mon, 01 Aug 2022 05:51:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659358300; cv=none; d=google.com; s=arc-20160816; b=XcJGqXYYBEZI7IhXfpptmr5rUxto2yz6qhCQn+7uw+FVQtn851RDyQNV+ROluWktn5 rBmxXO1FzXI7W5RO6xd4nHqMik0R5GDMMfH3N+0Dn+0VFdBXZJ+EVTrE1B3KCZJ5kCEP 9SN7Sa6YxuLEu6LqcLOuMlt7ivR+Zj9N9ESwxaJz7SgDi6pJnGaddXyKMY/CurVob511 PJMIvCeqJdwfzv4LiN1Zc8FI+hge1o/cHBlBtuRqLpSoW1fSSu0ptSk5ENA9FJHhwt/7 yvZp+/EVElI0PSXd9LVMTxXG4yBxt3xXFOoeu2wvW3FIXlr1VBr8f90lgZAZ8krAiExv y1rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sRrOvkgt46fULWU3ntxX5fsEmP67zWiWUe/fjftiqaE=; b=mX44Bzz3+MbDP8Fgk3q8/CX96Yu1x4tlV7fc4Fm0zBaebKCUBEBezm4URIlh8OF+sF N9nQkK8Qpj3g1J9Tgod6N0TTvjx57VvntoLCzOzkzoNMxPg5k/j2MZH4m2TfiZ+jAHg5 ODLeOFaOp2/ZCjsnO37dU44V3LdgJg9A4RaDeLpGQSdXrE8e/a3kGtqA8TfQhs7wLDrc qBVJR5xkuQwGNCtaFIh9daRKEh6/oBlbkgjJ1QxHpLiPhTnEZ1VLJdxN+lVyVCVTBVFE 2ZqPSVJIE1uBakLNrijDhluVIKt+D9tGzExgbTog681qu+8i1pA9LOBP9i/eIAQ62MPh q/WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="F1l/gO7t"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sd6-20020a1709076e0600b007304ac98b24si6199045ejc.754.2022.08.01.05.51.15; Mon, 01 Aug 2022 05:51:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="F1l/gO7t"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232477AbiHALzU (ORCPT + 99 others); Mon, 1 Aug 2022 07:55:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232165AbiHALyh (ORCPT ); Mon, 1 Aug 2022 07:54:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FA983FA32; Mon, 1 Aug 2022 04:50:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AE2236122C; Mon, 1 Aug 2022 11:50:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE5B0C433C1; Mon, 1 Aug 2022 11:50:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1659354649; bh=pt2TfZyIg7ff31spjhIgIwzaw1Y+PE4L++LgNw5QyZg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F1l/gO7t6E8LVDnI0+V+he6iXVUF0EQ9VBJqO+CAgCElniyYMmNYUZET/Axxb7D6M j5glMcREhTm0/yK1m8iiYiLPA5cQ2k28WoTh1Ma+HD+QuLicrfNTRFdakJWsM9cZ+8 UdEZTtLtYqgiZTrz4PFIls7oQiQhmqwvfoX7FeRw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" Subject: [PATCH 5.10 08/65] tcp: Fix data-races around sysctl_tcp_dsack. Date: Mon, 1 Aug 2022 13:46:25 +0200 Message-Id: <20220801114134.025533208@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220801114133.641770326@linuxfoundation.org> References: <20220801114133.641770326@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kuniyuki Iwashima commit 58ebb1c8b35a8ef38cd6927431e0fa7b173a632d upstream. While reading sysctl_tcp_dsack, it can be changed concurrently. Thus, we need to add READ_ONCE() to its readers. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv4/tcp_input.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -4367,7 +4367,7 @@ static void tcp_dsack_set(struct sock *s { struct tcp_sock *tp = tcp_sk(sk); - if (tcp_is_sack(tp) && sock_net(sk)->ipv4.sysctl_tcp_dsack) { + if (tcp_is_sack(tp) && READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_dsack)) { int mib_idx; if (before(seq, tp->rcv_nxt)) @@ -4414,7 +4414,7 @@ static void tcp_send_dupack(struct sock NET_INC_STATS(sock_net(sk), LINUX_MIB_DELAYEDACKLOST); tcp_enter_quickack_mode(sk, TCP_MAX_QUICKACKS); - if (tcp_is_sack(tp) && sock_net(sk)->ipv4.sysctl_tcp_dsack) { + if (tcp_is_sack(tp) && READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_dsack)) { u32 end_seq = TCP_SKB_CB(skb)->end_seq; tcp_rcv_spurious_retrans(sk, skb);