Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp487368imn; Wed, 27 Jul 2022 11:33:56 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uaUzuBUvltASFLU5WQnGIQrW2+wZWzJUe/93EtxE/DRQbmrGT4FZv1je6reziNAt7PAAm9 X-Received: by 2002:a17:907:3e0e:b0:72b:568f:7fa7 with SMTP id hp14-20020a1709073e0e00b0072b568f7fa7mr19294425ejc.119.1658946836108; Wed, 27 Jul 2022 11:33:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658946836; cv=none; d=google.com; s=arc-20160816; b=HIsAGi9fCpJ8SwejXJyKRb1UcFlcGf7KNuRi+F4GwOkBUgy6E2i/izZsxRMxOQ90SB sbkVdStC7vlwoMuuFOqsNB0UIlib/BIS0nZK843ZDrbK+jqJ2nHCZYJ4kklX8RB9ndi5 AiNjD48Ji8IZE7cIzobajetKnUGIJ5A5DgMfTeNbDnPHgRGMAH+P3SWnrLjiZsJJqO4T JywEwV01OvxYQh4a3d/XsJRIBQPggn/z0j4YBS9cLl+/YQZKNRALXmIl1orbokdfm+7V j2kuUGYf1ajiJttRw1NUXNwkIpZaLLZ+a0dpbx/nFSVduSNU95ZQtvyiL5w6IK2mw2/4 sCgA== 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=hmJsXl8IF1tkpDNDXHwVErBB3+c9Wu2jWXbqUuv62j8=; b=l/VCOPuwScZyl/3IE/U7mY0SFU6osMVnkf0W3luKr10qlYVY12DOf3gQi+797gydQv Np8h1Vs4kxfToeLIxyCH2VBX/MLTlcNdnrnUDm3HP4AKmDtarcBAEFImOvSLTQ36qUNP 3RFoZ/uqBmsbfdcQB4hGCfrLysuTC6Y5YLhEH02t+I2Cr24kTSsM8A+J5qioBcPzuuWW 3wI7XcJIJKkJebuf9TX2h/cOjndTnkOsOYOnHPk0d/H7S/QltPg+vF0ByVJwV/hThdMT BqoK8VwQrSTALeqJfDisn5tnepy5euZkaRRetAwmPQsxCeBxWa10aqqZ8w3AQgIJu2kb F2cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ziBvzrr6; 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 cs18-20020a170906dc9200b00726ce3b24ebsi19116941ejc.832.2022.07.27.11.33.29; Wed, 27 Jul 2022 11:33:56 -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=ziBvzrr6; 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 S236130AbiG0QZ2 (ORCPT + 99 others); Wed, 27 Jul 2022 12:25:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236242AbiG0QYT (ORCPT ); Wed, 27 Jul 2022 12:24:19 -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 BE6E04D146; Wed, 27 Jul 2022 09:23:13 -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 9F239619C6; Wed, 27 Jul 2022 16:23:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80634C433C1; Wed, 27 Jul 2022 16:23:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658938992; bh=hsWA+swU9odQ5uHMtyE2bfc7DAGCDKff987Lcq+Io/g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ziBvzrr6bRwgSyZGw1/CUCC65khVcFV5CWIujS76M8xLNnLO8j48opf0UemWVvfuF SYD2RZ6kh47zmDVefywxrmnDlcJgQAF5BeekZW1yOjyuIH3cmaJ+xyD2qF65iwnWn3 8JhFXXAK3ZvHopQxjC+rwa3ARJc6zBlBZU6tDOHk= 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.14 05/37] ip: Fix a data-race around sysctl_fwmark_reflect. Date: Wed, 27 Jul 2022 18:10:31 +0200 Message-Id: <20220727161001.053195375@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727161000.822869853@linuxfoundation.org> References: <20220727161000.822869853@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 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 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 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 4aff48d6ba91..2a92a5f4f9b3 100644 --- a/include/net/ip.h +++ b/include/net/ip.h @@ -305,7 +305,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