Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4447435imw; Tue, 19 Jul 2022 06:50:09 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v4wLDUOD5frwpNcwUYIUBMDpS35vgHPOG9+g3YM4fSkO/mRjgt2JBm20DeOIFndhobVlxX X-Received: by 2002:a17:907:2d26:b0:72f:d05:f530 with SMTP id gs38-20020a1709072d2600b0072f0d05f530mr15867849ejc.284.1658238609541; Tue, 19 Jul 2022 06:50:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658238609; cv=none; d=google.com; s=arc-20160816; b=YyKUYmADNoKnx67bY4zIOrZdl9Zte8F8UySBGbsaV/DHHLjX9Ny0RR1wcnyVCRLukg MVTSlnYLsJhl0d489qrUUFIDvpyiBlJLMNaV8VValnzMp9XFt9J0RKxY7y40t84Zc8Ga wg++6TFqVOdcSJK6HudB9YTsxVjPZ9PYLbM6FLYtS74JJEpyPs8m37jfN2iFRcdJldvt +C6vU0PrumekmnNNttJ14qDua71HMEkxxUZPAo22cN+f5lHcBVvTiTBuLvKmf8rRWFlI v5rCxTsIN/Q0E0RtgTVEls0LuOxWvu56eihF/oVhsEJ6jfxcft6g5OG+7JiWFNDyjT/k 7kig== 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=kliCwXDX3zPgJ4pRIIBZxE+8bHNdvZTBbmPhI6mOLh8=; b=aDLoZ7yX541bErGZCrB6q8vmSYYmF3N6lW5CcsaFlDNkAHuFlHRII4QICnBj9QWhha WvOxn9C8ZFx0Hal5QV+EvAP9qi7KqZBIiMV4cilXRmWAZ+ozQB8++7SVpGEIjZNJNG6j C//jYy/h5rFvlKAYlwwH4gv/oA2leV5PgCEAS6iadgP9y1VdymRU3zhpkw4unGBWvve+ qQWY/NfBbdVVeoSyDdR4ug3yu1qMnC+6L4InY0EOklbr59pWJvNv9o/fcYfJWOqsNeY/ Vddk3yW+piqDnwoqgMMrpqWZxZaQ4xQiaapUmGr9/TeRkD83FCgFLW9yvSD4DdznwjIl dgzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NrzdiAbh; 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 a15-20020a170906468f00b006ffe48f0c5bsi10841889ejr.346.2022.07.19.06.49.44; Tue, 19 Jul 2022 06:50:09 -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=NrzdiAbh; 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 S240831AbiGSMgs (ORCPT + 99 others); Tue, 19 Jul 2022 08:36:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240684AbiGSMgD (ORCPT ); Tue, 19 Jul 2022 08:36:03 -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 AAF5E7AC04; Tue, 19 Jul 2022 05:14:05 -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 42189B81B2C; Tue, 19 Jul 2022 12:14:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91B96C341C6; Tue, 19 Jul 2022 12:13:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232840; bh=50bzqRmsuWAfG9RmZyC3M8uiqu58poKkW+EdzcIxw8A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NrzdiAbh5HrBKOSZYR2aqL6o2w3L11VZ6qJqlYnJcQ7qo9Cp83K0+Hg9u8rKl5mZz sCrugJXbfbnfL8N2W9/wiKAPacVBTYyPEyXHYNvlTCE7myzDq49hT6RxMDFWOrEOED PNFebb9tesB4fcjo37SE6mTmrzdxswNGDuvoPmy0= 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 084/167] icmp: Fix data-races around sysctl_icmp_echo_enable_probe. Date: Tue, 19 Jul 2022 13:53:36 +0200 Message-Id: <20220719114704.709030853@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 4a2f7083cc6cb72dade9a63699ca352fad26d1cd ] While reading sysctl_icmp_echo_enable_probe, it can be changed concurrently. Thus, we need to add READ_ONCE() to its readers. Fixes: d329ea5bd884 ("icmp: add response to RFC 8335 PROBE messages") Fixes: 1fd07f33c3ea ("ipv6: ICMPV6: add response to ICMPV6 RFC 8335 PROBE messages") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv4/icmp.c | 2 +- net/ipv6/icmp.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index b5766b62ca97..91be44180dd5 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -1034,7 +1034,7 @@ bool icmp_build_probe(struct sk_buff *skb, struct icmphdr *icmphdr) u16 ident_len; u8 status; - if (!net->ipv4.sysctl_icmp_echo_enable_probe) + if (!READ_ONCE(net->ipv4.sysctl_icmp_echo_enable_probe)) return false; /* We currently only support probing interfaces on the proxy node diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index 96c5cc0f30ce..716e7717fe8f 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c @@ -927,7 +927,7 @@ static int icmpv6_rcv(struct sk_buff *skb) break; case ICMPV6_EXT_ECHO_REQUEST: if (!net->ipv6.sysctl.icmpv6_echo_ignore_all && - net->ipv4.sysctl_icmp_echo_enable_probe) + READ_ONCE(net->ipv4.sysctl_icmp_echo_enable_probe)) icmpv6_echo_reply(skb); break; -- 2.35.1