Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1850627lql; Wed, 13 Mar 2024 09:48:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXW68wJFoyVR6TBXZs5tNjCIQegl2Q9yiX2CQ+cS8K3jo1mVSYWGCk49rMDqy4bteDHi/YMYg8biw/8vA6+/E3uUYARG6TP23Gja4VjAg== X-Google-Smtp-Source: AGHT+IGEA2p5wiuW7QtVkmHI7j1eys8qfSivftA8PG6NVZXmNa3UaRmu5w5l0F4JNmm281mRTwyz X-Received: by 2002:a17:902:eb49:b0:1dd:925d:37e6 with SMTP id i9-20020a170902eb4900b001dd925d37e6mr3628815pli.38.1710348482533; Wed, 13 Mar 2024 09:48:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710348482; cv=pass; d=google.com; s=arc-20160816; b=tI62VwJ0bhaobwes+77t/EminVKUFSM1QRRec3F6PiNDfWXqHkrETFsW4mnhMMqzXS Uty9Sa1QisEAhilOcwk8XUNKL7JQdKMuNfftNxBb0Fjy2sTkJe+SYCmZCzScpGt8QEhI 0wPDaIihZWfzjlvMusgcFr/S6MK7tUkDRaP3HsWFV1LfgUD4WG9SObxOA4zeAUvpd8NA zrlPXm/0qK3cFEnQcRSVFkjH8jyPe+HzE9k8BB2gXu5crJlEPs7PT6JZwmqVrkngVPF7 +F0StKpKR14VnNIUVdO01fjGBdA/alZfxD6JMLIHnLm7VAkGRbZ+i4/3VQ+lXjTeHfmv +HOg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=378W0LPQ/SKb39+7FGxYitLXaLxYJ1t+GxKyNthcEy4=; fh=UDybChT8th3KBBN/dtQlnvIe4LqqY5GN+FXyISH2BnE=; b=qw7BGAyHsTgIXMuBGi9phkrwbp+GzFTmtsJ1MxGIalTsNHqGCSYOd4pXxzIgasSt2J 0DAks0QANVxGWuV9rYY06UiOg4TEMl+UJjB0ruRGlKFAwxIQee9ZGwKVKCQSYPCC0QL8 RcDFPCtjQx44rYF/sxfhE6eofF2rZJnPccLpaGzX5SiLDrI3o+cjpIlqSKuB0JkhS3A+ VX+jjPAYnZ8F059CU5XUpon5mQkTsYpfgdcYF8BHOdFb9CHqen13S5AryvXBCPekeblo wXWpO6MnwzH8JkYITltGkUR9Z3AzI6JF+SA2awj6hMuxi+VqWMC5ikde+RG+4UDAwQw4 ogsQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=H+GJp+m8; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-101793-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101793-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id q13-20020a170902c74d00b001d93327867bsi8768427plq.286.2024.03.13.09.48.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 09:48:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-101793-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=H+GJp+m8; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-101793-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101793-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7456E2885C6 for ; Wed, 13 Mar 2024 16:45:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 41A60664B0; Wed, 13 Mar 2024 16:34:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="H+GJp+m8" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 66D0A53E07; Wed, 13 Mar 2024 16:33:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710347639; cv=none; b=RMSCoEzuN3vEv1nHAfmA50yTIzQfKk1pGZj2kggxUijUg+ImpbeLvZNCBIucNTK7cKAGh1aZThV0A9XpQcw8UWodMBu4FWA9jeC0PXVXDFGG16T4lYAmx+7kRILLZYBp8QwY/Yp6XWRAqMBdvbddx2MKb0bXa8ZnrCGq468pA6I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710347639; c=relaxed/simple; bh=uceiJn9MmczvLpE4a4peQ219intlBRN+tOouana73jc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bgMhXEZdZaoQoJSHIxpHif/xEe0H94JKWhM79DqoCnQIjzg1pZcKBAhrF36GVQyt5YRgtSx6itHcjp3hsFXEuG+2QQKmWPFzJXq7bGnzAOZPnj8EynuFe1vyJEvADEQSoLr6FuH5Av3g1jVNGW3U012CQp4eHrmIZ+lGxptGXFQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=H+GJp+m8; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4393AC43390; Wed, 13 Mar 2024 16:33:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710347639; bh=uceiJn9MmczvLpE4a4peQ219intlBRN+tOouana73jc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H+GJp+m8sIH1+XomXTrf1TMioozgx7T8pDKFLvW6glhEzt0tea/jW0Z07rm74f85K cPPogOhvBUcmmupwH/nOJl74qmdyi72ReFrywQALlcHAQ7I1actSqUXwVDNTS1e5sH vOiBPPfMhVMo/phiGgLgXsmk+48BB/h28CgmHjD5ledARNP30SecZs916EnYXXz3pQ b+yHeLQdn1s5apjx/jkm2VydyDrMQmsMeI5Vds0N0bozF1MCuxOUgwkoe8TwA3xTiX QZ3UB02X7xA9aDJLNRQDzKA5Q2sN+LJ/OYMH6Lmm6h0xNDgd6cpRLkXhFY5N+6j8iM tGPfNBemMXHpg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jason Xing , Paolo Abeni , Sasha Levin Subject: [PATCH 6.7 54/61] netrom: Fix data-races around sysctl_net_busy_read Date: Wed, 13 Mar 2024 12:32:29 -0400 Message-ID: <20240313163236.613880-55-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240313163236.613880-1-sashal@kernel.org> References: <20240313163236.613880-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.7.10-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-6.7.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 6.7.10-rc1 X-KernelTest-Deadline: 2024-03-15T16:32+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Jason Xing [ Upstream commit d380ce70058a4ccddc3e5f5c2063165dc07672c6 ] We need to protect the reader reading the sysctl value because the value can be changed concurrently. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Jason Xing Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- net/netrom/af_netrom.c | 2 +- net/netrom/nr_in.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c index 1671be042ffef..104a80b75477f 100644 --- a/net/netrom/af_netrom.c +++ b/net/netrom/af_netrom.c @@ -954,7 +954,7 @@ int nr_rx_frame(struct sk_buff *skb, struct net_device *dev) * G8PZT's Xrouter which is sending packets with command type 7 * as an extension of the protocol. */ - if (sysctl_netrom_reset_circuit && + if (READ_ONCE(sysctl_netrom_reset_circuit) && (frametype != NR_RESET || flags != 0)) nr_transmit_reset(skb, 1); diff --git a/net/netrom/nr_in.c b/net/netrom/nr_in.c index 2f084b6f69d7e..97944db6b5ac6 100644 --- a/net/netrom/nr_in.c +++ b/net/netrom/nr_in.c @@ -97,7 +97,7 @@ static int nr_state1_machine(struct sock *sk, struct sk_buff *skb, break; case NR_RESET: - if (sysctl_netrom_reset_circuit) + if (READ_ONCE(sysctl_netrom_reset_circuit)) nr_disconnect(sk, ECONNRESET); break; @@ -128,7 +128,7 @@ static int nr_state2_machine(struct sock *sk, struct sk_buff *skb, break; case NR_RESET: - if (sysctl_netrom_reset_circuit) + if (READ_ONCE(sysctl_netrom_reset_circuit)) nr_disconnect(sk, ECONNRESET); break; @@ -262,7 +262,7 @@ static int nr_state3_machine(struct sock *sk, struct sk_buff *skb, int frametype break; case NR_RESET: - if (sysctl_netrom_reset_circuit) + if (READ_ONCE(sysctl_netrom_reset_circuit)) nr_disconnect(sk, ECONNRESET); break; -- 2.43.0