Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4372954imw; Tue, 19 Jul 2022 05:33:39 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tJ0vH3KX52omrRrnWAznIUK4FOIv3e1CzNBOdUkjcyrVlMy3zyPVc87I1dCGs8FXjbv/yw X-Received: by 2002:a05:6808:ec5:b0:337:ac3c:550c with SMTP id q5-20020a0568080ec500b00337ac3c550cmr16256145oiv.262.1658234019450; Tue, 19 Jul 2022 05:33:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658234019; cv=none; d=google.com; s=arc-20160816; b=0vh1VNLJhvHwbDV+kFJZZF5RHqwjK3EbalGEzxQCssVq0b6g6akwZ+z3D/gThqw9sn 8DSKEfW/xBwwKMhR7EtDsHM5IQ/dEf14F2DC5ZO+28X/QgyUQEUfZEGVDPF9oK7fQCEE ipudJFh4fMU1Q9z2i3azyu+Mt4SIfdoZaC2Y2yXtF8r74RNxdIME3R8Uz4lSEGwXIppp cld9QXFUAk77jrXXd4+vz0VfcJjRaA2Cea7TUHhDxB0vQsDwSwHvTueCkYz+BbPlOHhb phm4S1LSE2YVnDb2jwgs2hM4PrlxIQsu0NBc1Js9z2Wk6LZ/dAD5ACme67xyo7X3grUF cHpw== 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=ZlRKw1fhVfHvAuxL+xG+1WrLsluixoTKD4Hc2y/p8KI=; b=RhXOVP2qmrfPoFkRkR9Tyt50u78oDkt412z92Zg5oQNrOIqMgBG8T0s+SXScUcUqGg fpLNzmTMvPjKfdRJC8CsWVfkpRya3QtclW6fDIjV+FqsnIy1kSW0ONMmcaMTVD8ApDGK 3JFJ3bM0Y153ptZiFM1o8o1/2ShqRsetTeOV0b+I0YQU0a/E9nRGtQN4kYyxmS/alCwf KtLUJRPUMj1I/V2IXS7eCq2Y09cB1kiACNV/4MquvcAwj0nQcBy3DMpiWZqJsOSN8Pis pqzY5NJxM/06tyonhcz5VJA32hoM38ogz+DDW4BR0asj4tRlcOttDzscPSQHXYsvEoYn Phtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=K+r1ZneY; 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 ni19-20020a056871469300b0010c2137389fsi14091568oab.146.2022.07.19.05.33.25; Tue, 19 Jul 2022 05:33:39 -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=K+r1ZneY; 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 S239645AbiGSM0D (ORCPT + 99 others); Tue, 19 Jul 2022 08:26:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240120AbiGSMYf (ORCPT ); Tue, 19 Jul 2022 08:24:35 -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 9BF6861DA5; Tue, 19 Jul 2022 05:09:26 -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 C32676177C; Tue, 19 Jul 2022 12:09:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3B67C341CF; Tue, 19 Jul 2022 12:09:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232542; bh=yfEAjfbrzGcGOPZEZmkis3DdgaS+IlV9BAc+6jQ81+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K+r1ZneYkDFbybU6dYMYq6o/rpEzhGgldW2j87ZxLUP6ZxabV92KgiuOmHHpNMc8m a0ehOLjwGy4MjAsVG6wwEJOxKRUVtHr0FYgErgsDGpqP29fMoJsAvZr4Bkc2Oc9qG7 lRNxSf4RUlvUj7ysKDi/Rj/6p9uioUIz9NGFRe/M= 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.10 060/112] icmp: Fix a data-race around sysctl_icmp_ratemask. Date: Tue, 19 Jul 2022 13:53:53 +0200 Message-Id: <20220719114632.331001880@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114626.156073229@linuxfoundation.org> References: <20220719114626.156073229@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 9483c2a16b78..0fa0da1d71f5 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