diff options
author | Eric Dumazet <edumazet@google.com> | 2024-02-13 06:32:33 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2024-02-14 11:20:13 +0000 |
commit | 1c07dbb0cccfe85060b6eb089db3d6bfeb6aaf31 (patch) | |
tree | e25a4f32e31aeb6456faf5ab66b9f2576ce33056 /net/core/dev.c | |
parent | b7f9ef72783927d152f362912889b72948f49e23 (diff) | |
download | lwn-1c07dbb0cccfe85060b6eb089db3d6bfeb6aaf31.tar.gz lwn-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/dev.c')
-rw-r--r-- | net/core/dev.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 2d02ca8a3da5..720bd6838212 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -1228,13 +1228,13 @@ int dev_change_name(struct net_device *dev, const char *newname) dev->flags & IFF_UP ? " (while UP)" : ""); old_assign_type = dev->name_assign_type; - dev->name_assign_type = NET_NAME_RENAMED; + WRITE_ONCE(dev->name_assign_type, NET_NAME_RENAMED); rollback: ret = device_rename(&dev->dev, dev->name); if (ret) { memcpy(dev->name, oldname, IFNAMSIZ); - dev->name_assign_type = old_assign_type; + WRITE_ONCE(dev->name_assign_type, old_assign_type); up_write(&devnet_rename_sem); return ret; } @@ -1263,7 +1263,7 @@ rollback: down_write(&devnet_rename_sem); memcpy(dev->name, oldname, IFNAMSIZ); memcpy(oldname, newname, IFNAMSIZ); - dev->name_assign_type = old_assign_type; + WRITE_ONCE(dev->name_assign_type, old_assign_type); old_assign_type = NET_NAME_RENAMED; goto rollback; } else { |