summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorValentin Schneider <vschneid@redhat.com>2023-09-01 17:10:37 +0200
committerSteven Rostedt (Google) <rostedt@goodmis.org>2023-09-01 21:27:22 -0400
commit1caf7adb9e000479d2bd29c86b6d7eaeb24b1b05 (patch)
treefaa19b680ff1a3028f8f80a622037398d5392656 /kernel
parent9af4058493c59721eccd90b7c40cad793e4e3c3b (diff)
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: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Valentin Schneider <vschneid@redhat.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/trace_events_filter.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index c06e1d596f4b..eb331e8b00b6 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -1773,6 +1773,7 @@ static int parse_pred(const char *str, void *data,
if (single) {
pred->val = cpumask_first(pred->mask);
kfree(pred->mask);
+ pred->mask = NULL;
}
if (field->filter_type == FILTER_CPUMASK) {