Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4450753imw; Tue, 19 Jul 2022 06:54:18 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sz+B3+piF2Jsv/s9ClOi5HKtNVlPQqFYjUobwB2e/D74K5ZtzFT/+ltkagXDdf61mXYlZ/ X-Received: by 2002:a05:6402:27c9:b0:43a:d14b:1fa5 with SMTP id c9-20020a05640227c900b0043ad14b1fa5mr43331928ede.245.1658238857768; Tue, 19 Jul 2022 06:54:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658238857; cv=none; d=google.com; s=arc-20160816; b=rw6OoHoqZkJqydMGeJ6t2e9nHdwks6dATl3XhrBq+hQeyYI8gzPmyk4PE1ZTvTfuh8 NbeQWF+bEI6HfVcJ6rD/gSPl2lB6pyuknny6wuHmGw01kQMW4Yxt5Ehajjm2Qn8B6xHy 4rz4ds3dSQQWMdL06cOIJUooevh9ZYj0mSdsn7P6FRYFDr6l4Hrc3j2KJurRdWneVAA0 PNU+GBLZHPCxTVQAl5gF3fAqqfVzzd5nGgfeY0gZMRGP8HrxZdLfr6W5y12fgFkuoB6B cDqzxkVWtMUZInzJTM1yyNJj1iltBtiJdtx1yqHzYvXCFCfmNK59g/AFARhCDI03Gk2V karQ== 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=izTLF7FpuVdrlKQgg5KhO4NaMzwwPfcMHSwi9ne9Rbk=; b=GrEpSSjWszH/H6trGKnGDCmK0D4subduPN3bDYHwlmbtov26E1Gzn7SQpz9pImCZbe QiMaVv8oHImZ7cX8rgWs4gW1k3NiST9SyTlH0O1fFgAcArrK/lIa0UBhYUWztZNf07tr 6pcO1j1H0GyYfV9LLO/0wpsvexE6ycWvykPTfq/FIpXB6RiePGw+ix7Wvqu/SuaHm87E w6gCwx1dKMoNppgMeZVf11IDuZTS56U+tyMkbZSluAzaBHbtjzGbI9cOgys1L5TL/ePq fec7ZD7bljfyWPr8QZvwAZ9BRR7Xlzamc3yNfcZMLmWsJaIezhbMhC/+SymV0CdD/Do6 kqOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=18GJi4a1; 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 ht22-20020a170907609600b0072f4421550asi5851675ejc.297.2022.07.19.06.53.52; Tue, 19 Jul 2022 06:54:17 -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=18GJi4a1; 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 S242817AbiGSNCv (ORCPT + 99 others); Tue, 19 Jul 2022 09:02:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243066AbiGSNAR (ORCPT ); Tue, 19 Jul 2022 09:00:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0F785071A; Tue, 19 Jul 2022 05:25:31 -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 F060661912; Tue, 19 Jul 2022 12:25:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCD55C36AE2; Tue, 19 Jul 2022 12:25:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233530; bh=sLR9GzEa95OpEvmC8G+YIBsFoFoidxpreXI4ynraqzk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=18GJi4a1B3SaBEarBbpHnmv4yK65vGE0m6/sMmMG4tTaGXoAFKN0G/VzLrisbR7fz 5K+Wi+o9XuWpr65ockucQ3/E6WnJfhQNVlADR3KMh2pUb3inFpjOUOdFoWUL/uh+sp IsWrZKd1dIFCDfuaZ6HKTiOKrty6f9lUiON4o6Dc= 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 116/231] icmp: Fix a data-race around sysctl_icmp_errors_use_inbound_ifaddr. Date: Tue, 19 Jul 2022 13:53:21 +0200 Message-Id: <20220719114724.257227943@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 d2efabce81db7eed1c98fa1a3f203f0edd738ac3 ] While reading sysctl_icmp_errors_use_inbound_ifaddr, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 1c2fb7f93cb2 ("[IPV4]: Sysctl configurable icmp error source address.") 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 1a061d10949f..37ba5f042908 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -693,7 +693,7 @@ void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info, rcu_read_lock(); if (rt_is_input_route(rt) && - net->ipv4.sysctl_icmp_errors_use_inbound_ifaddr) + READ_ONCE(net->ipv4.sysctl_icmp_errors_use_inbound_ifaddr)) dev = dev_get_by_index_rcu(net, inet_iif(skb_in)); if (dev) diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 4cf2a6f560d4..33e65e79e46e 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_ratelimit", -- 2.35.1