Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3070061rwe; Mon, 29 Aug 2022 05:27:11 -0700 (PDT) X-Google-Smtp-Source: AA6agR56da4lTlIyPhRJQor4pQOUAlcq2OaoiBES18PJR1ISgwtp4wXfrRiCsxe/DeBEhFm1wec7 X-Received: by 2002:a17:90a:c402:b0:1f7:75ce:1206 with SMTP id i2-20020a17090ac40200b001f775ce1206mr18194156pjt.68.1661776031697; Mon, 29 Aug 2022 05:27:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661776031; cv=none; d=google.com; s=arc-20160816; b=moFjQ2w2o2VcaXvLYjvamWPx9L8Mfd2qH7EIs3HryRVnaMuXxGUMs3ak39XAV6ExSp JaUe6agcikPbssWIdYtgIpz/N7kn061hk1kKRwFK7PHvT9wz1ji0Tw21FpFEZt0L+rFv MXvqNOF9RLARFoBc7wZlGB5OZKdFs6Nlp75fLm+3U337R8qfV5GMAdygCLOpzdMdgjDv +RccHVbR1laLmywwlf9JcDQfHuydyD4xXMS9i7R4C1864AYONBcHXQfZi/uWUhW491In vsscRhtRwkuf0kjFe4sEW8DwiclZ62ZaugDQDCN3Rd8cPCCNFLsu12Gk1TYoC8g6IF1E 151A== 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=0KmCv7mm/QmxbwcZLFJYxTxxHffN8e471gzNet8fzNQ=; b=f984q48E1Z4OH7DRKmvaZ//BLA4gIYT9AvFoaJdquTDcuSP3bZZHEqWzkDR9JovZUM sMG/wPVgPwCXmnp9Qg56v/w0fRzjdQKEAIU5a5LW5yAKLCy/591YeFeE1NHEG74qGZrf TXu+VSSitdBhPi6KZH+6e6K+ANX0Uu8ygucdGMBjKMi4kU2lF0/4+rMLBcBIAZjr7q96 yrwI4Z1r3GFFjB58zKu0POwWWbBzTxGcCjT/OF+LaDtEJULUmkFHeeHNBuIfxzObBNEn oowk9H641sadR41qgAkP4CZQjvYm6omCIlWmWQ4zfRZn7p8MxtC8lQbDlHvV4BmgwcBs YSoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wIxUk7nd; 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 k66-20020a628445000000b00535bb66024asi9244233pfd.306.2022.08.29.05.27.00; Mon, 29 Aug 2022 05:27:11 -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=wIxUk7nd; 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 S231285AbiH2LNb (ORCPT + 99 others); Mon, 29 Aug 2022 07:13:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231213AbiH2LMl (ORCPT ); Mon, 29 Aug 2022 07:12:41 -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 532B16554A; Mon, 29 Aug 2022 04:09:05 -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 D3DE9611F4; Mon, 29 Aug 2022 11:09:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C86C4C433C1; Mon, 29 Aug 2022 11:09:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661771344; bh=e6jU/oDtwcagn6dm5aEppzvyyz5CM20HP0DYHvgaJ9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wIxUk7ndpFVlODfJrkWZQnI1WvF2Ro4DE59/5/Kk54gOfta1BjY0b6EEamrIIn6w2 Sik9mpHmf3tZ9w8aHJaT1wGn+DeramaNkSCGteLL0W5HSNCqI/ZkGjT+n6DZg3O+SH Rb42IpAmXFXzysD85HVCmMC6kgBEF7NVq4OjlnXU= 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 53/86] net: Fix a data-race around sysctl_tstamp_allow_data. Date: Mon, 29 Aug 2022 12:59:19 +0200 Message-Id: <20220829105758.708346127@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220829105756.500128871@linuxfoundation.org> References: <20220829105756.500128871@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 48b6438f2a3d9..635cabcf8794f 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -4691,7 +4691,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