[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230126075838.1643665-5-jiri@resnulli.us>
Date: Thu, 26 Jan 2023 08:58:30 +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,
jesse.brandeburg@...el.com, anthony.l.nguyen@...el.com,
tariqt@...dia.com, saeedm@...dia.com, leon@...nel.org,
idosch@...dia.com, petrm@...dia.com, simon.horman@...igine.com,
aelior@...vell.com, manishc@...vell.com, jacob.e.keller@...el.com,
gal@...dia.com, yinjun.zhang@...igine.com, fei.qin@...igine.com,
Niklas.Cassel@....com
Subject: [patch net-next v2 04/12] devlink: don't work with possible NULL pointer in devlink_param_unregister()
From: Jiri Pirko <jiri@...dia.com>
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@...dia.com>
Reviewed-by: Jakub Kicinski <kuba@...nel.org>
Reviewed-by: Jacob Keller <jacob.e.keller@...el.com>
---
net/devlink/leftover.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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);
--
2.39.0
Powered by blists - more mailing lists