]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
perf auxtrace: Fix potential NULL pointer dereference
authorLeo Yan <leo.yan@linaro.org>
Tue, 20 Apr 2021 15:15:53 +0000 (23:15 +0800)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 7 May 2021 07:54:11 +0000 (09:54 +0200)
commit6354a58c89c4328939c07a67c8bbd8872becc9f8
tree2352d5508a479c5306883a99dd9aca6037b25171
parentbbe21838c71e55b1a057d8cfe870258bb91222b6
perf auxtrace: Fix potential NULL pointer dereference

BugLink: https://bugs.launchpad.net/bugs/1927535
[ Upstream commit b14585d9f18dc617e975815570fe836be656b1da ]

In the function auxtrace_parse_snapshot_options(), the callback pointer
"itr->parse_snapshot_options" can be NULL if it has not been set during
the AUX record initialization.  This can cause tool crashing if the
callback pointer "itr->parse_snapshot_options" is dereferenced without
performing NULL check.

Add a NULL check for the pointer "itr->parse_snapshot_options" before
invoke the callback.

Fixes: d20031bb63dd6dde ("perf tools: Add AUX area tracing Snapshot Mode")
Signed-off-by: Leo Yan <leo.yan@linaro.org>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
Link: http://lore.kernel.org/lkml/20210420151554.2031768-1-leo.yan@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
tools/perf/util/auxtrace.c