diff options
author | Valentin Schneider <vschneid@redhat.com> | 2023-09-01 17:10:37 +0200 |
---|---|---|
committer | Steven Rostedt (Google) <rostedt@goodmis.org> | 2023-09-01 21:27:22 -0400 |
commit | 1caf7adb9e000479d2bd29c86b6d7eaeb24b1b05 (patch) | |
tree | faa19b680ff1a3028f8f80a622037398d5392656 /kernel | |
parent | 9af4058493c59721eccd90b7c40cad793e4e3c3b (diff) | |
download | linux-stable-1caf7adb9e000479d2bd29c86b6d7eaeb24b1b05.tar.gz linux-stable-1caf7adb9e000479d2bd29c86b6d7eaeb24b1b05.tar.bz2 linux-stable-1caf7adb9e000479d2bd29c86b6d7eaeb24b1b05.zip |
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.c | 1 |
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) { |