diff options
author | Jiri Pirko <jiri@mellanox.com> | 2019-03-24 13:14:29 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-03-24 21:55:31 +0300 |
commit | e0dcd386d1fc6ed9e90d76dfdf533287555d79d2 (patch) | |
tree | cfbb9fa93106a625d64eec5315516d77d0e1011c /net | |
parent | c3f10cbcaa3d5e1980733c3ccd0261df426412d2 (diff) | |
download | linux-e0dcd386d1fc6ed9e90d76dfdf533287555d79d2.tar.xz |
net: devlink: don't take devlink_mutex for devlink_compat_*
The netdevice is guaranteed to not disappear so we can rely that
devlink_port and devlink won't disappear as well. No need to take
devlink_mutex so don't take it here.
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/devlink.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/net/core/devlink.c b/net/core/devlink.c index bd4d8bce658d..65c1cf4a5764 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -6407,17 +6407,15 @@ void devlink_compat_running_version(struct net_device *dev, dev_hold(dev); rtnl_unlock(); - mutex_lock(&devlink_mutex); devlink = netdev_to_devlink(dev); if (!devlink || !devlink->ops->info_get) - goto unlock_list; + goto out; mutex_lock(&devlink->lock); __devlink_compat_running_version(devlink, buf, len); mutex_unlock(&devlink->lock); -unlock_list: - mutex_unlock(&devlink_mutex); +out: rtnl_lock(); dev_put(dev); } @@ -6425,22 +6423,22 @@ unlock_list: int devlink_compat_flash_update(struct net_device *dev, const char *file_name) { struct devlink *devlink; - int ret = -EOPNOTSUPP; + int ret; dev_hold(dev); rtnl_unlock(); - mutex_lock(&devlink_mutex); devlink = netdev_to_devlink(dev); - if (!devlink || !devlink->ops->flash_update) - goto unlock_list; + if (!devlink || !devlink->ops->flash_update) { + ret = -EOPNOTSUPP; + goto out; + } mutex_lock(&devlink->lock); ret = devlink->ops->flash_update(devlink, file_name, NULL, NULL); mutex_unlock(&devlink->lock); -unlock_list: - mutex_unlock(&devlink_mutex); +out: rtnl_lock(); dev_put(dev); |