Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4447592imw; Tue, 19 Jul 2022 06:50:20 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s7T5vK9HS27hRF/FP78zVVde1dFcQlgFVrUJVGRbmJWag1sbtpTTv0GlKNNK+xo9sjimng X-Received: by 2002:a17:906:9754:b0:72f:38ff:efd7 with SMTP id o20-20020a170906975400b0072f38ffefd7mr8290598ejy.216.1658238620604; Tue, 19 Jul 2022 06:50:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658238620; cv=none; d=google.com; s=arc-20160816; b=VcccxiNYaGqscPyFu9P08Hp3BUY5FrzLlBScEc6+vMJCMVIti6krZMi7HpogUQ0tAa JNZykbxBJu1V2VpGjLlVbBxKTa1fXHeFTm8wetn0ymuDQ0ycLU9/GIfwK+ZmQVEt3/T8 m7dfnrUY7FaUcbe2U+ca3qx9/moA9uIawy1TkhHkB5/7ZeXEdHo5O72jj5JjdszkDoKN j5Sk0hs1nX1xP9cL3Fhq2qqFcVAaWe5mEAizxjcIbL9U0F369+QeQmu6/TW47KaoHXCh YzdT6jD2CjF9H+kYE8Zit0YsC4RT3ltrQC9qc5H3PMXH/Pe9CfNEFFwMfUto6GEHfusK hzKw== 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=iwGFPm4MM3lOqXdHVKvvyt3gDs6yVEztE+quYgsebr0=; b=xUZzuifZiaIXbiGwcs1A3pJn46BEw8htE9ftd/O4WtKayPJiOVmDcoFUtscG6qEFyw jHUV86E0vAAJVOdBYAV2dYAPEWroR9dwGtVAAA037mLJ6NsLvrRv4CzO0roHXFdo++RO KfJGYFmmBpJew/UHq1xi2gPBuHvZzrfrAHEHGehu9ITJ9/AaXxPY1lpEi47mMAPERUvs iWYeHUm2Ryl9PW2HEv6WNTMEeoGn3a2lIlhc1wHdiOQrPbqaxw4UNmWAgFHKq//JFH6D hbNklm11xhd+fLJNWEMsU1h4DTXAdOYZ3V0DoASqT/EhAUyT1sFpUdQ0WpTpn6pKuySo IbSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PuJLjMYs; 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 qa36-20020a17090786a400b006feb3a01b16si19711840ejc.683.2022.07.19.06.49.56; Tue, 19 Jul 2022 06:50:20 -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=PuJLjMYs; 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 S240984AbiGSMiJ (ORCPT + 99 others); Tue, 19 Jul 2022 08:38:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238389AbiGSMhj (ORCPT ); Tue, 19 Jul 2022 08:37:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41EE07B371; Tue, 19 Jul 2022 05:14:29 -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 6FB5E617B2; Tue, 19 Jul 2022 12:14:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3AD07C341C6; Tue, 19 Jul 2022 12:14:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232845; bh=7M6lv56eSXqjUd7Uyxbls7iULV5IVYc4PzsEmltCBpg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PuJLjMYsVu48M7rHfSVUWX2xM06XF/aJ2wIRa34RhbZb2fm9NkLm1ze4C7QywOxFX ANoWmSEnSy+VWVKHRXFa8ci4+6GK35/7EE+NyfsrIX+2iX3mdhThJEyB9IVC2cadB9 A9yymvFpPF1KRaG2AhrjeUpPgnTXn7A3nGXrFOlc= 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.15 085/167] icmp: Fix a data-race around sysctl_icmp_ignore_bogus_error_responses. Date: Tue, 19 Jul 2022 13:53:37 +0200 Message-Id: <20220719114704.803039438@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@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 b04f9b7e85c7d7aecbada620e8759a662af068d3 ] While reading sysctl_icmp_ignore_bogus_error_responses, 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 +- net/ipv4/sysctl_net_ipv4.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 91be44180dd5..6f444b2b7d1a 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -939,7 +939,7 @@ static bool icmp_unreach(struct sk_buff *skb) * get the other vendor to fix their kit. */ - if (!net->ipv4.sysctl_icmp_ignore_bogus_error_responses && + if (!READ_ONCE(net->ipv4.sysctl_icmp_ignore_bogus_error_responses) && inet_addr_type_dev_table(net, skb->dev, iph->daddr) == RTN_BROADCAST) { net_warn_ratelimited("%pI4 sent an invalid ICMP type %u, code %u error to a broadcast: %pI4 on %s\n", &ip_hdr(skb)->saddr, diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 6f1e64d49232..51863031b178 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c @@ -639,6 +639,8 @@ static struct ctl_table ipv4_net_table[] = { .maxlen = sizeof(u8), .mode = 0644, .proc_handler = proc_dou8vec_minmax, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_ONE }, { .procname = "icmp_errors_use_inbound_ifaddr", -- 2.35.1