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 C59AAC433EF for ; Tue, 19 Jul 2022 11:59:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230425AbiGSL7i (ORCPT ); Tue, 19 Jul 2022 07:59:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237769AbiGSL7Q (ORCPT ); Tue, 19 Jul 2022 07:59:16 -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 54FAA45047; Tue, 19 Jul 2022 04:57:32 -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 E3721B81A8F; Tue, 19 Jul 2022 11:57:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DA34C341C6; Tue, 19 Jul 2022 11:57:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231849; bh=/gDLDlXvG0A+CVxpLY6kJCQo+4kacG2z3uvsdV4i29E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K7PP1XWxVsxTS+knG5xQDIdgj5mQOuZyXYKDjA3k2TCDb2SONoGPvnilnw84pVHsB EaSiSe6Co7bGhg9aQ31e4QMAZLxBW/kiplKrJq0ZvEN39trK9m03tHAQgi1+0ypyF8 S9FDqFRMkrk6BZNUwRZEKTF3vY/2HUihnoU+F9zA= 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 19/43] icmp: Fix a data-race around sysctl_icmp_ratemask. Date: Tue, 19 Jul 2022 13:53:50 +0200 Message-Id: <20220719114523.702739183@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114521.868169025@linuxfoundation.org> References: <20220719114521.868169025@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 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 e384926de46f..1748dfb1dc0a 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -295,7 +295,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