Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp408018imn; Wed, 27 Jul 2022 09:25:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uu4I/o64N4M9QRPMkKCu2Jxt3y3nj/dzIJk1UjYlUvXlnlhpzqu/eMMBDgavYLjtELtItN X-Received: by 2002:a05:6402:50c9:b0:43c:163a:4d5f with SMTP id h9-20020a05640250c900b0043c163a4d5fmr13629607edb.386.1658939151785; Wed, 27 Jul 2022 09:25:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658939151; cv=none; d=google.com; s=arc-20160816; b=ovFz9O51h2hXBgbqOtHsJPJudlz5q58IaYkUpgJ4tM7JYjfPQM1I4G6AWuhMupyPuC clOBUGVqox/BP1iesmKbhwNF6/RsL7IC6eBCtAmXY7Avv/7zcgHwGZrFsksQGsb+6uPn OHXEg8ksclbxS85EFpqd8UJQleyqfwLPfTEjpCUucw9uJ3/tAh6qBwXAQKDCVcWljTYZ JYiidXslFCEQCnRMEiD9WxW84/lEQyxjZwktLJs3gpX8J9mdrTZLlQr622Y1XzVYCsih 5sJh9lwRMspROdHz768mWsgt0Ewnwdg73bPMUtuO3TLMaaKOots3UJSwxCePymwlEF0V L0mA== 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=eV2WaF/6kSo9shY9s4JEh2MBSHBIjZXRxybVP/LG/yo=; b=DkuZSd4IG+fXpUAX3igIecZFLsfp8BA5y3134mP+ZybICKjby/EqAsaL9rx3BmKxqW PTiCCkfanxjcYMOnG6rlIWyYDvHjKvY5oEZXmNpvr8WIpx9iynY9h4+c6aM47owWNHih pm9/XuwqktKAoH9Y/ZkVgucq+MC+bmYG+Wbx8KSIxhtnG6QThCOxP+e10+vQnDEsmnZ2 SM+uKGMXjq0xTDnAAIzSgGfkF6VgVctNMql2Ue488bFerb31s7t8cZuLPtfAT/k2wbES z7pVUqcHuGtAZDB1atIS0vJBJrCMedeLzQJ7cECMK4VFzXDGLC2ilSNqJTndkzg8fKpE QaDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yNPj1JAL; 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 l12-20020a056402254c00b0043beaa7f1b3si11189407edb.247.2022.07.27.09.25.26; Wed, 27 Jul 2022 09:25:51 -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=yNPj1JAL; 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 S233466AbiG0QXW (ORCPT + 99 others); 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 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 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