[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251029070256.2091-1-zhangchujun@cmss.chinamobile.com>
Date: Wed, 29 Oct 2025 15:02:56 +0800
From: Zhang Chujun <zhangchujun@...s.chinamobile.com>
To: przemyslaw.kitszel@...el.com
Cc: devlink@...r.kernel.org,
netdev@...r.kernel.org,
Zhang Chujun <zhangchujun@...s.chinamobile.com>
Subject: [PATCH] devlink: add NULL check in devlink_dpipe_entry_clear
This patch adds a NULL check for the pointer 'entry' at the entry
point of the function devlink_pipe_entry_clear. If the passed
'entry' is NULL, the function returns immediately, avoiding subsequent
dereferencing of a NULL pointer and thus preventing potential kernel
crahses or segmentation faults.
Signed-off-by: Zhang Chujun <zhangchujun@...s.chinamobile.com>
diff --git a/net/devlink/dpipe.c b/net/devlink/dpipe.c
index e55701b007f0..4517d5112311 100644
--- a/net/devlink/dpipe.c
+++ b/net/devlink/dpipe.c
@@ -514,6 +514,9 @@ void devlink_dpipe_entry_clear(struct devlink_dpipe_entry *entry)
unsigned int value_count, value_index;
struct devlink_dpipe_value *value;
+ if (!entry)
+ return;
+
value = entry->action_values;
value_count = entry->action_values_count;
for (value_index = 0; value_index < value_count; value_index++) {
--
2.50.1.windows.1
Powered by blists - more mailing lists