Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1931984lql; Wed, 13 Mar 2024 12:12:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXD4UCWDuuWBKOHfvnHzuTTPhZDE80kaTBDZ4jSyRdqHu774R0RZOIY0F/8kYigD/75vBK4SFE7lk1vIup3K7vA7lpFkcg+6lkjpKnXqQ== X-Google-Smtp-Source: AGHT+IGXIo2rxcMZDrkTOlQtnJwmGhHuBYm9A67GM4GcOmMd+MrrBL9dICPv0iPsGWm36joO5e5L X-Received: by 2002:a17:907:c313:b0:a46:58b4:a34a with SMTP id tl19-20020a170907c31300b00a4658b4a34amr2624619ejc.47.1710357170641; Wed, 13 Mar 2024 12:12:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710357170; cv=pass; d=google.com; s=arc-20160816; b=quGqDCrQTSjQfRmXXdWeGwJFkpTtoP5bfxBYxZHUGgckuyZAvwBBDDR5Hxxfp9iqwd ff/EeTEIrmEUx6oHMNisVU3gaclKFlCcbQBw3TtKZwaLdAe+AmbKmW92bqlfOXuTNVqp ZS1TWOqzwo98iBOa9gCAHV0EJLqujL1UKWnzADjiuQm48SHMTBEH/I+M+eNLoCKBCDED eLjrWsJ8hBFiEysI8UcmP5fohSYOhcr6tXRwDcTjQoy/TBk1m1eekcbptpwtWjKGjok9 Wqo7qoOevBXIBfV3IXuKTMFjVnWkGgcTHwgZftuPF0GVEebSFeOs9aT6IfC7hbN22cg3 sH1Q== 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=VrC98zwAFiyHRvchPhHjbMW0m43W1eSOscwbQQdlxoY=; fh=UDybChT8th3KBBN/dtQlnvIe4LqqY5GN+FXyISH2BnE=; b=ZrwCwK9m9ZgGsMLBnSI1exjofP5guDacvB1C5s4uKXOieJFb78xW7xMAcmFEf/bQTp p9Ncf+iOGyGcMZXM9+nhV6hG6WGQ/9LSGHsTtiy7co4vxsAAXZcSqq26degSp1XIPl/G IGgdy9rRpGd3BFfA8ygXuh/4zUuTDJAuMvB6MWXmuaMKvXQbH2+oJ2ER468tIjMqz//4 eIkkhvZEABV8bJWFrF3nw13qNPCfI4Gje1Kxpz8zPoCjeSZhzpdUNyMCnHSDeG3ciImr dH+CMKUhV8C3Ps9CqepoR6WxEiQDZXUiqjOurmy6Pvpdby0Nw4YKCIaccKSdmY8W/53V 3/AA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hT3XXRvk; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-102055-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102055-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id f12-20020a170906048c00b00a45ead7b3e2si4632631eja.647.2024.03.13.12.12.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 12:12:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-102055-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hT3XXRvk; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-102055-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102055-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 1A1271F2CB96 for ; Wed, 13 Mar 2024 17:47:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0DD01155A22; Wed, 13 Mar 2024 16:47:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hT3XXRvk" 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 313DA15530B; Wed, 13 Mar 2024 16:47:14 +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=1710348434; cv=none; b=NCuhb1QqvrOB+44HcGpZQ5E3S3iZdmnwagAt75LPHX474MkFw+InhMtQwDAaX7GpHVG6RogPGW05uoRKEkGYVYAaaIZVtjiV7AWbXBBhxyzQ2sfrGyrbtDrysmOFeh+ssCb4C0VGG3i9dkIZvJuzfuRa8pY3qCHY8urfocrQG14= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710348434; c=relaxed/simple; bh=VOUAc+hS+8LXXjO/8xjaKP/C6ALJcpsGzO3/KKcZsro=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cHhLZQ+lbSjuzz6yLSILVVopCKS8/S/nd9Uv/XxADHD1TROQVnqhh1+Xcaa89SezOe93Remv8612AildYeZN/WkB2NwIXJH1aIN6coQgGJnYs5lh5tZzjdM6Np+W+lsoC4GYvwU5dEJyJ9g8oTf28Hq+V+mmd/4HHvCKva2P260= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hT3XXRvk; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51087C43390; Wed, 13 Mar 2024 16:47:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710348434; bh=VOUAc+hS+8LXXjO/8xjaKP/C6ALJcpsGzO3/KKcZsro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hT3XXRvk91gKer0LC4WRjZO538Ah3PUDazs2Ul3oldCfv+f5BnQtScH9v30ESE6ds z7oLwC8bEWcrwhbbWAFrOFYcJ6RAMqQcf5TrmR+uHhvTTaleN9Oc6KqJ4uy26F7HTC NmWUzka1E4Z5t40K35t5/reR0ykVAQKOy1zlnLaayv/GpPv34km7qO4bn0SYSkMPIN 9sXgGa6vwMLFzbM4XKPOI9009m8QnebIWEnQpkzU9LbqGDHn9pU36kA4fGsuQFJ2wD a5QXb5dJrgyIKuSkVRBLZaJgfMFUDMk/svWpAquZBtiTfJMjO+6suZ22AH4gXkf7Lb KE9YLeRXJNCTg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jason Xing , Paolo Abeni , Sasha Levin Subject: [PATCH 5.10 29/73] netrom: Fix data-races around sysctl_net_busy_read Date: Wed, 13 Mar 2024 12:45:56 -0400 Message-ID: <20240313164640.616049-30-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240313164640.616049-1-sashal@kernel.org> References: <20240313164640.616049-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.10.213-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.10.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.10.213-rc1 X-KernelTest-Deadline: 2024-03-15T16:46+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 69e58906c32b1..034f79d11ae11 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; @@ -263,7 +263,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