From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754617AbbIRVYu (ORCPT ); Fri, 18 Sep 2015 17:24:50 -0400 Received: from e18.ny.us.ibm.com ([129.33.205.208]:44392 "EHLO e18.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754078AbbIRVYQ (ORCPT ); Fri, 18 Sep 2015 17:24:16 -0400 X-Helo: d01dlp01.pok.ibm.com X-MailFrom: pc@us.ibm.com X-RcptTo: linux-perf-users@vger.kernel.org Subject: Re: [PATCH perf/core ] [BUGFIX] perf probe: Fix a segfault when removing uprobe events To: Masami Hiramatsu , Namhyung Kim , Arnaldo Carvalho de Melo References: <20150916125241.4446.44805.stgit@localhost.localdomain> Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Milian Wolff From: Paul Clarke Message-ID: <55FC80FA.6020007@us.ibm.com> Date: Fri, 18 Sep 2015 16:24:10 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <20150916125241.4446.44805.stgit@localhost.localdomain> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15091821-0045-0000-0000-0000017AF26F Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Signed-off-by: Masami Hiramatsu > --- > 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