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 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