Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4372508imw; Tue, 19 Jul 2022 05:33:12 -0700 (PDT) X-Google-Smtp-Source: AGRyM1shx21cH6ODA7CRyGku/HIFF7FP9+p279MobKzz28er2EjODGY5bmoumFs7aIJfc5g7reSj X-Received: by 2002:a17:907:2c78:b0:72b:64f5:11ea with SMTP id ib24-20020a1709072c7800b0072b64f511eamr31153223ejc.68.1658233992448; Tue, 19 Jul 2022 05:33:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658233992; cv=none; d=google.com; s=arc-20160816; b=KWEBy4tctft/Op1txHflwjkifMXOqD2877Vx1rKbdlRGLEuCN+s1W37Nyldd8uTEuU KteHnFPQ80dRN+6g4XzYhiKst3olPpKrA+9H0ZOn7MrGItlf4a1MZjSN7lq7kHvshU+R VI06rJLKINM3xwRBr+Wi9nKPbblzgGa7fizUOHsnZx2V/RL8kD0JF/x5S0lckpBGxYq9 WrkD1bPuPS+kCTtRmgygU5eiaM6ehTPlA8Tay2p4JgXScb++rW5qDk2d100UYZv9fK7k +eoPOsKVd4oRVEF6Ta0nbzKBZ3DwDkNJ8FMuQ701ivLLfQF2ghhBiQhhFUu9HqA6ivFt 00xA== 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=UqlJZ3A9WtNNqExIvOLCspmaCq7tXjACDfK32tQPrTQ=; b=MhK71zzCpLdzMuv39hLWB8A/kN3Hy/pwXDpm/ThNYU4TXBqa5X1zMaP8ZlCNDaltag PtY81NuBpJg1xgCuGkK9AmdKxJ2wHrlecoSKpD6oIIYsUehcLzQxOZb8Oi4eIUD72Dgr Eq0pG9k3D3rPaAYVcwM7bd61F6gF20o5qDoG7HnbTP/m0dzn7vPS75AE+Sl80aFPRYdt yMzkg9Eek5Ygc4tWIfysGK5h9wguslWR7xMEeksu3h0uGSenFJBLlsnxkP5jMDvh8UJx YBXWXmlNPvYVVdCLfBi8zEWJhfJxJFRjoULhfUIcJkwxBsjHIYEJFVHur2XQUQo9Pebu wiKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D8lqJ3Wl; 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 go6-20020a1709070d8600b0072aa141095asi21647973ejc.0.2022.07.19.05.32.47; Tue, 19 Jul 2022 05:33:12 -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=D8lqJ3Wl; 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 S238768AbiGSMLi (ORCPT + 99 others); Tue, 19 Jul 2022 08:11:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238908AbiGSMJt (ORCPT ); Tue, 19 Jul 2022 08:09:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1CAD509E2; Tue, 19 Jul 2022 05:02:48 -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 1FD55616B7; Tue, 19 Jul 2022 12:02:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0101EC341C6; Tue, 19 Jul 2022 12:02:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232167; bh=cZgTHkVtlok+T5XHfZpzvaVm/8OrIF2Ls//nqAw6xA0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D8lqJ3WlHgBiTg0t8faq85PsP2u0eZDD8r23rJb9T9MIc2xrW9xuZRcz0DlhF9Rc2 gNrTNUZUPOzYRNlL4QMx6LZSVkJNyoBvqyJFCoUd0CRoZnVMnOoClIjb1isaJ+bdgM 2wn1E94PvHwobfujZcub1sOvMPxlsQbNNrS1U5wA= 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 36/71] raw: Fix a data-race around sysctl_raw_l3mdev_accept. Date: Tue, 19 Jul 2022 13:53:59 +0200 Message-Id: <20220719114555.772754578@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114552.477018590@linuxfoundation.org> References: <20220719114552.477018590@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 1dace014928e6e385363032d359a04dee9158af0 ] While reading sysctl_raw_l3mdev_accept, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 6897445fb194 ("net: provide a sysctl raw_l3mdev_accept for raw socket lookup with VRFs") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- include/net/raw.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/net/raw.h b/include/net/raw.h index 8ad8df594853..c51a635671a7 100644 --- a/include/net/raw.h +++ b/include/net/raw.h @@ -75,7 +75,7 @@ static inline bool raw_sk_bound_dev_eq(struct net *net, int bound_dev_if, int dif, int sdif) { #if IS_ENABLED(CONFIG_NET_L3_MASTER_DEV) - return inet_bound_dev_eq(!!net->ipv4.sysctl_raw_l3mdev_accept, + return inet_bound_dev_eq(READ_ONCE(net->ipv4.sysctl_raw_l3mdev_accept), bound_dev_if, dif, sdif); #else return inet_bound_dev_eq(true, bound_dev_if, dif, sdif); -- 2.35.1