Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3054875rwe; Mon, 29 Aug 2022 05:13:24 -0700 (PDT) X-Google-Smtp-Source: AA6agR7sty2GbekZxFQ4F1U98sZ52Tvwady9GcWO2yhXTnmXC8j+ZsZHjYeWHBAKFKI+GWaH79/o X-Received: by 2002:a17:90a:c789:b0:1fa:6bc0:77f6 with SMTP id gn9-20020a17090ac78900b001fa6bc077f6mr18649917pjb.1.1661775204531; Mon, 29 Aug 2022 05:13:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661775204; cv=none; d=google.com; s=arc-20160816; b=lZWPcu+NDvctTd0MSx0IB3TrvbgpY/bvfarvSJTCCHVO0N5GdIhLr4a3iU4NTp7ES6 +yeLlLlI59SvuOGwHiOAfDaJhIGCAg38bOlQ9UapwCn7vwlCPu92h6KV7AXUWujCQIIZ ImWdUBgzy8H63/1mDcsYrdGIBBoDEaekfrYRhGHOERYOJQ+CcQu4GrcXgrFGYaXYg+u7 H222INrUUqYqwhwNFU/LvQ64wbgjekG/3Fz6a9JFCAPJF3XQ99LxwDeJ/XiaDrFjpbqW VuZkgBch8riESBWfE9uwLyIxTf7N8OSoKr3Yyyfqg+megpCX/ktAe6+eGhhZUaevHpHi 55Zg== 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=t90AnnzjHHeV2F0CtFoeknUNW77V5LbbRSQ+RtmD6qE=; b=upWNw1QSESbzU/1lPODBZyLaKsD7H5ocg2ySCj4C3Q09VMixTFTf59HyaXsbQbrCG/ BtKxX3lgcqzK0lq7IwuzfhP4df6duh96qMepGoei/8LlQSy2T71Rop+SZV12BWglOskL 2voJZwLQuX/lm5gc7t7xAuWYaEIEIoBP9lnBXG3d4A8U77oz3eKjTxwBa+d15wUvDSfa Lspw9ugkTg0uuLQWcGM+W3rjyRalRzDV0h6unPYohiQiWqWVfSasoE5NVE3Z3w5Toga3 N8g1iKWYexjjUEsZkiXPyw5pITSeX74+RvRzg/RwuXe8qJNKW/BGp6mMlDhx+kgeKlw5 hZWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="x/2El6v4"; 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 b9-20020a170903228900b00170d738f972si10438139plh.536.2022.08.29.05.13.00; Mon, 29 Aug 2022 05:13:24 -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="x/2El6v4"; 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 S232350AbiH2Lag (ORCPT + 99 others); Mon, 29 Aug 2022 07:30:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232448AbiH2L3B (ORCPT ); Mon, 29 Aug 2022 07:29:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3FC26BCE6; Mon, 29 Aug 2022 04:17:23 -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 A975161214; Mon, 29 Aug 2022 11:15:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B47D2C433C1; Mon, 29 Aug 2022 11:15:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661771713; bh=3atjrCF4bTBJ7Czyu6rwJ5nPUCtBgLWsV7O/DA09F+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x/2El6v4IjyfhnkTtEoi+44JQoORLQ6TmTqwTVRsRmm8gwHxlaZ3lqkC0/F5bNXQH xv/3dj/Hp6y5onnbQxSsIYdgfoskhCHV9uiADgwWnXWTcYmQ1RCcdkCrjedMRVhy6v 3L9sPKcKzKFFuCBYWH6d+XI5u1hEvLLgcB5Dklmg= 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.19 071/158] net: Fix a data-race around sysctl_tstamp_allow_data. Date: Mon, 29 Aug 2022 12:58:41 +0200 Message-Id: <20220829105811.988472460@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220829105808.828227973@linuxfoundation.org> References: <20220829105808.828227973@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 5b3559cb1d827..bebf58464d667 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -4772,7 +4772,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