Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1499050

[PATCH 65/68] perf header: Set nr_numa_nodes only when we parsed all the data

Path csiph.com!1.us.feeder.erje.net!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Arnaldo Carvalho de Melo <acme@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 65/68] perf header: Set nr_numa_nodes only when we parsed all the data
Date Tue, 11 Oct 2016 19:40:03 +0200
Message-ID <sr9bZ-195-45@gated-at.bofh.it> (permalink)
References <sr9bX-195-3@gated-at.bofh.it>
X-Mailer git-send-email 2.7.4
X-Srs-Rewrite SMTP reverse-path rewritten from <acme@infradead.org> by merlin.infradead.org. See http://www.infradead.org/rpr.html
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 42
Organization linux.* mail to news gateway
X-Original-Cc linux-kernel@vger.kernel.org, Linux Weekly News <lwn@lwn.net>, Jiri Olsa <jolsa@kernel.org>, Adrian Hunter <adrian.hunter@intel.com>, David Ahern <dsahern@gmail.com>, Namhyung Kim <namhyung@kernel.org>, Wang Nan <wangnan0@huawei.com>, Arnaldo Carvalho de Melo <acme@redhat.com>
X-Original-Date Tue, 11 Oct 2016 14:32:00 -0300
X-Original-Message-ID <1476207123-21791-66-git-send-email-acme@kernel.org>
X-Original-References <1476207123-21791-1-git-send-email-acme@kernel.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1499050

Show key headers only | View raw


From: Jiri Olsa <jolsa@kernel.org>

Sukadev reported segfault on releasing perf env's numa data.  It's due
to nr_numa_nodes being set no matter if the numa data gets parsed
properly. The perf_env__exit crash the on releasing non existed data.

Setting nr_numa_nodes only when data are parsed out properly.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Reported-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-dt9c0zgkt4hybn2cr4xiawta@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/header.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 43ded20f1edf..d89c9c7ef4e5 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -1895,7 +1895,6 @@ static int process_numa_topology(struct perf_file_section *section __maybe_unuse
 	if (ph->needs_swap)
 		nr = bswap_32(nr);
 
-	ph->env.nr_numa_nodes = nr;
 	nodes = zalloc(sizeof(*nodes) * nr);
 	if (!nodes)
 		return -ENOMEM;
@@ -1932,6 +1931,7 @@ static int process_numa_topology(struct perf_file_section *section __maybe_unuse
 
 		free(str);
 	}
+	ph->env.nr_numa_nodes = nr;
 	ph->env.numa_nodes = nodes;
 	return 0;
 
-- 
2.7.4

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 65/68] perf header: Set nr_numa_nodes only when we parsed all the data Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-10-11 19:40 +0200

csiph-web