netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch net-next] net: devlink: add RNLT lock assertion to devlink_compat_switch_id_get()
@ 2022-08-25 11:29 Jiri Pirko
  2022-08-26  1:14 ` Jakub Kicinski
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Jiri Pirko @ 2022-08-25 11:29 UTC (permalink / raw)
  To: netdev; +Cc: davem, kuba, pabeni, edumazet

From: Jiri Pirko <jiri@nvidia.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@nvidia.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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-08-29  8:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-25 11:29 [patch net-next] net: devlink: add RNLT lock assertion to devlink_compat_switch_id_get() Jiri Pirko
2022-08-26  1:14 ` Jakub Kicinski
2022-08-27  0:30 ` patchwork-bot+netdevbpf
2022-08-28  7:49 ` Leon Romanovsky
2022-08-29  7:58   ` Jiri Pirko
2022-08-29  8:30     ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).