Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4470956imw; Tue, 19 Jul 2022 07:13:59 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vdAmghA80A5NUgjk5dKAGnHCVDnuXbAd60KRARoTJMYhMVEfVlRf9lCqMSDroLupSjTaKB X-Received: by 2002:a05:6808:1496:b0:33a:6d79:1e0c with SMTP id e22-20020a056808149600b0033a6d791e0cmr6681676oiw.182.1658240039713; Tue, 19 Jul 2022 07:13:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658240039; cv=none; d=google.com; s=arc-20160816; b=AIw8EQBrRLbEU39uoyZKYBJ/d75c9V68yz1TVminDJ6AU4XDDqv3ZpFlie1xgnq9ds sNgh8eB3r2QyZIcdLlVrrI3eDysSE++zb++7oJ+TnXwdewVCXPqqTMKv0nWver1+sfrA lX3HIGtPpUeL1ld3pi6LqOhmIbzoyugeq4Ph+lWPl7GqUvjry5Kt+IbtbWTcjBbPWyse rk/B+8GUa6ajEoy7vkC2dZ/GkoTHcCFTKQuTg12ZhOr14KV063hO8uDgpemxCIJ1vG3w 41Dos93zwCjyngIVOCNhfvPivbr70T0ztIpF4rIfLmLRhcG2JGDtKoPD1MWVOo23tP06 wJtQ== 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=XbUYJMaV7IAsARbpxw3lY1KWFkQFyK4Om4P9SeSTmTA=; b=Ieiq6Pz+elgHq0+T2jNy+lvUbyTtDW6uEpsevmU1UpaFkrIsEBwi8bFRZkm42Oxqt1 IILuktcXHSU9CZwBVX4vG44VLaxFTps1y/uvoMcC3NG9QzfBe+6Bpq082kpi1FctWP93 5sNmByRSYlefWDm3W7OH6uEr6+K7VP/h0LVziEpXCjIlKQr8anloRdRHq8Iou0cn7CD7 rNlXV6ssddUhcZBJ/jcNz8ivI5ZSOL0or4lt5WB0dTMjoj8a4s8oCBpyji1pa+CRACCy ynoyIXwXWmEOT1LD9xVUZBZGc54Kmw3EMr0eWzS/X6NRXfE26EUAq9B4uCN0a5Og8P2C 2IYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=t2ZpCfvh; 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 bx2-20020a056830600200b006169c920cbesi15707060otb.197.2022.07.19.07.13.46; Tue, 19 Jul 2022 07:13:59 -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=t2ZpCfvh; 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 S242596AbiGSM7I (ORCPT + 99 others); Tue, 19 Jul 2022 08:59:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242238AbiGSM6c (ORCPT ); Tue, 19 Jul 2022 08:58:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C2555E32F; Tue, 19 Jul 2022 05:23:38 -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 C780A618F1; Tue, 19 Jul 2022 12:23:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7952C341C6; Tue, 19 Jul 2022 12:23:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233417; bh=6IOMZz7gILfFZJHf3t+fgNOMfg8Rc7QlheseHOz1F5c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t2ZpCfvh2WGzP4U/VpdTRjlu4+NziJlsIIVsS61PQW+chCdeb5yfe1M9PHFE9PFjx SVn83Y4RFb40Pq9ouLOlbX35e84gkyzj38uMGZxP2GToIINBML4gCjNkixL4mDaWsA mOqdUjKrL+oFT/invJpSULkXZ59aa/lphU1k9aE0= 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 115/231] icmp: Fix a data-race around sysctl_icmp_ignore_bogus_error_responses. Date: Tue, 19 Jul 2022 13:53:20 +0200 Message-Id: <20220719114724.188064907@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 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 2c402b4671a1..1a061d10949f 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -930,7 +930,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 6613351094ce..4cf2a6f560d4 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c @@ -630,6 +630,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