Commit-ID: d0e35234f647631ddfa5fa8c8ec66c9bc698f0ab Gitweb: https://git.kernel.org/tip/d0e35234f647631ddfa5fa8c8ec66c9bc698f0ab Author: Jiri Olsa <jo...@kernel.org> AuthorDate: Fri, 13 Oct 2017 10:37:29 +0200 Committer: Arnaldo Carvalho de Melo <a...@redhat.com> 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 <jo...@kernel.org> Cc: Andi Kleen <a...@firstfloor.org> Cc: Changbin Du <changbin...@intel.com> Cc: David Ahern <dsah...@gmail.com> Cc: Jin Yao <yao....@linux.intel.com> Cc: Namhyung Kim <namhy...@kernel.org> Cc: Peter Zijlstra <pet...@infradead.org> Cc: Wang Nan <wangn...@huawei.com> Link: http://lkml.kernel.org/r/20171013083736.15037-3-jo...@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <a...@redhat.com> --- 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); }