From: Jiri Olsa Date: Fri, 13 Oct 2017 08:37:29 +0000 (+0200) Subject: perf hists: Add extra integrity checks to fmt_free() X-Git-Tag: v4.14-rc6~8^2^2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d0e35234f647631ddfa5fa8c8ec66c9bc698f0ab;p=platform%2Fkernel%2Flinux-rpi.git 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 --- 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); }