summaryrefslogtreecommitdiff
path: root/net/core/net-sysfs.c
diff options
context:
space:
mode:
authorStanislav Fomichev <sdf@fomichev.me>2025-03-12 12:05:12 -0700
committerPaolo Abeni <pabeni@redhat.com>2025-03-19 18:52:00 +0100
commit8033d2aef51722fe74068b52553625ed91ea256c (patch)
tree6910b7f09c5c94632c251b1564cb17f9330682a9 /net/core/net-sysfs.c
parent756f88ff9c6ae3d059180813102610c39ea99c27 (diff)
Revert "net: replace dev_addr_sem with netdev instance lock"
This reverts commit df43d8bf10316a7c3b1e47e3cc0057a54df4a5b8. Cc: Kohei Enju <enjuk@amazon.com> Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com> Fixes: df43d8bf1031 ("net: replace dev_addr_sem with netdev instance lock") Signed-off-by: Stanislav Fomichev <sdf@fomichev.me> Link: https://patch.msgid.link/20250312190513.1252045-2-sdf@fomichev.me Tested-by: Lei Yang <leiyang@redhat.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'net/core/net-sysfs.c')
-rw-r--r--net/core/net-sysfs.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 529a0f721268..abaa1c919b98 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -263,11 +263,14 @@ static ssize_t address_show(struct device *dev, struct device_attribute *attr,
struct net_device *ndev = to_net_dev(dev);
ssize_t ret = -EINVAL;
- netdev_lock(ndev);
+ down_read(&dev_addr_sem);
+
+ rcu_read_lock();
if (dev_isalive(ndev))
ret = sysfs_format_mac(buf, ndev->dev_addr, ndev->addr_len);
- netdev_unlock(ndev);
+ rcu_read_unlock();
+ up_read(&dev_addr_sem);
return ret;
}
static DEVICE_ATTR_RO(address);