Skip to content

Commit 1caf7ad

Browse files
valschneiderrostedt
authored andcommitted
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>
1 parent 9af4058 commit 1caf7ad

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

kernel/trace/trace_events_filter.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1773,6 +1773,7 @@ static int parse_pred(const char *str, void *data,
17731773
if (single) {
17741774
pred->val = cpumask_first(pred->mask);
17751775
kfree(pred->mask);
1776+
pred->mask = NULL;
17761777
}
17771778

17781779
if (field->filter_type == FILTER_CPUMASK) {

0 commit comments

Comments
 (0)