Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp483648imn; Wed, 27 Jul 2022 11:28:22 -0700 (PDT) X-Google-Smtp-Source: AGRyM1twh3BfTQSPCEQCOKbPwHm8C4wfeJr+/zM55hBuQT4M1hkkqUqWSxmAOvjNH7mGg9O+6HML X-Received: by 2002:a17:902:ef47:b0:16c:60df:3a7c with SMTP id e7-20020a170902ef4700b0016c60df3a7cmr22854446plx.9.1658946502509; Wed, 27 Jul 2022 11:28:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658946502; cv=none; d=google.com; s=arc-20160816; b=C5gBFBK2OWVEDpvEq/vOjyZVhrT+BlElEaSFysYUQ9GJ+PtrOQ2u6ByEXg94Bv13Td FavNaSGQMtP4jcIceZ3Xr7cZ5bNKmodcVxvYMIUFkl5iZITB+NAT0Svnw+/EVZSggQID bgq3warr0vzIBMmpMC+h0nbpQc6GwYf8nxb0mNdILf360Dli/qqXtan7L6IXgtzQRfRT TIep2efs4SZUcJufc+fUlmQsa8V+hIBA/FxcxZ7Y7vnUfjVDYF3Wr+8bLdlC1I431MQk RNMae7YNAWlf7HQ+lSB6Xc6PgcamXg9tvZWkvHEoQDRYjF38QMRfL+HUX/9CjYLIBx8h NpAw== 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=xYOjsluu1nAWJ6Ik92xuZ0XNrdcSfcNptVPYqtDf0n8=; b=i/SZ/Z6rpGa0uPBrcSmAlq2tpi0vDRwwszZz78vsfze+uxc7WD0N3/Laqde8C3i3LK HGsoe4UURIcevLDP9pvoRkPbGmmQfR3dYS+kmHxdRF/6lae44GQq+zbRhNkhRd9C8JsJ 8unE8YKxq0lE1dxCkLmgBiIaUO7XM+YrIWmpw0foN+72S/qoj4bn+qEkjYk01teczWaU cgw2IFpupTdMc7K1AXVxI3vPTXxX4g2ay13wmfja5lIZTMnGvXNppF4wKIrGZ3Yb3x1+ 1apTozMUjjWW1a51SFDbvedlktnA3isF0cQisqsYId1Er6raPoawHYmPeK3iwh+3ILvu A2Tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CFOs0hUj; 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 p8-20020a170902a40800b0016c323e8151si18988493plq.214.2022.07.27.11.28.07; Wed, 27 Jul 2022 11:28:22 -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=CFOs0hUj; 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 S238447AbiG0Qf3 (ORCPT + 99 others); Wed, 27 Jul 2022 12:35:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237948AbiG0Qd7 (ORCPT ); Wed, 27 Jul 2022 12:33:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AC8E54CA2; Wed, 27 Jul 2022 09:26:49 -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 2B95FB821BE; Wed, 27 Jul 2022 16:25:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6058BC433C1; Wed, 27 Jul 2022 16:25:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658939147; bh=ZfemfIdXq7/HvQDmRDnhv6Y/L+qAEtaf6wJBBzpCc9o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CFOs0hUjmFaYCRhbHrY5WMfm2lJ5eeYayHzq4C2ElXmekoYWElaXJWVP3pucGfAbI m//8PpSZpQnMhLnjWz5UP0/8yQj1Sa24b+tOLpQNWXG6PI8ij27cwLYHE3INoOuK03 PxwvWI9kGgIaQKZx9LdS5fjWiVU5BKMZpwHRxcq4= 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 30/62] tcp: Fix a data-race around sysctl_tcp_stdurg. Date: Wed, 27 Jul 2022 18:10:39 +0200 Message-Id: <20220727161005.392552075@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 4e08ed41cb1194009fc1a916a59ce3ed4afd77cd ] While reading sysctl_tcp_stdurg, 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_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 731c4d220905..3b63e05c3486 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -5292,7 +5292,7 @@ static void tcp_check_urg(struct sock *sk, const struct tcphdr *th) struct tcp_sock *tp = tcp_sk(sk); u32 ptr = ntohs(th->urg_ptr); - if (ptr && !sock_net(sk)->ipv4.sysctl_tcp_stdurg) + if (ptr && !READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_stdurg)) ptr--; ptr += ntohl(th->seq); -- 2.35.1