From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751062AbdEaHKU (ORCPT ); Wed, 31 May 2017 03:10:20 -0400 Received: from mga11.intel.com ([192.55.52.93]:15357 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750966AbdEaHKT (ORCPT ); Wed, 31 May 2017 03:10:19 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,422,1491289200"; d="asc'?scan'208";a="1176406883" Date: Wed, 31 May 2017 15:05:51 +0800 From: "Du, Changbin" To: "Du, Changbin" Cc: Jiri Olsa , Arnaldo Carvalho de Melo , Namhyung Kim , Jiri Olsa , peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] perf: fix double free at function perf_hpp__reset_output_field Message-ID: <20170531070551.GA5207@intel.com> References: <20170410083950.GD25354@krava> <20170410102111.GA6437@intel.com> <20170410113325.GE25354@krava> <20170411030614.GA9155@intel.com> <20170411073545.GA13796@krava> <20170411082550.GA5894@intel.com> <20170411100531.GC21238@krava> <20170411101317.GA10733@intel.com> <20170411103249.GA29545@krava> <20170412014808.GA3644@intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="y0ulUmNC+osPPQO6" Content-Disposition: inline In-Reply-To: <20170412014808.GA3644@intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --y0ulUmNC+osPPQO6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi jirka, Will you send a patch to fix this issue? If not I will send my solution in a new thread. I have given up to add 'dynamic sort' feature since my code is not working and I am engaged in other things. I still hope this fix can be picked up. Thanks! On Wed, Apr 12, 2017 at 09:48:08AM +0800, Du, Changbin wrote: > On Tue, Apr 11, 2017 at 12:32:49PM +0200, Jiri Olsa wrote: > > On Tue, Apr 11, 2017 at 06:13:17PM +0800, Du, Changbin wrote: > > > > > > =20 > > > > > yes, this is an option. But for safety, I sugguest do not rely on= list_del_init. > > > > > No rule rather than create one. > > > > >=20 > > > > > But anyway, both are ok for me. What's your options? > > > >=20 > > > > hum, also I dont think we need to touch that bit at all > > > > if we are going to remove it right away.. how about the > > > > change below? > > > >=20 > > > > jirka > > > >=20 > > > >=20 > > > > --- > > > > diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c > > > > index 5d632dca672a..0ee7db43dd7d 100644 > > > > --- a/tools/perf/ui/hist.c > > > > +++ b/tools/perf/ui/hist.c > > > > @@ -613,15 +613,15 @@ void perf_hpp__reset_output_field(struct perf= _hpp_list *list) > > > > =20 > > > > /* reset output fields */ > > > > perf_hpp_list__for_each_format_safe(list, fmt, tmp) { > > > > - list_del_init(&fmt->list); > > > > - list_del_init(&fmt->sort_list); > > > > + list_del(&fmt->list); > > > > + /* Remove the fmt from next loop processing. */ > > > > + list_del(&fmt->sort_list); > > > > fmt_free(fmt); > > > What if the fmt is not linked to sort_list? I see it is possible (ple= ase > > > checking perf_hpp__setup_output_field()). I am not sure if we really = has > > > sunch case currently, just concern :) > >=20 > > if it's not linked to sort_list, then sort_list is initialized > > and list_del should do no harm > >=20 > ok, then it's fine if you insist. >=20 > > jirka >=20 > --=20 > Thanks, > Changbin Du --=20 Thanks, Changbin Du --y0ulUmNC+osPPQO6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJZLmtPAAoJEAanuZwLnPNUWl4IAJzNINDOePGD06RcxQM8iUff gvLBLN9wRTZ+Up1lO6MxKYoCctyi1d5tIyfpXPch0xwtpLgDOztEO8aW+0E+VUhv E/fF2H+VwxitSXtTkLZzaW5bIVkZwkb7/COFYW4OS2wljmQJc/c2BAxdjx2V55pv g6E0MMQTGHQ+EEy0oU0be63TEBJVFLXjZ1A2yJ8DCNSXpiRF1k0k2WJhh6er84AC Aze0tHwWiPrIwm9uDYaD/pf06qBk5qUSo0f64OIwtuZdzZ87C6wJPTjdy6Eke5rn 546wK8H1h1/Go3fa6us4IBczRzUVilul6QiIYmZaPa38Cwiqnqf1+WaPqP8pnfQ= =wXur -----END PGP SIGNATURE----- --y0ulUmNC+osPPQO6--