Commit 1caf7adb authored by Valentin Schneider's avatar Valentin Schneider Committed by Steven Rostedt (Google)

tracing/filters: Fix double-free of struct filter_pred.mask

When a cpulist filter is found to contain a single CPU, that CPU is saved
as a scalar and the backing cpumask storage is freed.

Also NULL the mask to avoid a double-free once we get down to
free_predicate().

Link: https://lkml.kernel.org/r/20230901151039.125186-3-vschneid@redhat.com

Cc: Masami Hiramatsu <mhiramat@kernel.org>
Reported-by: default avatarSteven Rostedt <rostedt@goodmis.org>
Signed-off-by: default avatarValentin Schneider <vschneid@redhat.com>
Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
parent 9af40584
...@@ -1773,6 +1773,7 @@ static int parse_pred(const char *str, void *data, ...@@ -1773,6 +1773,7 @@ static int parse_pred(const char *str, void *data,
if (single) { if (single) {
pred->val = cpumask_first(pred->mask); pred->val = cpumask_first(pred->mask);
kfree(pred->mask); kfree(pred->mask);
pred->mask = NULL;
} }
if (field->filter_type == FILTER_CPUMASK) { if (field->filter_type == FILTER_CPUMASK) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment