Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp1943482imn; Mon, 1 Aug 2022 05:55:10 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uEkArwoEx8tiLCbrq0ijQv+S11G72g/KyvTxLnlqsIwbcY1/+/i8nmR7k92wm3UyrHvVqM X-Received: by 2002:a05:6402:2816:b0:434:ed38:16f3 with SMTP id h22-20020a056402281600b00434ed3816f3mr15729636ede.116.1659358510187; Mon, 01 Aug 2022 05:55:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659358510; cv=none; d=google.com; s=arc-20160816; b=GFykB+NSVJ7zlI4hRLMEqwq2WdHzbYO3yoo+KyYo+gEciR4Brc9Z8JXUAyEiPzpWOA oeNo9mr5sVaPNULiIxL06sfiwc9Y2K6Pz0U+h/P03pKbuFeavPQy7UnssQ+ZKzAk17E7 uzLew86DwJADdB9wSB1bQUUXa2HB3mI1j8bitFLz8TKh0ruqLn9WDAKpz//E61W3L9V7 S/TePJL8YqYcK4iQVazvL794E+j/eM45VwLeM8HDV08m4SVDpltLBkBaI+1mLUxkJjQm KmN9HKgZvfdsVL8gyOLKdc4T5qMe/X1umrYoIJSEcRakkvF3BmcZQtPPQhiX/lrIhE6U wERw== 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=A6GAFlNlOt+yI3osIvDTd3zEgl7luSEQhXo0cxetwzM=; b=Z2p+yIxUNPRNVAuFw2tzqVwCMlVXgd2YjYKDHydiZm4KmcaZQGvmE0WqvihJRtpfOe 4uvsKa7GLIRnz4mkT5/AvZckzraz8AGGP8uNA9r9ZdKb36YAMVJxMozfu3aBkJ3e3n7/ 20YTmbW24dXjROZ2Kpc1h+4ccH2zBzljpArlaocSWF1W1waJTUBSBLqrQ4/EVRCN3CIV WDdYC6Z+Untwmptst1LfWoR3YOSSJDjRZLXsuLj0P73uu34aBugXxt6sh4cYJWh7mQkM sHkER7i39b/o8oLmkxb8k2PGqSaCDfo4W3N3qZFDToRetkuhuhyTBQEud+u/HRrabXNR rRKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PYJ1d36q; 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 q19-20020a1709064cd300b0072a477a55e0si8692800ejt.369.2022.08.01.05.54.45; Mon, 01 Aug 2022 05:55:10 -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=PYJ1d36q; 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 S232665AbiHAL7S (ORCPT + 99 others); Mon, 1 Aug 2022 07:59:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232633AbiHAL6s (ORCPT ); Mon, 1 Aug 2022 07:58:48 -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 EEE033F300; Mon, 1 Aug 2022 04:52:24 -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 39A36612C6; Mon, 1 Aug 2022 11:52:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47985C433D7; Mon, 1 Aug 2022 11:52:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1659354743; bh=MhDWw/SRIG6IZVqIevUfhqFNM0IasYDAl4zA5qMQQng=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PYJ1d36qGsIqgkmVwlBi9JtFzs2GVr83dPWhAr/eNzs3v0tYiOdT41S+b34ZL1js0 R5ZR1dNfNdDwpPNEMsA2N1pQy6V4Ekr2Kg5fXpYYwFjgjuVX/kxhlMqHE1izk5ECMg M+RY0KZQsn6oMfn44OufWM5tub4TSfA2GxHZ8T8U= 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 38/65] tcp: Fix a data-race around sysctl_tcp_comp_sack_nr. Date: Mon, 1 Aug 2022 13:46:55 +0200 Message-Id: <20220801114135.299039329@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 79f55473bfc8ac51bd6572929a679eeb4da22251 ] While reading sysctl_tcp_comp_sack_nr, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 9c21d2fc41c0 ("tcp: add tcp_comp_sack_nr sysctl") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv4/tcp_input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 72a339d3f18f..d35e88b5ffcb 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -5440,7 +5440,7 @@ static void __tcp_ack_snd_check(struct sock *sk, int ofo_possible) } if (!tcp_is_sack(tp) || - tp->compressed_ack >= sock_net(sk)->ipv4.sysctl_tcp_comp_sack_nr) + tp->compressed_ack >= READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_comp_sack_nr)) goto send_now; if (tp->compressed_ack_rcv_nxt != tp->rcv_nxt) { -- 2.35.1