mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [tip:perf/urgent] perf header: Set nr_numa_nodes only when we parsed all the data
@ 2016-10-17 14:52 tip-bot for Jiri Olsa
  0 siblings, 0 replies; only message in thread
From: tip-bot for Jiri Olsa @ 2016-10-17 14:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, tglx, namhyung, dsahern, acme, jolsa, hpa,
	wangnan0, sukadev, adrian.hunter, mingo

Commit-ID:  f957a5308dbbdf67aa4f8ac3233a61e802bd2373
Gitweb:     http://git.kernel.org/tip/f957a5308dbbdf67aa4f8ac3233a61e802bd2373
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 10 Oct 2016 09:56:32 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 13 Oct 2016 11:12:29 -0300

perf header: Set nr_numa_nodes only when we parsed all the data

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 85dd0db..2f3eded 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;
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-10-17 14:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-17 14:52 [tip:perf/urgent] perf header: Set nr_numa_nodes only when we parsed all the data tip-bot for Jiri Olsa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome