Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp485341imn; Wed, 27 Jul 2022 11:31:06 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uqFXhNgwFIOWA14IIjyAxlBpZzjABm5oJhZ3dSzDsUPOl/5ljNe5BA0mpTvo2vK98QUlIa X-Received: by 2002:a63:d004:0:b0:41a:aea0:95bc with SMTP id z4-20020a63d004000000b0041aaea095bcmr19511814pgf.26.1658946665700; Wed, 27 Jul 2022 11:31:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658946665; cv=none; d=google.com; s=arc-20160816; b=SPwlOrYCaYSdLwu8UHr6twHw/xIMQapn4jB7T6inBi7CcmS4n7aUM+52PeeA7KOmcW y584EVUw9unwxXQIlr7uEPxPcyIojieSmx/fgL5WEM9sI5OHRP3cK08z91oLnuhTlOuI dweY2Xwl9T9d5p0iLHXaACT+q0vjSNLK7iZhXR5zConBS2V1Hl/pBKTKl5muSBHFTa7y 3oQJywM32hbaZDcR/R6Ck714dN0xotIrOgA2AT4yBstxvQm8Ek5LXxHYJTdqSAWj27JH 8Gbp8YUwwFA8Cb6i6emwuT4L0YRL35gMKl5wr93Sg+zM62q+zpUmp8Ze8Ot98RIyqo6D eHqg== 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=EQpsCds3JgM7BBToUFKQ7vcvN9Gqrwi5kmQTmjhLNYE=; b=KxKdYu5hsl6NG/qBld+qtu7u3mKq5n1AqBvEfSkq4Difh4P5ojOEd6yAMja8jaYkFi 5SWkZE99HKnRexj6o6illiA6beBq0T+OvgVwOH5KcmhdPZy3QEi4XU8GvUfmHbaoA1or DgLmb3HuHWpa8XLD/a61mQJ4AUmthG2pNV+b+5CcNHiaqNs7lViUvm72t+KlxrUBDJai 5zyNskVXtQavQAO2q89zW1QFSvdZQaZeMsX+rL6AG0f9l4Hbzfyn9ulh8AlqJFUpbTDG ytCY4izTmUuAETNKogWmt6f7aQljWyM70YV8ki3wHrgf3m3jYewCKNPpDGfKSq6odbfN u+MQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AlIjts3F; 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 j69-20020a638048000000b0041b2ac98bfcsi2661388pgd.406.2022.07.27.11.30.49; Wed, 27 Jul 2022 11:31:05 -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=AlIjts3F; 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 S238965AbiG0Qlr (ORCPT + 99 others); Wed, 27 Jul 2022 12:41:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239570AbiG0QlA (ORCPT ); Wed, 27 Jul 2022 12:41:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 382AC5140C; Wed, 27 Jul 2022 09:29:32 -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 D2443B821BD; Wed, 27 Jul 2022 16:29:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F6E9C433C1; Wed, 27 Jul 2022 16:29:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658939369; bh=Lk+Blne/blYZaB0qzZO5oWNuvyqkY7TzTtvAIAIPXgs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AlIjts3Fk/Umj1Pk5ZBZhWE8P5OKnZbxcYTe+FAP+VtjaNjzbiy+r9rureqVnoCzh UAMa1RKkAjXry66KK0vqn5qDCFeeOozsmjVsNbXcvbG3RYaKGsPHyp3JO4UMIn3gTm 3x2qKu+iUHuLTQ0S5c554lQEtIx2N7PL3UvelcZU= 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.4 44/87] ipv4: Fix a data-race around sysctl_fib_multipath_use_neigh. Date: Wed, 27 Jul 2022 18:10:37 +0200 Message-Id: <20220727161010.838337691@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727161008.993711844@linuxfoundation.org> References: <20220727161008.993711844@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.7 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 87507bcb4f5de16bb419e9509d874f4db6c0ad0f ] While reading sysctl_fib_multipath_use_neigh, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: a6db4494d218 ("net: ipv4: Consider failed nexthops in multipath routes") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv4/fib_semantics.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index 16fe03461563..28da0443f3e9 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c @@ -2209,7 +2209,7 @@ void fib_select_multipath(struct fib_result *res, int hash) } change_nexthops(fi) { - if (net->ipv4.sysctl_fib_multipath_use_neigh) { + if (READ_ONCE(net->ipv4.sysctl_fib_multipath_use_neigh)) { if (!fib_good_nh(nexthop_nh)) continue; if (!first) { -- 2.35.1