Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1974904rwe; Fri, 2 Sep 2022 06:51:32 -0700 (PDT) X-Google-Smtp-Source: AA6agR50ts3llzg8jSVyIvTpFtOEBZljxGOfXGT0qDM+XmEFlPJRmj9Z60hxArlehtBwwZfgwiRL X-Received: by 2002:a17:902:db12:b0:16e:e5fc:56db with SMTP id m18-20020a170902db1200b0016ee5fc56dbmr36819211plx.46.1662126691845; Fri, 02 Sep 2022 06:51:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662126691; cv=none; d=google.com; s=arc-20160816; b=hZ+fT8d2YiREkwpzKnMj235j7ZcqCa9JIhNxPfpS8NY7w+P18iYe9JdswrLScBCa4V PkzPrgCJWDF2uOGBW98guucw4Hz8iozK4ih3Zb8DD4z7tf0nhSaP/9e+34nD5yAn0+tr X1KYe25+NDdMrvFxWvLHb+iAsq6nAPUDlnveCZ9a0iHX2j48PSi2eMM1MoOoCE8o1yyP SwPlwhefygOTVBadsVen78eUo7y5aYUoYF8uVEJ8JGmeIMYgTAr57atyMbhms6Fjrhpp piK0ATuvB1NJBUBy018usurDme/lWE91zn2kWHFTHWNpyWh02L00Mcf26l/9kaYdAPnR d5Ww== 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=wzUzdy/X28ywf2iPu2gsf7EieKhGr5sT5odracm1kYE=; b=DdDDXRSUBXE/vdezBSmu/zgtsceog49+SAC8w9YR8RAw0q+0E1/VUdTwbddrXix4G1 EacQiskmX1n2PZbX2OMXj5WZcoWwvudOsRkYZPhFN9AuSXKyPmHSf5rL/nuEYjjM9bHk +l5tLi2n8I9pCOqm3eH0p1QQpTHaMDBdHT7OqO/teeVNrCQqBuJMlWK17mBwwHsadIP+ zGdCzrdz2Zyh8c9ous0N9bsurKLapQdpoj7gP5RNK8CJq1zXV9U9ZW6qoSH5XtsQ/O1i uukm3jIewTu+Qe2UnyIYy10+T7WqKenY5RY5UNY7IcngpsUJoScZYHCXNovVpQN4nIl5 9w7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ao9gXhHs; 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 j17-20020a633c11000000b004068c3147fbsi1995309pga.543.2022.09.02.06.51.21; Fri, 02 Sep 2022 06:51:31 -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=Ao9gXhHs; 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 S236183AbiIBMWf (ORCPT + 99 others); Fri, 2 Sep 2022 08:22:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235915AbiIBMVP (ORCPT ); Fri, 2 Sep 2022 08:21:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7E4E832D5; Fri, 2 Sep 2022 05:20:58 -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 65A84620E6; Fri, 2 Sep 2022 12:20:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C0F1C433D6; Fri, 2 Sep 2022 12:20:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662121257; bh=RHODq5FtyWYxRG+5DjCHDRBIpW/miY78MvDSDQSm8U4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ao9gXhHs2RXRb0WGcJWYh+6qy+eSifolUCAZbXDLVom6scRj8ouJfdqvO/kyHy5jr w0Eq00MiKLeRTzou3+li1+gMJmpk5jMYANmL8bvn3zFKElGeIGBymod2pyhCWzepvm S2IhQnDbW238E5aZqrglm7w3KsuFLeHwmATKfV7I= 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.9 08/31] net: Fix a data-race around sysctl_tstamp_allow_data. Date: Fri, 2 Sep 2022 14:18:34 +0200 Message-Id: <20220902121357.057918976@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220902121356.732130937@linuxfoundation.org> References: <20220902121356.732130937@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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,T_SCC_BODY_TEXT_LINE 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 d2154b0afa73c0159b2856f875c6b4fe7cf6a95e ] While reading sysctl_tstamp_allow_data, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: b245be1f4db1 ("net-timestamp: no-payload only sysctl") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/core/skbuff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 22b216629f9bc..022e26c180241 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -3905,7 +3905,7 @@ static bool skb_may_tx_timestamp(struct sock *sk, bool tsonly) { bool ret; - if (likely(sysctl_tstamp_allow_data || tsonly)) + if (likely(READ_ONCE(sysctl_tstamp_allow_data) || tsonly)) return true; read_lock_bh(&sk->sk_callback_lock); -- 2.35.1