[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220825112923.1359194-1-jiri@resnulli.us>
Date: Thu, 25 Aug 2022 13:29:23 +0200
From: Jiri Pirko <jiri@...nulli.us>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, kuba@...nel.org, pabeni@...hat.com,
edumazet@...gle.com
Subject: [patch net-next] net: devlink: add RNLT lock assertion to devlink_compat_switch_id_get()
From: Jiri Pirko <jiri@...dia.com>
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@...dia.com>
---
net/core/devlink.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/core/devlink.c b/net/core/devlink.c
index 6854f574e3ae..3b4dc64eaaae 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -12339,6 +12339,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;
--
2.37.1
Powered by blists - more mailing lists