From mboxrd@z Thu Jan 1 00:00:00 1970 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 29DD2C19F28 for ; Wed, 27 Jul 2022 16:23:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235838AbiG0QXW (ORCPT ); Wed, 27 Jul 2022 12:23:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235361AbiG0QWg (ORCPT ); Wed, 27 Jul 2022 12:22:36 -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 4C6C04D151; Wed, 27 Jul 2022 09:22:35 -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 9F21D617F2; Wed, 27 Jul 2022 16:22:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B00B6C433D7; Wed, 27 Jul 2022 16:22:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658938954; bh=FFNPAA1oV66r9wF2ZPiFXCs/NafvjNsgtCw0tpuA1Ls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yNPj1JALmxyghhyHztMPbvMa9UBPP+65aTDMBPP37fByr1mLmpBCEHoEip40H9174 kEPdVf7VNKKgb2NmYwCqCEwDYSY8+39PLdLTEn6ZMIrqs/d+/ZE56ZxTGNgYNbIGtX HvhPNyowiuDkMwelRIEQ475QmMly6vFf5/bozkIY= 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 09/26] ip: Fix a data-race around sysctl_fwmark_reflect. Date: Wed, 27 Jul 2022 18:10:38 +0200 Message-Id: <20220727160959.512108187@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727160959.122591422@linuxfoundation.org> References: <20220727160959.122591422@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kuniyuki Iwashima [ Upstream commit 85d0b4dbd74b95cc492b1f4e34497d3f894f5d9a ] While reading sysctl_fwmark_reflect, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: e110861f8609 ("net: add a sysctl to reflect the fwmark on replies") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- include/net/ip.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/net/ip.h b/include/net/ip.h index c762fd047ef4..f0e13a256582 100644 --- a/include/net/ip.h +++ b/include/net/ip.h @@ -283,7 +283,7 @@ void ipfrag_init(void); void ip_static_sysctl_init(void); #define IP4_REPLY_MARK(net, mark) \ - ((net)->ipv4.sysctl_fwmark_reflect ? (mark) : 0) + (READ_ONCE((net)->ipv4.sysctl_fwmark_reflect) ? (mark) : 0) static inline bool ip_is_fragment(const struct iphdr *iph) { -- 2.35.1