From: Valentin Schneider <vschneid@redhat.com>
To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org
Cc: Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>
Subject: [PATCH 2/4] tracing/filters: Fix double-free of struct filter_pred.mask
Date: Fri, 1 Sep 2023 17:10:37 +0200 [thread overview]
Message-ID: <20230901151039.125186-3-vschneid@redhat.com> (raw)
In-Reply-To: <20230901151039.125186-1-vschneid@redhat.com>
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 --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) {
--
2.31.1
next prev parent reply other threads:[~2023-09-01 15:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-01 15:10 [PATCH 0/4] Minor v6.6 trace_events_filter fixes Valentin Schneider
2023-09-01 15:10 ` [PATCH 1/4] tracing/filters: Fix error-handling of cpulist parsing buffer Valentin Schneider
2023-09-01 15:10 ` Valentin Schneider [this message]
2023-09-01 15:10 ` [PATCH 3/4] tracing/filters: Change parse_pred() cpulist ternary into an if block Valentin Schneider
2023-09-01 15:10 ` [PATCH 4/4] tracing/filters: Fix coding style issues Valentin Schneider
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230901151039.125186-3-vschneid@redhat.com \
--to=vschneid@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).