[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1260398058.5489.1623.camel@laptop>
Date: Wed, 09 Dec 2009 23:34:18 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: "Luck, Tony" <tony.luck@...el.com>
Cc: mingo@...e.hu, luming.yu@...el.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] avoid out of bounds array reference in save_trace()
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@...el.com>
Thanks Tony,
Acked-by: Peter Zijlstra <a.p.zijlstra@...llo.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;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists