Commit e0dcd386 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

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: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c3f10cbc
...@@ -6407,17 +6407,15 @@ void devlink_compat_running_version(struct net_device *dev, ...@@ -6407,17 +6407,15 @@ void devlink_compat_running_version(struct net_device *dev,
dev_hold(dev); dev_hold(dev);
rtnl_unlock(); rtnl_unlock();
mutex_lock(&devlink_mutex);
devlink = netdev_to_devlink(dev); devlink = netdev_to_devlink(dev);
if (!devlink || !devlink->ops->info_get) if (!devlink || !devlink->ops->info_get)
goto unlock_list; goto out;
mutex_lock(&devlink->lock); mutex_lock(&devlink->lock);
__devlink_compat_running_version(devlink, buf, len); __devlink_compat_running_version(devlink, buf, len);
mutex_unlock(&devlink->lock); mutex_unlock(&devlink->lock);
unlock_list:
mutex_unlock(&devlink_mutex);
out:
rtnl_lock(); rtnl_lock();
dev_put(dev); dev_put(dev);
} }
...@@ -6425,22 +6423,22 @@ void devlink_compat_running_version(struct net_device *dev, ...@@ -6425,22 +6423,22 @@ void devlink_compat_running_version(struct net_device *dev,
int devlink_compat_flash_update(struct net_device *dev, const char *file_name) int devlink_compat_flash_update(struct net_device *dev, const char *file_name)
{ {
struct devlink *devlink; struct devlink *devlink;
int ret = -EOPNOTSUPP; int ret;
dev_hold(dev); dev_hold(dev);
rtnl_unlock(); rtnl_unlock();
mutex_lock(&devlink_mutex);
devlink = netdev_to_devlink(dev); devlink = netdev_to_devlink(dev);
if (!devlink || !devlink->ops->flash_update) if (!devlink || !devlink->ops->flash_update) {
goto unlock_list; ret = -EOPNOTSUPP;
goto out;
}
mutex_lock(&devlink->lock); mutex_lock(&devlink->lock);
ret = devlink->ops->flash_update(devlink, file_name, NULL, NULL); ret = devlink->ops->flash_update(devlink, file_name, NULL, NULL);
mutex_unlock(&devlink->lock); mutex_unlock(&devlink->lock);
unlock_list:
mutex_unlock(&devlink_mutex);
out:
rtnl_lock(); rtnl_lock();
dev_put(dev); dev_put(dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment