Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp1942108imn; Mon, 1 Aug 2022 05:52:27 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sdWV6S7yTh3es+629VbNh5r12TCqKAcTGIIdtXEAXMNDS0T1/syVz9DnLfaWocC4986dJD X-Received: by 2002:a17:906:ef8c:b0:72e:dd32:4163 with SMTP id ze12-20020a170906ef8c00b0072edd324163mr12573185ejb.430.1659358346997; Mon, 01 Aug 2022 05:52:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659358346; cv=none; d=google.com; s=arc-20160816; b=ySW8lnWB5AN4uTK5PUhxsVi+6w3JGcTf7himlZKy0pQd+WeN1fJVwlYt1o2KE85HQM aphJA30VTqxleA0nALqQRdQIgc6Ks+Q1aUTy9+Hv799/7auaILelZqiZVpui+sSfE5yZ 3OQP5OU/HWnwViouHOIE3Sa1LOrK6wOZKXfwPQizmIaNigtUvvvxEDswWJKmsR0HU9F/ z+TT7dHyf5sLBtmH+zpuboHzIg3W9kd1CpsG/sADSqdAet3PI4CX7T3jnM/6Uw/b+Ugr 8BFaCodECe4l1bIvKk+tKgR+pMKACQYWVBN8xVtyehL0hDZDShDIfFgw4yAyrtLIEaK4 4zAA== 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=dGIny0qavRQq7rtf8zY4HGQCzWSAE0JLbJlLhw59kbg=; b=WfcqD/4OcNCkIkZE+0bQwtmM9Q4v2BcINf8ZSy7wbODGpwD8dY8TY66HOv6JQiIDQF fPO08WNZPACEG/TTyhOZHN3SpxRM2koKAMspXrvIlxeuYixzM67KjpFT96r+kB5r6w5i 1BN4iZ7TwKcQjG6yZ0KJuwldvcMUL0jYbJ6W6vJHt05gVl95VjjPrnHekpdav2y8Qh/B pySl6IJZNRZBa8A+lLUhUxtjFWcYYwfhR0YrTGdP4SU+2CgZt03D74DT0N23Y3n3jKQh JifcJDTiFbQpKTcpD1newmKwfSGYX6uHtA1Ve/5unV4ErMF1KUqoPFX9mwqGrfkiyeqw x3Og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yOoNykbN; 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 c11-20020a056402120b00b0043db3c4b3b8si103902edw.28.2022.08.01.05.52.01; Mon, 01 Aug 2022 05:52:26 -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=yOoNykbN; 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 S232835AbiHAL7N (ORCPT + 99 others); Mon, 1 Aug 2022 07:59:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232338AbiHAL6a (ORCPT ); Mon, 1 Aug 2022 07:58:30 -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 695A8491E8; Mon, 1 Aug 2022 04:52:21 -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 7701CB81174; Mon, 1 Aug 2022 11:52:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA88BC433D7; Mon, 1 Aug 2022 11:52:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1659354738; bh=1Jb9KCiZQXynU1UIIOvCFTAA45UZmR0WpEu5sAJWlMk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yOoNykbNgytfJGByROqFhzZyL8o/HhK4B+jHbOSb5kh7VW5fa/h4nqqpJajdcgeWy NVDkv5Pi9tBCRg1s4v919uTcWkInEST2mIFw7pb2wZAC7Ug/1oyYADkCKWDcM0qoTD 0IvOjujjJ3sLFLs9KBkTWEjb0NlhPc60x3oefgrs= 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.10 36/65] tcp: Fix a data-race around sysctl_tcp_comp_sack_delay_ns. Date: Mon, 1 Aug 2022 13:46:53 +0200 Message-Id: <20220801114135.211332199@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 [ Upstream commit 4866b2b0f7672b6d760c4b8ece6fb56f965dcc8a ] While reading sysctl_tcp_comp_sack_delay_ns, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 6d82aa242092 ("tcp: add tcp_comp_sack_delay_ns sysctl") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv4/tcp_input.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 716bc95ebfb0..b86d98c07cdf 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -5461,7 +5461,8 @@ static void __tcp_ack_snd_check(struct sock *sk, int ofo_possible) if (tp->srtt_us && tp->srtt_us < rtt) rtt = tp->srtt_us; - delay = min_t(unsigned long, sock_net(sk)->ipv4.sysctl_tcp_comp_sack_delay_ns, + delay = min_t(unsigned long, + READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_comp_sack_delay_ns), rtt * (NSEC_PER_USEC >> 3)/20); sock_hold(sk); hrtimer_start_range_ns(&tp->compressed_ack_timer, ns_to_ktime(delay), -- 2.35.1