From: "Zanussi, Tom" <tom.zanussi@linux.intel.com>
To: trix@redhat.com, rostedt@goodmis.org, mingo@redhat.com,
natechancellor@gmail.com, ndesaulniers@google.com,
baohong.liu@intel.com
Cc: linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com
Subject: Re: [PATCH] tracing: fix double free
Date: Tue, 8 Sep 2020 09:41:01 -0500 [thread overview]
Message-ID: <84df7ef3-0a36-0929-3fa9-74ab773ca12e@linux.intel.com> (raw)
In-Reply-To: <20200907135845.15804-1-trix@redhat.com>
Hi Tom,
On 9/7/2020 8:58 AM, trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
>
> clang static analyzer reports this problem
>
> trace_events_hist.c:3824:3: warning: Attempt to free
> released memory
> kfree(hist_data->attrs->var_defs.name[i]);
>
> In parse_var_defs() if there is a problem allocating
> var_defs.expr, the earlier var_defs.name is freed.
> This free is duplicated by free_var_defs() which frees
> the rest of the list.
>
> Because free_var_defs() has to run anyway, remove the
> second free fom parse_var_defs().
>
> Fixes: 30350d65ac56 ("tracing: Add variable support to hist triggers")
> Signed-off-by: Tom Rix <trix@redhat.com>
Good catch, thanks for fixing this!
Reviewed-by: Tom Zanussi <tom.zanussi@linux.intel.com>
> ---
> kernel/trace/trace_events_hist.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
> index 0b933546142e..1b2ef6490229 100644
> --- a/kernel/trace/trace_events_hist.c
> +++ b/kernel/trace/trace_events_hist.c
> @@ -3865,7 +3865,6 @@ static int parse_var_defs(struct hist_trigger_data *hist_data)
>
> s = kstrdup(field_str, GFP_KERNEL);
> if (!s) {
> - kfree(hist_data->attrs->var_defs.name[n_vars]);
> ret = -ENOMEM;
> goto free;
> }
>
prev parent reply other threads:[~2020-09-08 19:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-07 13:58 [PATCH] tracing: fix double free trix
2020-09-08 14:41 ` Zanussi, Tom [this message]
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=84df7ef3-0a36-0929-3fa9-74ab773ca12e@linux.intel.com \
--to=tom.zanussi@linux.intel.com \
--cc=baohong.liu@intel.com \
--cc=clang-built-linux@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=natechancellor@gmail.com \
--cc=ndesaulniers@google.com \
--cc=rostedt@goodmis.org \
--cc=trix@redhat.com \
/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