All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Jiri Olsa <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: namhyung@kernel.org, linux-kernel@vger.kernel.org,
	dsahern@gmail.com, wangnan0@huawei.com, jolsa@kernel.org,
	acme@redhat.com, tglx@linutronix.de, andi@firstfloor.org,
	peterz@infradead.org, yao.jin@linux.intel.com, hpa@zytor.com,
	changbin.du@intel.com, mingo@kernel.org
Subject: [tip:perf/urgent] perf hists: Fix crash in perf_hpp__reset_output_field()
Date: Fri, 20 Oct 2017 00:18:39 -0700	[thread overview]
Message-ID: <tip-70b01dfd765dd2196d51f33a49df23954416f34a@git.kernel.org> (raw)
In-Reply-To: <20171013083736.15037-2-jolsa@kernel.org>

Commit-ID:  70b01dfd765dd2196d51f33a49df23954416f34a
Gitweb:     https://git.kernel.org/tip/70b01dfd765dd2196d51f33a49df23954416f34a
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Fri, 13 Oct 2017 10:37:28 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 13 Oct 2017 16:43:33 -0300

perf hists: Fix crash in perf_hpp__reset_output_field()

Du Changbin reported crash [1] when calling perf_hpp__reset_output_field()
after unregistering field via perf_hpp__column_unregister().

This ends up in calling following list_del* sequence on
the same format:

  perf_hpp__column_unregister:
    list_del(&format->list);
  perf_hpp__reset_output_field:
    list_del_init(&fmt->list);

where the later list_del_init might touch already freed formats.

Fixing this by replacing list_del() with list_del_init() in
perf_hpp__column_unregister().

[1] http://marc.info/?l=linux-kernel&m=149059595826019&w=2

Reported-by: Changbin Du <changbin.du@intel.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/20171013083736.15037-2-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/hist.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index ddb2c6f..6ee6b36 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -532,7 +532,7 @@ void perf_hpp_list__prepend_sort_field(struct perf_hpp_list *list,
 
 void perf_hpp__column_unregister(struct perf_hpp_fmt *format)
 {
-	list_del(&format->list);
+	list_del_init(&format->list);
 }
 
 void perf_hpp__cancel_cumulate(void)

  reply	other threads:[~2017-10-20  7:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-13  8:37 [PATCH 0/9] perf tools: Assorted fixes Jiri Olsa
2017-10-13  8:37 ` [PATCH 1/9] perf tools: Fix crash in perf_hpp__reset_output_field Jiri Olsa
2017-10-20  7:18   ` tip-bot for Jiri Olsa [this message]
2017-10-13  8:37 ` [PATCH 2/9] perf tools: Add extra integrity checks to fmt_free Jiri Olsa
2017-10-20  7:19   ` [tip:perf/urgent] perf hists: Add extra integrity checks to fmt_free() tip-bot for Jiri Olsa
2017-10-13  8:37 ` [PATCH 3/9] perf tools: Rename struct perf_data_file to perf_data Jiri Olsa
2017-10-13  8:37 ` [PATCH 4/9] perf tools: Add struct perf_data_file Jiri Olsa
2017-10-13  8:37 ` [PATCH 5/9] perf tools: Add perf_data_file__write function Jiri Olsa
2017-10-13  8:37 ` [PATCH 6/9] perf stat: Move the shadow stats scale computation in perf_stat__update_shadow_stats Jiri Olsa
2017-10-13  8:37 ` [PATCH 7/9] perf stat: Make --per-thread update shadow stats to show metrics Jiri Olsa
2017-10-13  8:37 ` [PATCH 8/9] perf tools: Check wether the eBPF file exists in event parsing Jiri Olsa
2017-10-20  7:19   ` [tip:perf/urgent] " tip-bot for Jiri Olsa
2017-10-13  8:37 ` [PATCH 9/9] perf tools: Unwind properly location after REJECT Jiri Olsa
2017-10-13 19:50   ` Arnaldo Carvalho de Melo
2017-10-24 12:51     ` [PATCHv2 " Jiri Olsa
2017-10-25 14:07       ` Jiri Olsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-70b01dfd765dd2196d51f33a49df23954416f34a@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@redhat.com \
    --cc=andi@firstfloor.org \
    --cc=changbin.du@intel.com \
    --cc=dsahern@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=wangnan0@huawei.com \
    --cc=yao.jin@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.