diff options
author | Eric Dumazet <edumazet@google.com> | 2024-05-02 19:39:26 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2024-05-04 00:14:01 +0200 |
commit | c1742dcb6bda5fd535fbaa2145f0a180bc329aa6 (patch) | |
tree | 2552435caf76a6cf8dd78f0d734c953b517ace36 /net/core/net-sysfs.c | |
parent | tools: ynl: add --list-ops and --list-msgs to CLI (diff) | |
download | linux-c1742dcb6bda5fd535fbaa2145f0a180bc329aa6.tar.xz linux-c1742dcb6bda5fd535fbaa2145f0a180bc329aa6.zip |
net: no longer acquire RTNL in threaded_show()
dev->threaded can be read locklessly, if we add
corresponding READ_ONCE()/WRITE_ONCE() annotations.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/20240502173926.2010646-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to '')
-rw-r--r-- | net/core/net-sysfs.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 1f7f09e56771..4c27a360c294 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c @@ -605,13 +605,13 @@ static ssize_t threaded_show(struct device *dev, struct net_device *netdev = to_net_dev(dev); ssize_t ret = -EINVAL; - if (!rtnl_trylock()) - return restart_syscall(); + rcu_read_lock(); if (dev_isalive(netdev)) - ret = sysfs_emit(buf, fmt_dec, netdev->threaded); + ret = sysfs_emit(buf, fmt_dec, READ_ONCE(netdev->threaded)); + + rcu_read_unlock(); - rtnl_unlock(); return ret; } |