netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Xing <kerneljasonxing@gmail.com>
To: ralf@linux-mips.org, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com
Cc: linux-hams@vger.kernel.org, netdev@vger.kernel.org,
	kerneljasonxing@gmail.com, Jason Xing <kernelxing@tencent.com>
Subject: [PATCH net 04/12] netrom: Fix a data-race around sysctl_netrom_transport_timeout
Date: Mon,  4 Mar 2024 16:20:38 +0800	[thread overview]
Message-ID: <20240304082046.64977-5-kerneljasonxing@gmail.com> (raw)
In-Reply-To: <20240304082046.64977-1-kerneljasonxing@gmail.com>

From: Jason Xing <kernelxing@tencent.com>

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 <kernelxing@tencent.com>
---
 net/netrom/af_netrom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 0eed00184adf..4d0e0834d527 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -453,7 +453,7 @@ static int nr_create(struct net *net, struct socket *sock, int protocol,
 	nr_init_timers(sk);
 
 	nr->t1     =
-		msecs_to_jiffies(sysctl_netrom_transport_timeout);
+		msecs_to_jiffies(READ_ONCE(sysctl_netrom_transport_timeout));
 	nr->t2     =
 		msecs_to_jiffies(sysctl_netrom_transport_acknowledge_delay);
 	nr->n2     =
-- 
2.37.3


  parent reply	other threads:[~2024-03-04  8:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-04  8:20 [PATCH net 00/12] netrom: Fix all the data-races around sysctls Jason Xing
2024-03-04  8:20 ` [PATCH net 01/12] netrom: Fix a data-race around sysctl_netrom_default_path_quality Jason Xing
2024-03-04  8:20 ` [PATCH net 02/12] netrom: Fix a data-race around sysctl_netrom_obsolescence_count_initialiser Jason Xing
2024-03-04  8:20 ` [PATCH net 03/12] netrom: Fix data-races around sysctl_netrom_network_ttl_initialiser Jason Xing
2024-03-04  8:20 ` Jason Xing [this message]
2024-03-04  8:20 ` [PATCH net 05/12] netrom: Fix a data-race around sysctl_netrom_transport_maximum_tries Jason Xing
2024-03-04  8:20 ` [PATCH net 06/12] netrom: Fix a data-race around sysctl_netrom_transport_acknowledge_delay Jason Xing
2024-03-04  8:20 ` [PATCH net 07/12] netrom: Fix a data-race around sysctl_netrom_transport_busy_delay Jason Xing
2024-03-04  8:20 ` [PATCH net 08/12] netrom: Fix a data-race around sysctl_netrom_transport_requested_window_size Jason Xing
2024-03-04  8:20 ` [PATCH net 09/12] netrom: Fix a data-race around sysctl_netrom_transport_no_activity_timeout Jason Xing
2024-03-04  8:20 ` [PATCH net 10/12] netrom: Fix a data-race around sysctl_netrom_routing_control Jason Xing
2024-03-04  8:20 ` [PATCH net 11/12] netrom: Fix a data-race around sysctl_netrom_link_fails_count Jason Xing
2024-03-04  8:20 ` [PATCH net 12/12] netrom: Fix data-races around sysctl_net_busy_read Jason Xing
2024-03-07  9:36 ` [PATCH net 00/12] netrom: Fix all the data-races around sysctls Paolo Abeni
2024-03-07  9:43   ` Jason Xing
2024-03-07 10:00 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240304082046.64977-5-kerneljasonxing@gmail.com \
    --to=kerneljasonxing@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kernelxing@tencent.com \
    --cc=kuba@kernel.org \
    --cc=linux-hams@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=ralf@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).