Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp482122imn; Wed, 27 Jul 2022 11:25:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uL5ioBYOp9B2fsaXQ6ZWWDedqt65nTS2sWSOyR/EyqxFTUr39wJMynCVw+JVWOo89P78i+ X-Received: by 2002:a63:756:0:b0:41a:8d6b:792a with SMTP id 83-20020a630756000000b0041a8d6b792amr20233764pgh.432.1658946352650; Wed, 27 Jul 2022 11:25:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658946352; cv=none; d=google.com; s=arc-20160816; b=jYcgSzlfTmy9uBT+Mqos3UtKWrbwNDUJHZ1GcFg+hvTtPaYkTnPhVjQxdeWJrWxqEk bcgBu58xmyzFxG/YeakhoMBKq4ZLMH0iMwacZwqAUKTa9WN08qI33tpKo9sf1DimXYrC jZm9ymZjWLphkQDQm0A5t3biCOFIS3f/xHK77uA4ZCjVZYbGwR754e/x1QxFkjVCd75E YVRLeQiHZ6zB8NFOvE62r4i3pLXgGpXfYntOJEKYMzBC0n6KEeWtqbCGYdd6MeErBNf0 sYnJDPFTv/vzKcFzMvO/kh+JmqWElsaMwoHf5nWLqOTCLLxrdzkFkV7wE28MAeC98nL8 oqmw== 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=nEGxO0Ol+VbOc7FP+1PxECLvfG3G2tgQFwkkdtapfqY=; b=RDm0q9awpPBvuPGNdmqrzU59efVT5IVHNSJKJ5MiOdWq6ihJ3pqPqZqiJ70emNvzia tRl5A/FAfRY51u745g3t2FnYzIO0+dCH139zBp4VF5S4wHVsJXGjbJ658PMO9fptUk1X bKGuBOlrRA/EM06NUu1mzoUJlsRTEopBQjFJEumQLZGTQ5kuG36ArSTCdo1T2S8uycfC wTaQEeAvKpuJGXTK03jMuKd6rdtVblQyNxY9LlA2eDhL6kalXftos+GcKE3T6L0HINiP mclthnYJcAa+6ls3e6v47AIZkBzSo/wikrIUY1pd7GMg0KxSWhVw2AmRFXJzxSwprkV1 4KIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XJw8beJ0; 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 t73-20020a63784c000000b0040d9515987asi21316084pgc.62.2022.07.27.11.25.37; Wed, 27 Jul 2022 11:25:52 -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=XJw8beJ0; 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 S240248AbiG0QqX (ORCPT + 99 others); Wed, 27 Jul 2022 12:46:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240176AbiG0QpL (ORCPT ); Wed, 27 Jul 2022 12:45:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D19195F9B3; Wed, 27 Jul 2022 09:31:28 -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 23280B821C2; Wed, 27 Jul 2022 16:31:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F2F8C433D6; Wed, 27 Jul 2022 16:31:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658939485; bh=ljxSfJEmWLh3FCXueOr70/5vy8YC0vANe67kfev0fKs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XJw8beJ0zSDXepzCZgfineEx8ooG5Nm09TYHUR1PL2YlOgkmP+rgqOirsaj303N0T 4TzGwhmfy071AhxNMCryGhxqvFA3weOWEXIvSDT+nJiRQErdF8CakNnKy5Aos/Vls9 tlz8pYvTLzSxBah7SG4/Xksr460aI9fAuWZbuErM= 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 45/87] udp: Fix a data-race around sysctl_udp_l3mdev_accept. Date: Wed, 27 Jul 2022 18:10:38 +0200 Message-Id: <20220727161010.877370593@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 3d72bb4188c708bb16758c60822fc4dda7a95174 ] While reading sysctl_udp_l3mdev_accept, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 63a6fff353d0 ("net: Avoid receiving packets with an l3mdev on unbound UDP sockets") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- include/net/udp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/net/udp.h b/include/net/udp.h index 9787a42f7ed3..e66854e767dc 100644 --- a/include/net/udp.h +++ b/include/net/udp.h @@ -252,7 +252,7 @@ static inline bool udp_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_udp_l3mdev_accept, + return inet_bound_dev_eq(!!READ_ONCE(net->ipv4.sysctl_udp_l3mdev_accept), bound_dev_if, dif, sdif); #else return inet_bound_dev_eq(true, bound_dev_if, dif, sdif); -- 2.35.1