From nobody Wed Sep 3 01:52:53 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26059C38145 for ; Fri, 2 Sep 2022 12:32:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236269AbiIBMcY (ORCPT ); Fri, 2 Sep 2022 08:32:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236581AbiIBMbV (ORCPT ); Fri, 2 Sep 2022 08:31:21 -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 C5197DD4F2; Fri, 2 Sep 2022 05:26:56 -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 1AB5AB82A9D; Fri, 2 Sep 2022 12:24:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64127C433D7; Fri, 2 Sep 2022 12:24:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662121483; bh=CROEDo68RWPkTAbO5thz1/SfBjbZ4MSLhLylUDNIiPs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QgMJTOfMh1vqRaI8Io8PQdoD/JkAlUFyxKb+2yc5gnYCCzPzR/p+U5grrlE4IkfsB wOgJgSHLXObvg3tTuULeBtFc3Ym8LQcghmjs4hNn1ovcwAh5+RSHmXEIB0VXGUrrv2 aGbJKuCw2uxpC6HR1x/Pde7RpojNx+UGdWV+m58I= 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 22/56] net: Fix a data-race around sysctl_tstamp_allow_data. Date: Fri, 2 Sep 2022 14:18:42 +0200 Message-Id: <20220902121400.952264237@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220902121400.219861128@linuxfoundation.org> References: <20220902121400.219861128@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 c623c129d0ab6..e0be1f8651bbe 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -4377,7 +4377,7 @@ static bool skb_may_tx_timestamp(struct sock *sk, boo= l tsonly) { bool ret; =20 - if (likely(sysctl_tstamp_allow_data || tsonly)) + if (likely(READ_ONCE(sysctl_tstamp_allow_data) || tsonly)) return true; =20 read_lock_bh(&sk->sk_callback_lock); --=20 2.35.1