mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Leo Yan <leo.yan@linaro.org>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	Andi Kleen <ak@linux.intel.com>,
	Tiezhu Yang <yangtiezhu@loongson.cn>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf auxtrace: Fix potential null pointer dereference
Date: Tue, 20 Apr 2021 18:51:06 +0300	[thread overview]
Message-ID: <22a1f6b4-0e4f-72df-2873-b4098a6c73dc@intel.com> (raw)
In-Reply-To: <20210420151554.2031768-1-leo.yan@linaro.org>

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@linaro.org>

Acked-by: Adrian Hunter <adrian.hunter@intel.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");
> 


      reply	other threads:[~2021-04-20 15:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-20 15:15 Leo Yan
2021-04-20 15:51 ` Adrian Hunter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=22a1f6b4-0e4f-72df-2873-b4098a6c73dc@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@redhat.com \
    --cc=leo.yan@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=yangtiezhu@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®