[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221020172324.66c6927f@gandalf.local.home>
Date: Thu, 20 Oct 2022 17:23:24 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Shang XiaoJing <shangxiaojing@...wei.com>
Cc: <acme@...hat.com>, <linux-kernel@...r.kernel.org>,
<namhyung@...nel.org>
Subject: Re: [PATCH] tools lib traceevent: Fix double free in
event_read_fields()
On Mon, 17 Oct 2022 16:59:37 +0800
Shang XiaoJing <shangxiaojing@...wei.com> wrote:
> There is a double free in event_read_fields(). After calling free_token()
> to free the token, if append() failed, then goto fail, which will call
> free_token() again. Triggered by compiling with perf and run "perf sched
> record". Fix the double free by goto fail_expect instead of fail while
> append() failed, which won't call redundant free_token().
>
> BUG: double free
> free(): double free detected in tcache 2
> Aborted
>
> Fixes: d286447f23cd ("tools lib traceevent: Handle realloc() failure path")
> Signed-off-by: Shang XiaoJing <shangxiaojing@...wei.com>
> ---
> tools/lib/traceevent/event-parse.c | 2 +-
tool/lib/traceevent is deprecated.
Can you send this patch to linux-trace-devel@...r.kernel.org against
https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/
Thanks!
-- Steve
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
> index 8e24c4c78c7f..e0a5a22fe702 100644
> --- a/tools/lib/traceevent/event-parse.c
> +++ b/tools/lib/traceevent/event-parse.c
> @@ -1594,7 +1594,7 @@ static int event_read_fields(struct tep_event *event, struct tep_format_field **
> ret = append(&brackets, "", "]");
> if (ret < 0) {
> free(brackets);
> - goto fail;
> + goto fail_expect;
> }
>
> /* add brackets to type */
Powered by blists - more mailing lists