From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752124AbdJTHXf (ORCPT ); Fri, 20 Oct 2017 03:23:35 -0400 Received: from terminus.zytor.com ([65.50.211.136]:33007 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751061AbdJTHXc (ORCPT ); Fri, 20 Oct 2017 03:23:32 -0400 Date: Fri, 20 Oct 2017 00:19:05 -0700 From: tip-bot for Jiri Olsa Message-ID: Cc: peterz@infradead.org, hpa@zytor.com, dsahern@gmail.com, andi@firstfloor.org, jolsa@kernel.org, mingo@kernel.org, changbin.du@intel.com, linux-kernel@vger.kernel.org, namhyung@kernel.org, acme@redhat.com, yao.jin@linux.intel.com, wangnan0@huawei.com, tglx@linutronix.de Reply-To: dsahern@gmail.com, andi@firstfloor.org, peterz@infradead.org, hpa@zytor.com, mingo@kernel.org, changbin.du@intel.com, namhyung@kernel.org, linux-kernel@vger.kernel.org, jolsa@kernel.org, yao.jin@linux.intel.com, acme@redhat.com, wangnan0@huawei.com, tglx@linutronix.de In-Reply-To: <20171013083736.15037-3-jolsa@kernel.org> References: <20171013083736.15037-3-jolsa@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf hists: Add extra integrity checks to fmt_free() Git-Commit-ID: d0e35234f647631ddfa5fa8c8ec66c9bc698f0ab X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: d0e35234f647631ddfa5fa8c8ec66c9bc698f0ab Gitweb: https://git.kernel.org/tip/d0e35234f647631ddfa5fa8c8ec66c9bc698f0ab Author: Jiri Olsa AuthorDate: Fri, 13 Oct 2017 10:37:29 +0200 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 13 Oct 2017 16:43:42 -0300 perf hists: Add extra integrity checks to fmt_free() Make sure the struct perf_hpp_fmt is properly unhooked before we free it. Signed-off-by: Jiri Olsa Cc: Andi Kleen Cc: Changbin Du Cc: David Ahern Cc: Jin Yao Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Wang Nan Link: http://lkml.kernel.org/r/20171013083736.15037-3-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/ui/hist.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c index 6ee6b36..db79017 100644 --- a/tools/perf/ui/hist.c +++ b/tools/perf/ui/hist.c @@ -606,6 +606,13 @@ next: static void fmt_free(struct perf_hpp_fmt *fmt) { + /* + * At this point fmt should be completely + * unhooked, if not it's a bug. + */ + BUG_ON(!list_empty(&fmt->list)); + BUG_ON(!list_empty(&fmt->sort_list)); + if (fmt->free) fmt->free(fmt); }