diff options
author | Eric Dumazet <edumazet@google.com> | 2024-02-13 07:32:33 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2024-02-14 12:20:13 +0100 |
commit | 1c07dbb0cccfe85060b6eb089db3d6bfeb6aaf31 (patch) | |
tree | e25a4f32e31aeb6456faf5ab66b9f2576ce33056 /net/core/net-sysfs.c | |
parent | Merge branch 'per-epoll-context-busy-poll' (diff) | |
download | linux-1c07dbb0cccfe85060b6eb089db3d6bfeb6aaf31.tar.xz linux-1c07dbb0cccfe85060b6eb089db3d6bfeb6aaf31.zip |
net: annotate data-races around dev->name_assign_type
name_assign_type_show() runs locklessly, we should annotate
accesses to dev->name_assign_type.
Alternative would be to grab devnet_rename_sem semaphore
from name_assign_type_show(), but this would not bring
more accuracy.
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, 2 insertions, 2 deletions
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index a09d507c5b03..f4c2b8267495 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c @@ -125,7 +125,7 @@ static DEVICE_ATTR_RO(iflink); static ssize_t format_name_assign_type(const struct net_device *dev, char *buf) { - return sysfs_emit(buf, fmt_dec, dev->name_assign_type); + return sysfs_emit(buf, fmt_dec, READ_ONCE(dev->name_assign_type)); } static ssize_t name_assign_type_show(struct device *dev, @@ -135,7 +135,7 @@ static ssize_t name_assign_type_show(struct device *dev, struct net_device *ndev = to_net_dev(dev); ssize_t ret = -EINVAL; - if (ndev->name_assign_type != NET_NAME_UNKNOWN) + if (READ_ONCE(ndev->name_assign_type) != NET_NAME_UNKNOWN) ret = netdev_show(dev, attr, buf, format_name_assign_type); return ret; |