diff options
author | Jiri Pirko <jiri@nvidia.com> | 2023-01-26 10:58:30 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-01-27 15:32:02 +0300 |
commit | bb9bb6bfd1c37b1c0786248c2785536146603fa8 (patch) | |
tree | a6e9844f2e1a1ff14e2f51c85e64c689553181c2 /net | |
parent | 020dd127a3fef9dfc6c03cd5d1c231d5e55d7632 (diff) | |
download | linux-bb9bb6bfd1c37b1c0786248c2785536146603fa8.tar.xz |
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: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/devlink/leftover.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/devlink/leftover.c b/net/devlink/leftover.c index b1216b8f0acc..fca2b6661362 100644 --- a/net/devlink/leftover.c +++ b/net/devlink/leftover.c @@ -10824,7 +10824,8 @@ static void devlink_param_unregister(struct devlink *devlink, param_item = 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); list_del(¶m_item->list); kfree(param_item); |