summaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorJiri Pirko <jiri@nvidia.com>2022-08-25 13:29:23 +0200
committerJakub Kicinski <kuba@kernel.org>2022-08-26 17:14:15 -0700
commit6005a8aecee8afeba826295321a612ab485c230e (patch)
tree33bee99ef7d0a8cde76e8d689e11bcfe60956ac4 /net/core
parentde9d555cb8d4286a951b5b9bc824a12c739693ec (diff)
downloadlinux-6005a8aecee8afeba826295321a612ab485c230e.tar.gz
linux-6005a8aecee8afeba826295321a612ab485c230e.tar.bz2
linux-6005a8aecee8afeba826295321a612ab485c230e.zip
net: devlink: add RNLT lock assertion to devlink_compat_switch_id_get()
Similar to devlink_compat_phys_port_name_get(), make sure that devlink_compat_switch_id_get() is called with RTNL lock held. Comment already says so, so put this in code as well. Signed-off-by: Jiri Pirko <jiri@nvidia.com> Link: https://lore.kernel.org/r/20220825112923.1359194-1-jiri@resnulli.us Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/devlink.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/core/devlink.c b/net/core/devlink.c
index 0f7078db1280..2afbeb6eca67 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -12505,6 +12505,8 @@ int devlink_compat_switch_id_get(struct net_device *dev,
* devlink_port instance cannot disappear in the middle. No need to take
* any devlink lock as only permanent values are accessed.
*/
+ ASSERT_RTNL();
+
devlink_port = netdev_to_devlink_port(dev);
if (!devlink_port || !devlink_port->switch_port)
return -EOPNOTSUPP;