Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp481412imn; Wed, 27 Jul 2022 11:24:41 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sTq25pfVqaFp5r2HYPr5cIoCLRLts3XqO290OIMehB2BrdP6oUWAcuBGybQxAHkRrmtA7b X-Received: by 2002:a17:907:a061:b0:72f:1dde:fac0 with SMTP id ia1-20020a170907a06100b0072f1ddefac0mr18207171ejc.310.1658946281079; Wed, 27 Jul 2022 11:24:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658946281; cv=none; d=google.com; s=arc-20160816; b=r/vYEenZZia8gkO7bXayMMfDB4BAOxgm7WXnSgSmZOnkUmBjT275CY1JC7APHP0PV2 FiDbc4fa/wLTH1sfXCz5SSR3G/MXL1bBnapVME+u580vKgKQ2TPwDW5winqLHoqxzUeu aHRIIWUSofxXOj+FRd0cKWAWPOcqBc67uGcrVuyd7qdgHhyNw2brV2fgX2AVAs0TPbXA JcPRHMBc0YvfX5ocNMhkReyKzSU3s0LkfCdYnVPfVeGOB33csttw2zMcecmXeJpuxlZM X7Sv5uDOf/y7feN30CyoKPSfedb/gt3DgZFXkmJGUK6J2fWCNuuA8BFyXgoOxrA+rcIG 8PQw== 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=f7StramoSrj1WNhjvM4h7d5KHo6wKdQjzIeOyFmekIE=; b=UFK2Q44eI6x1yWUNqi+ypXQmaYHovfsLaoz2nbCRGDw+tCpl45mgRkmJZC9EqYpkIx NG+nJ6Xn/FttoqXFpG2Olf6BajMAoxiGZ047WIqfTRnuRCqGuRjwVCSub0nr9XquxE+/ GC09K2miQVG0Ytr02v3K0OrfwM4Ba3k2mg2s7QaBwokZrf3JNuT4zNXopXKc2EyLQtLh 8pRnG4bIYuvITgoSV1+mz6JjtwBWFAZ4qLa/aAsVdvlcCiIIjAR/0F2BCoidrkJ3zl8B T7ed7UIXWHQL7EnjrjgSuiyBphiicTW3yMas/VFJXa2q3JI1cYSDLOdpOrTWhZe6pPA+ ae/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bK1Gstok; 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 ji10-20020a170907980a00b00726d5d59195si16446323ejc.674.2022.07.27.11.24.16; Wed, 27 Jul 2022 11:24:41 -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=bK1Gstok; 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 S240399AbiG0QqC (ORCPT + 99 others); Wed, 27 Jul 2022 12:46:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240509AbiG0Qob (ORCPT ); Wed, 27 Jul 2022 12:44:31 -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 855635F110; Wed, 27 Jul 2022 09:31:15 -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 0363061A39; Wed, 27 Jul 2022 16:31:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08706C433D6; Wed, 27 Jul 2022 16:31:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658939474; bh=13RiAq2LeTI+XWlG9cn39gAKHDTZwrE6XL+Hm4O2hfQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bK1Gstok0x80cb0cV+h4UvYH8bA9TJBqmDZH17rvnGWtzDpdoS++Voyw8rjUfFRPV NPRVJTWQ0llNDdMLcbIaYzJoMVvMRhPvCBo3PuY9FVow95YAPvQesnvmcpHWI1hO4F vHwFCCqoMzG9Q1SORn9krK/3MwNqS1e+qRmnbA3Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.4 51/87] tcp: Fix a data-race around sysctl_tcp_retrans_collapse. Date: Wed, 27 Jul 2022 18:10:44 +0200 Message-Id: <20220727161011.138419746@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727161008.993711844@linuxfoundation.org> References: <20220727161008.993711844@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 [ Upstream commit 1a63cb91f0c2fcdeced6d6edee8d1d886583d139 ] While reading sysctl_tcp_retrans_collapse, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv4/tcp_output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 5d9a1a498a18..97f29ece3800 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -2871,7 +2871,7 @@ static void tcp_retrans_try_collapse(struct sock *sk, struct sk_buff *to, struct sk_buff *skb = to, *tmp; bool first = true; - if (!sock_net(sk)->ipv4.sysctl_tcp_retrans_collapse) + if (!READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_retrans_collapse)) return; if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_SYN) return; -- 2.35.1