Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4451135imw; Tue, 19 Jul 2022 06:54:46 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uuNs+9VLeP30u3pZgaV7MFZkaxn7I5sNoxrIi2npKNaDV9WwLIrWbVsABB25XAH+6pNkx5 X-Received: by 2002:a17:906:5d04:b0:722:f46c:b891 with SMTP id g4-20020a1709065d0400b00722f46cb891mr31303755ejt.4.1658238886639; Tue, 19 Jul 2022 06:54:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658238886; cv=none; d=google.com; s=arc-20160816; b=Pl8hnXJaXFobhFOhHGXBaG8UiOSQtGD/9vEVt/BLOSUPQ3WBLubHVojTqEQegiPOZY yiwOrSD0XBGw5j9c8atQ5Dak6+hMZURixFo8MaotceJ2I3J+/oYHgwSgq0DvwNoJ5QNp PXefnyV8AwLwL7+FDMAHYoQX699TPQ75ptiynwwmU21A7kvrLzBuVshg8zKk2eYNWZnF 3KlXR14OVA2LE9aPFmmmKd7uPRewCIJo/DI4nL6bC4IG68SJJ8+vQrw4xJ6j6ett+N7t uSc+S06VqEmV7+0uMo4t1rpP+6pz3p8BfeTQE12/G0x6ern4AR+shpBEQz4rqODIqifR 6uIg== 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=BvKqJqJhj2kiH8rKqwHxro05IUAhYiSvTNQWOWXwGsg=; b=KNxjen99soxQRLO5sNnUD2Hp63RSV4o0UrUO2l04Gcwf9B9KSFlXRy+P9aq69ihDb+ i9PUUYsdUWLrrIJl3WjwMKm+bDNeb5QvrYVyxKSxZFxh7irHiOA0EfC8Z7Ffh/0jUZa9 GO1ax6wGMgpj/T9C+QYO6QHBR/AGO5sWrEmdklKDpkh/orrqddjqw0IV/YUr0iKWAgct HLYJDC51v7X/e6UhYJbPV7UM9XkQy+QYhYBuvSFhuysZOVrP7BskdmZ6VvxeNSEZy+Ds +2HL+auQmOsjq1QgnYWP8jQ7/IB0aCBCLw7DXcwaWv8X72t8Q9E0YVb+5KR7jCBe36dJ x8sQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1Gagmxso; 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 g23-20020a056402321700b0043a26f522f7si17741784eda.67.2022.07.19.06.54.21; Tue, 19 Jul 2022 06:54:46 -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=1Gagmxso; 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 S242743AbiGSNBw (ORCPT + 99 others); Tue, 19 Jul 2022 09:01:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242707AbiGSM72 (ORCPT ); Tue, 19 Jul 2022 08:59:28 -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 0C0FD4F682; Tue, 19 Jul 2022 05:24:41 -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 C347CB81B08; Tue, 19 Jul 2022 12:24:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3E10C341D4; Tue, 19 Jul 2022 12:24:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233478; bh=sZ4gSH3EmHNfxqY9izStaWXalFrxgZLAwUzlrp8Cgic=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1GagmxsodQIfymAEVyKTRKR5PGjIkiilnPe7WuIwKEYAhJcJChf7ELyqiNC7Tuq4R YS54QEVgGLwtu/4YEA/Gy2orZ9msYbpe61/FwlDKenDPNiIdmZ3bxnDhq3xaIdiaEg 12DLwDBB9TsWQP+qNv94ojTlc9oQ8gneHCexaOOg= 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.18 118/231] icmp: Fix a data-race around sysctl_icmp_ratemask. Date: Tue, 19 Jul 2022 13:53:23 +0200 Message-Id: <20220719114724.397875539@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@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 41efb7381859..c13ceda9ce5d 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -282,7 +282,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