diff options
author | Eric Dumazet <edumazet@google.com> | 2024-02-13 06:32:39 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2024-02-14 11:20:13 +0000 |
commit | 004d138364fd10dd5ff8ceb54cfdc2d792a7b338 (patch) | |
tree | 19491864f7a5306175afb03f896047725ffe281f /net/core/net-sysfs.c | |
parent | c7d52737e7ebd31cc5fef46380d94b58becf9479 (diff) | |
download | linux-stable-004d138364fd10dd5ff8ceb54cfdc2d792a7b338.tar.gz linux-stable-004d138364fd10dd5ff8ceb54cfdc2d792a7b338.tar.bz2 linux-stable-004d138364fd10dd5ff8ceb54cfdc2d792a7b338.zip |
net-sysfs: convert dev->operstate reads to lockless ones
operstate_show() can omit dev_base_lock acquisition only
to read dev->operstate.
Annotate accesses to dev->operstate.
Writers still acquire dev_base_lock for mutual exclusion.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/net-sysfs.c')
-rw-r--r-- | net/core/net-sysfs.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 23ef2df549c3..c5d164b8c6bf 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c @@ -325,11 +325,9 @@ static ssize_t operstate_show(struct device *dev, const struct net_device *netdev = to_net_dev(dev); unsigned char operstate; - read_lock(&dev_base_lock); - operstate = netdev->operstate; + operstate = READ_ONCE(netdev->operstate); if (!netif_running(netdev)) operstate = IF_OPER_DOWN; - read_unlock(&dev_base_lock); if (operstate >= ARRAY_SIZE(operstates)) return -EINVAL; /* should not happen */ |