tracing: Add NULL pointer check to trigger_data_free()

JIRA: https://issues.redhat.com/browse/RHEL-151695

commit 457965c13f0837a289c9164b842d0860133f6274
Author: Guenter Roeck <linux@roeck-us.net>
Date:   Thu Mar 5 11:33:39 2026 -0800

    tracing: Add NULL pointer check to trigger_data_free()

    If trigger_data_alloc() fails and returns NULL, event_hist_trigger_parse()
    jumps to the out_free error path. While kfree() safely handles a NULL
    pointer, trigger_data_free() does not. This causes a NULL pointer
    dereference in trigger_data_free() when evaluating
    data->cmd_ops->set_filter.

    Fix the problem by adding a NULL pointer check to trigger_data_free().

    The problem was found by an experimental code review agent based on
    gemini-3.1-pro while reviewing backports into v6.18.y.

    Cc: Miaoqian Lin <linmq006@gmail.com>
    Cc: Masami Hiramatsu <mhiramat@kernel.org>
    Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Cc: Steven Rostedt (Google) <rostedt@goodmis.org>
    Link: https://patch.msgid.link/20260305193339.2810953-1-linux@roeck-us.net
    Fixes: 0550069cc25f ("tracing: Properly process error handling in event_hist_trigger_parse()")
    Assisted-by: Gemini:gemini-3.1-pro
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
This commit is contained in:
Jerome Marchand
2026-03-11 13:08:28 +01:00
parent 9ac8752720
commit d59f36edda
+3
View File
@@ -19,6 +19,9 @@ static DEFINE_MUTEX(trigger_cmd_mutex);
void trigger_data_free(struct event_trigger_data *data)
{
if (!data)
return;
if (data->cmd_ops->set_filter)
data->cmd_ops->set_filter(NULL, data, NULL);