From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751642AbdFALRu (ORCPT ); Thu, 1 Jun 2017 07:17:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55140 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751475AbdFALRt (ORCPT ); Thu, 1 Jun 2017 07:17:49 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6BFC42D9FC1 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=none smtp.mailfrom=jolsa@kernel.org DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 6BFC42D9FC1 From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Ingo Molnar , Peter Zijlstra , Namhyung Kim , David Ahern , "Du, Changbin" Subject: [PATCH 1/2] perf tools: Fix crash in perf_hpp__reset_output_field Date: Thu, 1 Jun 2017 13:17:43 +0200 Message-Id: <20170601111744.15580-1-jolsa@kernel.org> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 01 Jun 2017 11:17:48 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: "Du, Changbin" Link: http://lkml.kernel.org/n/tip-8umo89ntt3kawmfwsivav43t@git.kernel.org Signed-off-by: Jiri Olsa --- 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 59addd52d9cd..feb2174ddd1f 100644 --- a/tools/perf/ui/hist.c +++ b/tools/perf/ui/hist.c @@ -530,7 +530,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) -- 2.9.4