diff options
author | Linus Torvalds | 2017-07-01 08:46:52 -0700 |
---|---|---|
committer | Linus Torvalds | 2017-07-01 08:46:52 -0700 |
commit | a527bf61404cd36fedd81dc165a03b6f5529092e (patch) | |
tree | 49efc79a4bc1a4c8dc662e4105863fd127e86ef9 | |
parent | 46589d7ab79a4b5f4d3183fafe1c8fb011f82210 (diff) | |
parent | e3c2c4fb524b548e58108a8820c0ac7787667584 (diff) |
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf fix from Thomas Gleixner:
"The last fix for perf for this cycles:
- Prevent a segfault when kernel.kptr_restrict=2 is set by avoiding a
null pointer dereference"
* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
perf machine: Fix segfault for kernel.kptr_restrict=2
-rw-r--r-- | tools/perf/util/machine.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index d7f31cb0a4cb..5de2b86b9880 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -1209,10 +1209,12 @@ int machine__create_kernel_maps(struct machine *machine) */ map_groups__fixup_end(&machine->kmaps); - if (machine__get_running_kernel_start(machine, &name, &addr)) { - } else if (maps__set_kallsyms_ref_reloc_sym(machine->vmlinux_maps, name, addr)) { - machine__destroy_kernel_maps(machine); - return -1; + if (!machine__get_running_kernel_start(machine, &name, &addr)) { + if (name && + maps__set_kallsyms_ref_reloc_sym(machine->vmlinux_maps, name, addr)) { + machine__destroy_kernel_maps(machine); + return -1; + } } return 0; |