Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1882553lql; Wed, 13 Mar 2024 10:41:52 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUVs6HklHQhPfHWafyA9OdWupkFQidecQMs7DvH9oomv4h3lfqA1fBBp5xefuy/3LskaXmHqDWkWMmXqhTO/8GgQoVPQ/LTkihTQ7DkeA== X-Google-Smtp-Source: AGHT+IHL74UPnfjgfGtNWJue3kiw9Qfrap8/L2WFpDyNigljbqxARt6Y+DvVm5v4A8OUXgeaFdzt X-Received: by 2002:a17:90b:400f:b0:29b:d899:e7a7 with SMTP id ie15-20020a17090b400f00b0029bd899e7a7mr5150842pjb.7.1710351712567; Wed, 13 Mar 2024 10:41:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710351712; cv=pass; d=google.com; s=arc-20160816; b=kDZ1PDOKvhzXO45QuN9lAy/GR5/rUQBIcElMeSdKLYHzFR4qM/XlLNnGKe5b2BmtI4 W4g3gn53M3z3Q13XcUZ0lKEBOz7OfPs6GhkGDrnX+glnPKHYuWTKRV71gvxVKPdRfNbQ l1wS748O1XfTj0kNCWRYGPEVXbixesuo9rwaZKf0df68OPXwU9OSbxzaZWMeUWxsENHU qNSTbDKiKRLy4oXyyNg3D3dzjdX6mwiIQFY/ZWMraMkyvDJRvI1hYxRmtQHeapow1OaB CC3AphlEMDUQ/n85daLdmPpHPMFDd1GbT+psDk0UZcsYS5W0tOsPQdO3rNAWWOA2aW4+ MnFA== 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=gYp1hQCaPFcZTjUKy8u5OSEOMQEIR0HhtlaP7tfBAzI=; fh=UDybChT8th3KBBN/dtQlnvIe4LqqY5GN+FXyISH2BnE=; b=g0GJ2Inoq82zWJxzqjEI5VsaOD/4mUnZmgFFPAsQRZ6UkQaVS+7o/lQcix4Gnqtyl5 d3C9Cd0fKHcF0Kh420nvP8pvmxF7hJNg8K2xjKjX+xtXf705p9oU62AL87JhjO9n4q2K 9jo347pfB16dXpoMoZvEn/0n1DS6s1y+T+7ok9r9Zo3MdHSzbecFVwCIbodTGvuhldGT MdpdTzNtTAMSGoMQe9xYELuZVq8TGEjlVSbjG5nQot5j7dt3gIZPzN0glQ050TD4RpkJ zPbgvEy4IwhgBUpO4HH6bp+uJc9FAqXJQHeGYrah1Ril8P3LC/r3dl4PZ+d47jttMVaQ koIQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rLAoBrj5; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-101967-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101967-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id z1-20020a17090ad78100b0029a909d33easi647335pju.21.2024.03.13.10.41.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 10:41:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-101967-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rLAoBrj5; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-101967-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101967-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id B6A45B2299F for ; Wed, 13 Mar 2024 17:27:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2EA93143C7D; Wed, 13 Mar 2024 16:42:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rLAoBrj5" 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 4518313F431; Wed, 13 Mar 2024 16:42:56 +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=1710348176; cv=none; b=sCsbxFm1ubHdOb3Wxbi+GCrUnIuVbxw/rtd/rqsq05rqGDHQJCf5QT31rid/zbBjfO0HkcKzmEiQfN6tGRxUfEgGwhoisl9aFeC36kONlFbRlFvWBakE9l1xF92iBZeZmNshNMFyKSCYy5MQrQBSsvIOrTraLVEmFh87Vpa0+08= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710348176; c=relaxed/simple; bh=t9cB5tJirBxb/oPgBSz64yZsV3dGZtpPI1QZkEyTRRA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TIdbwAhRi1gNS3lyIhaWECubxqKrWowiofxTRPbP+RmQ0iAVOrHJFKQDoXkYmfgnOxfUOuV5N8XaBpngVV25kJTNGIV4IJSTY4NY/szghwOPQ5EiBYZ9XnOl+7d0JpY97YJ2GAhIormYV9J0yL86sGR4FUvnaizCs+AkXih1qCI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rLAoBrj5; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70C1EC433F1; Wed, 13 Mar 2024 16:42:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710348176; bh=t9cB5tJirBxb/oPgBSz64yZsV3dGZtpPI1QZkEyTRRA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rLAoBrj5p4QOguTkykSVXFiJ7RCgawKCf1ElncdcmRVeMuCfS/uyGxJGcVN0gUG37 SkWvc1gKxSgD+JSfxCr6CmXmONVUv2vLiizesuQ+OwXxQjQi/IGmrXxWfOVVXksCV/ 1ghYB23gmUUsvWsNRPova60Xpq6aBfNS6aPsvv1YUhrA6076K8ve2+APzQRFpL41X2 a9lfFXuvulLkqgyvBgtacgtv1JXId1cTDDsUaFn7FomKfSjdOB19LgTsL3Tg4G/RMg KkZZHYYzY8HQ0qYk3BHHp0V+ZtgSnxzs0TS7BjMBhKgm1hVjLqsztE81QDBtyVHcpZ k0JyA4mtMehMg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jason Xing , Paolo Abeni , Sasha Levin Subject: [PATCH 5.15 27/76] netrom: Fix data-races around sysctl_net_busy_read Date: Wed, 13 Mar 2024 12:41:34 -0400 Message-ID: <20240313164223.615640-28-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240313164223.615640-1-sashal@kernel.org> References: <20240313164223.615640-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/v5.x/stable-review/patch-5.15.152-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.15.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.15.152-rc1 X-KernelTest-Deadline: 2024-03-15T16:42+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 376b6af431448..37d0bf6cab456 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