diff mbox series

[2/4] tracing/filters: Fix double-free of struct filter_pred.mask

Message ID 20230901151039.125186-3-vschneid@redhat.com (mailing list archive)
State Accepted
Commit 1caf7adb9e000479d2bd29c86b6d7eaeb24b1b05
Headers show
Series Minor v6.6 trace_events_filter fixes | expand

Commit Message

Valentin Schneider Sept. 1, 2023, 3:10 p.m. UTC
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().

Reported-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Valentin Schneider <vschneid@redhat.com>
---
 kernel/trace/trace_events_filter.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index c06e1d596f4b9..eb331e8b00b61 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) {