Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp483180imn; Wed, 27 Jul 2022 11:27:41 -0700 (PDT) X-Google-Smtp-Source: AGRyM1twsEIFkBmoTw7ikDy4RXEQCDX6N9LRJnjI/iPxywDOu5nmLr/+y/cmCzPxG0tz0ITKY03R X-Received: by 2002:a17:903:244f:b0:16d:405a:63fb with SMTP id l15-20020a170903244f00b0016d405a63fbmr23199830pls.68.1658946460767; Wed, 27 Jul 2022 11:27:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658946460; cv=none; d=google.com; s=arc-20160816; b=v9VOiJqDugXVXodi2xGOHAx/mnQjXbHKeEsDHkp3hwI68B7Vs7U90OI91XFRqdsfp6 MweEGGtLCl+jZ5+hAMIbayDti+IJ5HnPxLrlUAaVdG0/Wxg5/zdW2hVBRdOjapByBsGH QYhChIOdBjQQAdv1YLxW5tkJladm8p5wASpPM58/XImuRrksV26cxxNbaZoA0y5UxLjL KtJ750WU0bBh6R7T0wJbuZlQ3ev4OjsVCqUKaLgLi+yH6zRwtQezzpRKOgQrbwiYzfnF oGL3sb0+5HGQlwIYDqqtf/aQRzhAgwbySCaJZQJTJ6K60BUkE0eQiCqITbBb6/Udjdye ELwQ== 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=t436pedLJCzL8rkw9C0sP4pgn+b+uF2gC8VWOmG6z/0=; b=S1fKonXYZq+09iTuE3iCmGAFSWphWlx+aIRj94tc5dRh4zqwR/CHo1XKCDO9osQ/yf erlatcTnhRB6lxxiLmWBqFWCBWXzfEtYig4PVfMvimJD8/VDGh0xIaSVLkz8nDq2vaU2 JBj3FXp/enYbnxz5wkmyV2qNQWZCV+XA1PmwP8aANpLXe5tjPoFjdJbQpUSi8G/36PZ3 +njQKul9232qo1dfgS36hr5gSIAVaTNFQ9nvAyy7qfbr8ssdhlMuFkFA1KOs/3hnbfKQ BcMfvfA8iWeFzjLLrbloTQe2jxnlkcnMz4tUo60aX7NSaoXqvlml2Np0D38Z9RWbzbCI 18FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JXG1733+; 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 u18-20020a634552000000b004197b8c085bsi20660926pgk.535.2022.07.27.11.27.23; Wed, 27 Jul 2022 11:27:40 -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=JXG1733+; 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 S240410AbiG0QqG (ORCPT + 99 others); Wed, 27 Jul 2022 12:46:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240542AbiG0Qoe (ORCPT ); Wed, 27 Jul 2022 12:44:34 -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 2E5D65F126; Wed, 27 Jul 2022 09:31:20 -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 AEB17B821BB; Wed, 27 Jul 2022 16:31:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED622C433D7; Wed, 27 Jul 2022 16:31:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658939477; bh=MgDAVwHqk/bTuTyeMYiez8QgXE2YFR7Af+OisOCuVhM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JXG1733+B4xT8vtx8Mw1bqPckivuCf1AIj+BLMjP7mNl4U9aZ0J11HG2plTzjBwWG +Mqr5e3DcrUXo1PXt78KjvllDnRUUgvsQPdkmWV/I0cgWvZoes3yw7HbDkKFWQiNrm S+55sS32WAFUTQSbOF8DMnbAmC5fZRREWUwkom7g= 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 52/87] tcp: Fix a data-race around sysctl_tcp_stdurg. Date: Wed, 27 Jul 2022 18:10:45 +0200 Message-Id: <20220727161011.177086291@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 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 2f57c365ebd5..f9884956aa13 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -5356,7 +5356,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