netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch net-next] devlink: remove reload failed checks in params get/set callbacks
@ 2023-07-12 11:37 Jiri Pirko
  2023-07-12 13:47 ` Ido Schimmel
  0 siblings, 1 reply; 6+ messages in thread
From: Jiri Pirko @ 2023-07-12 11:37 UTC (permalink / raw)
  To: netdev; +Cc: kuba, pabeni, davem, edumazet, moshe, idosch

From: Jiri Pirko <jiri@nvidia.com>

The checks in question were introduced by
commit 6b4db2e528f6 ("devlink: Fix use-after-free after a failed reload").

Back then, it was a possible fix. Alternative way to fix this was to
make sure drivers register/unregister params in the code where it is
ensured that the data accessed by params callbacks are available.
But that was problematic as the list of params wes static durint
devlink instance being registered.

Eventually this limitation was lifted and also the alternative fix
(which also fixed another issue) was done for mlxsw by
commit 74cbc3c03c82 ("mlxsw: spectrum_acl_tcam: Move devlink param to TCAM code").

The checks are no longer relevant, each driver should make sure to
register/unregister params alongside with the data it touches. Remove
the checks.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
---
 net/devlink/leftover.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/devlink/leftover.c b/net/devlink/leftover.c
index 1f00f874471f..5128b9c7eea8 100644
--- a/net/devlink/leftover.c
+++ b/net/devlink/leftover.c
@@ -3946,7 +3946,7 @@ static int devlink_param_get(struct devlink *devlink,
 			     const struct devlink_param *param,
 			     struct devlink_param_gset_ctx *ctx)
 {
-	if (!param->get || devlink->reload_failed)
+	if (!param->get)
 		return -EOPNOTSUPP;
 	return param->get(devlink, param->id, ctx);
 }
@@ -3955,7 +3955,7 @@ static int devlink_param_set(struct devlink *devlink,
 			     const struct devlink_param *param,
 			     struct devlink_param_gset_ctx *ctx)
 {
-	if (!param->set || devlink->reload_failed)
+	if (!param->set)
 		return -EOPNOTSUPP;
 	return param->set(devlink, param->id, ctx);
 }
-- 
2.39.2


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

end of thread, other threads:[~2023-07-13 15:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-12 11:37 [patch net-next] devlink: remove reload failed checks in params get/set callbacks Jiri Pirko
2023-07-12 13:47 ` Ido Schimmel
2023-07-12 15:20   ` Jiri Pirko
2023-07-12 19:21     ` Jakub Kicinski
2023-07-13  9:00       ` Jiri Pirko
2023-07-13 15:55         ` Jakub Kicinski

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).