Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp484990imn; Wed, 27 Jul 2022 11:30:35 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uMB8zwWDoKLQx7T/BxM6yJOeZDLUwkQrP6hzAHzepRTiRQMElaEY4opYgdY22vLAS7TU5J X-Received: by 2002:a63:c1f:0:b0:41a:9b73:a89e with SMTP id b31-20020a630c1f000000b0041a9b73a89emr19233538pgl.342.1658946635357; Wed, 27 Jul 2022 11:30:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658946635; cv=none; d=google.com; s=arc-20160816; b=iZxGKx4bv1bU7OUDvSzJAImfqFL8OM1SxwUxZK5lggHCqMR+U2O4ZN0ok7pinafZMW ZuVJsDfl7oBprM3GaJJcTfKtHFYJglRvE/X5IZgKZTK7zY9b8ewuFiMs7Ire2JsHTS9/ r5j1Qf368cZT4Tl0OLiA4rqSw7uxa5bM8bF8BvmF+PFZw2TFD+Yeo1bayWW0cei7YkXt pNlbg9497hjxriX3DUxutG8Oe+IW0YdbrvocsISInxvE2iUV14Xwt+f90uCekZz52lBq VCxRgWFKXpoW9MK7ZgDBF6W9GzOqKSwcjJoLD6yMofGZ0zXqRKEU6ryYJnt4klSfjIf9 5feQ== 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=cSTsr0YOWNoiBAxUY81OGvDe0GBIM8+3k95GV0/Vzhg=; b=c8JHu8i+rTalYGMZAGaEIq2ak9GrhyZJUogpV8tQyW92E+srSko1unPeTKYjx2VZQQ DFuD9touJ/BH+cGWh/XH7rkWQ+njpeNuQX5Gs4G7Z7da4YGADiWr5Yn0KePI/RifUS1X 7R1QHIdopa+5LUmbjj0jeAhMTAUnh6ipCWqVkeabPAZLlBXbor+hg6vcKMEmLtbj8owe hOoSy3v3XfZzKuMoICM0mkMv6uy3lMWy8Oazl2QVCWe8UN184OTC23zN/4hGBm9ZVMjP MRtdBCsdmGQGDKwT7/wMD/aow+TiZmm31H/vEIr93HIkr17+s0m2cNWIwSaIPLdrJunL 8vFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RyhA2VrY; 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 d14-20020a056a00244e00b0052bcb076b9esi9020127pfj.68.2022.07.27.11.30.17; Wed, 27 Jul 2022 11:30:35 -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=RyhA2VrY; 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 S237806AbiG0Qcy (ORCPT + 99 others); Wed, 27 Jul 2022 12:32:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237685AbiG0QcY (ORCPT ); Wed, 27 Jul 2022 12:32:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 390004E868; Wed, 27 Jul 2022 09:26:12 -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 ams.source.kernel.org (Postfix) with ESMTPS id 359ABB821BC; Wed, 27 Jul 2022 16:25:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 943BFC433C1; Wed, 27 Jul 2022 16:25:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658939145; bh=GH8X8H40DZmlNZYLKIumjz4WqGqR3FFDqpyqZxYZORs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RyhA2VrYkeIvDfsc5SVs4xizTr50k2baTSKCDWOl/p6P3RwHv8LN8GLYPq+E6xYNa 8tnPvFd5pL0q3fKQHKvIDKwfBLGCRPxakWhZqXcHWsgq09LvcwA9gtp3YuLSt0BaS9 nLuOtXmzoLe13zMImDiSVVEw3o99AnNPyhSYKlGU= 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 4.19 29/62] tcp: Fix a data-race around sysctl_tcp_retrans_collapse. Date: Wed, 27 Jul 2022 18:10:38 +0200 Message-Id: <20220727161005.350741940@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727161004.175638564@linuxfoundation.org> References: <20220727161004.175638564@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 3b416dfb8aff..13d9e8570ce5 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -2816,7 +2816,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