Skip to content

Commit

Permalink
devlink: remove reload failed checks in params get/set callbacks
Browse files Browse the repository at this point in the history
The checks in question were introduced by:
commit 6b4db2e ("devlink: Fix use-after-free after a failed reload").
That fixed an issue of reload with mlxsw driver.

Back then, that was a valid fix, because there was a limitation
in place that prevented drivers from registering/unregistering params
when devlink instance was registered.

It was possible to do the fix differently by changing drivers to
register/unregister params in appropriate places making sure the ops
operate only on memory which is allocated and initialized. But that,
as a dependency, would require to remove the limitation mentioned above.

Eventually, this limitation was lifted by:
commit 1d18bb1 ("devlink: allow registering parameters after the instance")

Also, the alternative fix (which also fixed another issue) was done by:
commit 74cbc3c ("mlxsw: spectrum_acl_tcam: Move devlink param to TCAM code").

Therefore, the checks are no longer relevant. Each driver should make
sure to have the params registered only when the memory the ops
are working with is allocated and initialized.

So remove the checks.

Signed-off-by: Jiri Pirko <[email protected]>
Reviewed-by: Ido Schimmel <[email protected]>
Reviewed-by: Jakub Kicinski <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Jiri Pirko authored and davem330 committed Jul 14, 2023
1 parent a8fbe1e commit 633d76a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/devlink/leftover.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down

0 comments on commit 633d76a

Please sign in to comment.