[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221205152257.454610-8-jiri@resnulli.us>
Date: Mon, 5 Dec 2022 16:22:56 +0100
From: Jiri Pirko <jiri@...nulli.us>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, kuba@...nel.org, pabeni@...hat.com,
edumazet@...gle.com, michael.chan@...adcom.com,
ioana.ciornei@....com, dmichail@...gible.com,
jesse.brandeburg@...el.com, anthony.l.nguyen@...el.com,
tchornyi@...vell.com, tariqt@...dia.com, saeedm@...dia.com,
leon@...nel.org, idosch@...dia.com, petrm@...dia.com,
vladimir.oltean@....com, claudiu.manoil@....com,
alexandre.belloni@...tlin.com, simon.horman@...igine.com,
shannon.nelson@....com, brett.creeley@....com
Subject: [patch net-next 7/8] devlink: assert if devl_port_register/unregister() is called on unregistered devlink instance
From: Jiri Pirko <jiri@...dia.com>
Now when all drivers do call devl_port_register/unregister() within the
time frame during which the devlink is registered, put and assertion to
the functions to check that and avoid going back.
Signed-off-by: Jiri Pirko <jiri@...dia.com>
---
RFC->v1:
- rebased
---
net/core/devlink.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/core/devlink.c b/net/core/devlink.c
index 907df7124157..9b9775bc10b3 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -10084,6 +10084,7 @@ int devl_port_register(struct devlink *devlink,
{
int err;
+ ASSERT_DEVLINK_REGISTERED(devlink);
devl_assert_locked(devlink);
ASSERT_DEVLINK_PORT_NOT_REGISTERED(devlink_port);
@@ -10142,6 +10143,7 @@ EXPORT_SYMBOL_GPL(devlink_port_register);
*/
void devl_port_unregister(struct devlink_port *devlink_port)
{
+ ASSERT_DEVLINK_REGISTERED(devlink_port->devlink);
lockdep_assert_held(&devlink_port->devlink->lock);
WARN_ON(devlink_port->type != DEVLINK_PORT_TYPE_NOTSET);
--
2.37.3
Powered by blists - more mailing lists