[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <22a1f6b4-0e4f-72df-2873-b4098a6c73dc@intel.com>
Date: Tue, 20 Apr 2021 18:51:06 +0300
From: Adrian Hunter <adrian.hunter@...el.com>
To: Leo Yan <leo.yan@...aro.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
Andi Kleen <ak@...ux.intel.com>,
Tiezhu Yang <yangtiezhu@...ngson.cn>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] perf auxtrace: Fix potential null pointer dereference
On 20/04/21 6:15 pm, Leo Yan wrote:
> 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: d20031bb63dd ("perf tools: Add AUX area tracing Snapshot Mode")
> Signed-off-by: Leo Yan <leo.yan@...aro.org>
Acked-by: Adrian Hunter <adrian.hunter@...el.com>
> ---
> tools/perf/util/auxtrace.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c
> index 953f4afacd3b..320b47f133d3 100644
> --- a/tools/perf/util/auxtrace.c
> +++ b/tools/perf/util/auxtrace.c
> @@ -638,7 +638,7 @@ int auxtrace_parse_snapshot_options(struct auxtrace_record *itr,
> break;
> }
>
> - if (itr)
> + if (itr && itr->parse_snapshot_options)
> return itr->parse_snapshot_options(itr, opts, str);
>
> pr_err("No AUX area tracing to snapshot\n");
>
Powered by blists - more mailing lists