Commit bb9bb6bf authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

devlink: don't work with possible NULL pointer in devlink_param_unregister()

There is a WARN_ON checking the param_item for being NULL when the param
is not inserted in the list. That indicates a driver BUG. Instead of
continuing to work with NULL pointer with its consequences, return.
Signed-off-by: default avatarJiri Pirko <jiri@nvidia.com>
Reviewed-by: default avatarJakub Kicinski <kuba@kernel.org>
Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 020dd127
...@@ -10824,7 +10824,8 @@ static void devlink_param_unregister(struct devlink *devlink, ...@@ -10824,7 +10824,8 @@ static void devlink_param_unregister(struct devlink *devlink,
param_item = param_item =
devlink_param_find_by_name(&devlink->param_list, param->name); devlink_param_find_by_name(&devlink->param_list, param->name);
WARN_ON(!param_item); if (WARN_ON(!param_item))
return;
devlink_param_notify(devlink, 0, param_item, DEVLINK_CMD_PARAM_DEL); devlink_param_notify(devlink, 0, param_item, DEVLINK_CMD_PARAM_DEL);
list_del(&param_item->list); list_del(&param_item->list);
kfree(param_item); kfree(param_item);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment