mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: "Luck, Tony" <tony.luck@intel.com>
Cc: mingo@elte.hu, luming.yu@intel.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] avoid out of bounds array reference in save_trace()
Date: Wed, 09 Dec 2009 23:34:18 +0100	[thread overview]
Message-ID: <1260398058.5489.1623.camel@laptop> (raw)
In-Reply-To: <4b2024d085302c2a2@agluck-desktop.sc.intel.com>

On Wed, 2009-12-09 at 14:29 -0800, Luck, Tony wrote:
> ia64 found this the hard way (because we currently have a stub for
> save_stack_trace() that does nothing). But it would be a good idea to 
> be cautious in case a real save_stack_trace() bailed out with an
> error before it set trace->nr_entries.
> 
> Signed-off-by: Tony Luck <tony.luck@intel.com>

Thanks Tony,

Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>

> ---
> 
> diff --git a/kernel/lockdep.c b/kernel/lockdep.c
> index 03c06af..429540c 100644
> --- a/kernel/lockdep.c
> +++ b/kernel/lockdep.c
> @@ -387,7 +387,8 @@ static int save_trace(struct stack_trace *trace)
>  	 * complete trace that maxes out the entries provided will be reported
>  	 * as incomplete, friggin useless </rant>
>  	 */
> -	if (trace->entries[trace->nr_entries-1] == ULONG_MAX)
> +	if (trace->nr_entries != 0 &&
> +	    trace->entries[trace->nr_entries-1] == ULONG_MAX)
>  		trace->nr_entries--;
>  
>  	trace->max_entries = trace->nr_entries;



  reply	other threads:[~2009-12-09 22:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-09 22:29 Luck, Tony
2009-12-09 22:34 ` Peter Zijlstra [this message]
2009-12-10  7:50 ` [tip:core/urgent] lockdep: Avoid " tip-bot for Luck, Tony

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=1260398058.5489.1623.camel@laptop \
    --to=peterz@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luming.yu@intel.com \
    --cc=mingo@elte.hu \
    --cc=tony.luck@intel.com \
    /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

Powered by JetHome