Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4416896imw; Tue, 19 Jul 2022 06:20:29 -0700 (PDT) X-Google-Smtp-Source: AGRyM1thJsjS3/N7+kyJbaqqLhKWXiVEpHfYQAOZ8fbU67sOguSGTIWUqv57bZqz5gHqH4sHUus9 X-Received: by 2002:a17:907:7608:b0:72b:4f33:bcce with SMTP id jx8-20020a170907760800b0072b4f33bccemr30054780ejc.252.1658236829400; Tue, 19 Jul 2022 06:20:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658236829; cv=none; d=google.com; s=arc-20160816; b=pm2fHQaCSMD0Tygu58NBd7zaEONC+vcXHKUd4rOLc2/1eiDkm3JpAyAq4zsgC5/X0a lZlElZCyBc4fin5aSgwRxYlcr5HCPJ62qkgl2+0Uqtc1AkWo9tYWf34Ghx17zfbRtEsm 6F0RJskVKMZOQmobE0NZ40V4LT7U00D357Zsj5SdeMCXnoP5W1PHbY3WSCD0Bf2E0exB n3eHs/3OJpcWMCnHK1/J0U8KWSOGQYbdJ4tFrWKJ94XdMHsdCX9tl+GGgzN+wi6tQeb0 9BVtK5zMyQsy6eHrAjdAdvwKay5kPOub0VdnVZswigl0morC9jzoUwrhykyr7lFia9zX f7CQ== 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=/P6trpHPbyf/3sUQ+s+RTdbuVlwzn4jrIG2KSi0P558=; b=pa4rrS44qvHOysOKbLVkbr5JcnzQOKR55o4H6+rkc8znSMbF9NQgMRMpXLjsNG40Sh yaePvzwzrqJdNxIXCRsv24L4o2OlH3t0oHf12qJaSCB3cQvKu9DveVYpMDZ4vpem2fSB a/oEd2ZEkRCbEPVG8E+Md+boIyo+Bjny5Yd02HiiyzqaU+6BmjR+DzbbY7lRG34t6DPh 15HK5R4+ROGbs7V/BdDXlPa8M2yGsBzGZL0fznFSlHFeOlyAiDJy2H1yuY7Im53snI2A TFYfWDDOovfEE4GV9SKtlCrQHCms0J5/oDy64KkgP0F1mfLsWqJ61OmIK1MYON/5czo7 znyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Bamh0tTz; 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 o22-20020a170906975600b0072b4ad3252dsi19675504ejy.83.2022.07.19.06.20.02; Tue, 19 Jul 2022 06:20:29 -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=Bamh0tTz; 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 S238589AbiGSMLe (ORCPT + 99 others); Tue, 19 Jul 2022 08:11:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238899AbiGSMJs (ORCPT ); Tue, 19 Jul 2022 08:09:48 -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 D564C51410; Tue, 19 Jul 2022 05:02:47 -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 D232AB81A8F; Tue, 19 Jul 2022 12:02:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF45CC341C6; Tue, 19 Jul 2022 12:02:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232164; bh=YNQLgH3BCiMdN9Q4ce3u/5iMyew0BSySDJ03KIC7vqI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bamh0tTzmNF/tdH+7GMrLLlFcvuDv0ON2sWwtiwaKcAmc4GfYusYITownOlCjZlrD pyRKL7pbYiNTQVZEjpD76O6wtzjp9fk42xio53raeABcxq2lPyXbLFEJpddu702HcV 5zkMrIn4S2RTTYiX/bz/r0zBEnoDA4KmnsqsAbTI= 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.4 35/71] icmp: Fix a data-race around sysctl_icmp_ratemask. Date: Tue, 19 Jul 2022 13:53:58 +0200 Message-Id: <20220719114555.684310243@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114552.477018590@linuxfoundation.org> References: <20220719114552.477018590@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.8 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 1ebcb25ad6fc3d50fca87350acf451b9a66dd31e ] While reading sysctl_icmp_ratemask, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv4/icmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index e05e972445fe..9bc01411be4c 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -290,7 +290,7 @@ static bool icmpv4_mask_allow(struct net *net, int type, int code) return true; /* Limit if icmp type is enabled in ratemask. */ - if (!((1 << type) & net->ipv4.sysctl_icmp_ratemask)) + if (!((1 << type) & READ_ONCE(net->ipv4.sysctl_icmp_ratemask))) return true; return false; -- 2.35.1