Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752236AbdDLBvP (ORCPT ); Tue, 11 Apr 2017 21:51:15 -0400 Received: from mga05.intel.com ([192.55.52.43]:26105 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751685AbdDLBvN (ORCPT ); Tue, 11 Apr 2017 21:51:13 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,187,1488873600"; d="asc'?scan'208";a="76369790" Date: Wed, 12 Apr 2017 09:48:08 +0800 From: "Du, Changbin" To: Jiri Olsa Cc: "Du, Changbin" , 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: <20170412014808.GA3644@intel.com> References: <20170404151940.GD12903@kernel.org> <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> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="tThc/1wpZn/ma/RB" Content-Disposition: inline In-Reply-To: <20170411103249.GA29545@krava> 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 Content-Length: 2228 Lines: 69 --tThc/1wpZn/ma/RB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 l= ist_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_h= pp_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 (please > > 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. > jirka --=20 Thanks, Changbin Du --tThc/1wpZn/ma/RB Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJY7YdYAAoJEAanuZwLnPNU8oUH/27yijCwTlzVq2eMbJ2glJfb e9aEMsmQ36CZYicuV/+kt+KbqgeqVKFcPXQod2Mg1twU9pvv9rrB5gNHAQgWwjNS 1pPsxBgPesPk3L8Mg8zDUrINjLLssmkeLIaZnhqd0QAWt8IXIMJNaogVssVmzRo0 vkMbZtdeEC9BP/UZzi7iEpZ6T8X4rtNAe3ZtnkgKt2QiAqWCz9Cho0LeVkONxyC1 JBnrwKBQaU4H3wqiAJt3Rb/sDbEqjStzZmo7KxpQH2j2ZnGX1+j0fVNYFHLkf1VP KXjK3x668EKttt853gi337qKkQch5NPu65D6bn53zhhck9o6ui8fyGcewhCn5lQ= =EWxy -----END PGP SIGNATURE----- --tThc/1wpZn/ma/RB--