Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1228281

Re: [PATCH perf/core ] [BUGFIX] perf probe: Fix a segfault when removing uprobe events

From Paul Clarke <pc@us.ibm.com>
Newsgroups linux.kernel
Subject Re: [PATCH perf/core ] [BUGFIX] perf probe: Fix a segfault when removing uprobe events
Date 2015-09-18 23:30 +0200
Message-ID <qaboe-67e-9@gated-at.bofh.it> (permalink)
References <q9ktA-4U2-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 09/16/2015 07:52 AM, Masami Hiramatsu wrote:
> Fix a segfault bug and a small mistake in perf probe -d.
>
> Since the "ulist" in perf_del_probe_events is never initialized,
> strlist__add(ulist, *) always causes a segfault when removing
> uprobe events by perf probe -d.
>
> Also, the "str" local variable is never released if fail to
> allocate the "klist". This fixes it too.
>
> This has been introduced by the commit e607f1426b58 ("perf probe:
> Print deleted events in cmd_probe()").
>
> Reported-by: Milian Wolff <milian.wolff@kdab.com>
> Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> ---
>   tools/perf/builtin-probe.c |    7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
> index 94385ee..f7882ae 100644
> --- a/tools/perf/builtin-probe.c
> +++ b/tools/perf/builtin-probe.c
> @@ -380,8 +380,11 @@ static int perf_del_probe_events(struct strfilter *filter)
>   		goto out;
>
>   	klist = strlist__new(NULL, NULL);
> -	if (!klist)
> -		return -ENOMEM;
> +	ulist = strlist__new(NULL, NULL);
> +	if (!klist || !ulist) {
> +		ret = -ENOMEM;
> +		goto out;
> +	}

Newbie here, but if one of "strlist__new()" calls succeeds, don't you 
need a corresponding strlist__delete() ?

PC

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH perf/core ] [BUGFIX] perf probe: Fix a segfault when  removing uprobe events Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> - 2015-09-16 15:00 +0200
  RE: [PATCH perf/core ] [BUGFIX] perf probe: Fix a segfault when  removing uprobe events 平松雅巳 / HIRAMATU,MASAMI   <masami.hiramatsu.pt@hitachi.com> - 2015-09-18 03:40 +0200
    Re: [PATCH perf/core ] [BUGFIX] perf probe: Fix a segfault when  removing uprobe events Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-18 16:30 +0200
      Re: [PATCH perf/core ] [BUGFIX] perf probe: Fix a segfault when  removing uprobe events Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-18 16:30 +0200
        Re: [PATCH perf/core ] [BUGFIX] perf probe: Fix a segfault when  removing uprobe events Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-18 16:40 +0200
  Re: [PATCH perf/core ] [BUGFIX] perf probe: Fix a segfault when  removing uprobe events Paul Clarke <pc@us.ibm.com> - 2015-09-18 23:30 +0200

csiph-web