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

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
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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) {