Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4442471imw; Tue, 19 Jul 2022 06:44:46 -0700 (PDT) X-Google-Smtp-Source: AGRyM1spYGAZkCSH1Kg8udxSh8bIRNlKDQSeN8FTxVcqbBR87kFHH3XVEIhYtvbxZqEnGrQlr25H X-Received: by 2002:a05:6402:378a:b0:431:6d8d:9023 with SMTP id et10-20020a056402378a00b004316d8d9023mr44290043edb.98.1658238286393; Tue, 19 Jul 2022 06:44:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658238286; cv=none; d=google.com; s=arc-20160816; b=INryfgjhWBrqaLaHxNOBYVpqVo69jHYFtRu2nFfaecDZh79xAKhYJNHZdr865lowhY rPLY/9C/a1Lna92HcCwFbax9GX2bIg3CJ9lCdpQR6RAG7CL7gR9+mIsiLEgfPEImQ9WO m/mv9dXiPOL2HKzuBf6pQLBS6B2iu+hCuHjVG3nV4jucBB+10u+FKHv7G17nBDRMvEBN iNDL7UdYlzNZ/3dAdyS66PwMMuZe5GDtO9socokueKKCEeYLxtF+bJTsYHZ5smjZmcMt TvQ2n7fX6atRllffs2I5eJejHg5DjLBeLoj+ykn/JC0pxjHPo2aINCD8EaQ2L4gbHTZn sdlg== 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=gt2POWYJeEtATIFdPkVUdbzzqdQ62aWdkRSdPLFTvog=; b=sq9Bj8MsZ+GfPHZJe8ZU8kanRQ1Eq7oWwSGTPd+PtQ4ZaV9ujHVfBVr1nXlHJujb6w IFCmdJk0/d38HN4lmqjd0kVPXvHK9dURyD/e5lMyWUJSiRgst5DglEWnnwG3U1NmEFsm KxrzQbUhXMZEdkfkvy2DeHhv85+7/3nu5XpbJPilz1kwkI9T6ZNHCB6KVuOXF/FebO68 tRnKkxXKb4vyVK6s1l9wmX6QBTiTrRpLLLCoOnx2iNR7HwoRZI6HD7UNtqmCvrUt3ztT zBZP0VtfOSTF2+wC7j7t4wvuDLY16uPylvVzfwOfbBLRnG0AZVU+dJjHYA51cG2CDy3x iblg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EciO5Ws9; 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 n8-20020aa7c688000000b0043a4ccd63e5si17956756edq.82.2022.07.19.06.44.22; Tue, 19 Jul 2022 06:44: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=EciO5Ws9; 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 S238078AbiGSMFO (ORCPT + 99 others); Tue, 19 Jul 2022 08:05:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237869AbiGSMEA (ORCPT ); Tue, 19 Jul 2022 08:04:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AB8A4BD20; Tue, 19 Jul 2022 04:59:44 -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 B2BA5B81B2A; Tue, 19 Jul 2022 11:59:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BF63C341C6; Tue, 19 Jul 2022 11:59:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658231981; bh=OzJH5RqWZ7cunwv3oP7sjQDC6OzWsgHyTfR9Av0KOvY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EciO5Ws9P0DT8mw5XIW05FdGpTRK78Fn/DljoPkki02lARNhUuWC32AaJB6ZvOcVL PFIYOyln+vkh00OD3+V076sA1MsITyVgYepPXdv9G92ZxuxXMDfx08/j/CI1JTYws5 9ElFQ0pIK5sf2GWAxzjB9BB7fQyrJpdc+KoM5fx4= 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.19 20/48] icmp: Fix a data-race around sysctl_icmp_ratemask. Date: Tue, 19 Jul 2022 13:53:57 +0200 Message-Id: <20220719114521.668567362@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114518.915546280@linuxfoundation.org> References: <20220719114518.915546280@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 eb29da8971e1..aa179e6461e1 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