[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <551BBC49.707@linux.vnet.ibm.com>
Date: Wed, 01 Apr 2015 15:07:13 +0530
From: Preeti U Murthy <preeti@...ux.vnet.ibm.com>
To: Jan Stancek <jstancek@...hat.com>, linuxppc-dev@...ts.ozlabs.org,
mpe@...erman.id.au
CC: linux-kernel@...r.kernel.org, benh@...nel.crashing.org,
paulus@...ba.org, mikey@...ling.org, shreyas@...ux.vnet.ibm.com,
sbest@...hat.com
Subject: Re: [PATCH] powerpc: fix memory corruption by pnv_alloc_idle_core_states
On 03/31/2015 09:41 PM, Jan Stancek wrote:
> Space allocated for paca is based off nr_cpu_ids,
> but pnv_alloc_idle_core_states() iterates paca with
> cpu_nr_cores()*threads_per_core, which is using NR_CPUS.
>
> This causes pnv_alloc_idle_core_states() to write over memory,
> which is outside of paca array and may later lead to various panics.
>
> Fixes: 7cba160ad789 (powernv/cpuidle: Redesign idle states management)
> Signed-off-by: Jan Stancek <jstancek@...hat.com>
> ---
> arch/powerpc/include/asm/cputhreads.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/include/asm/cputhreads.h b/arch/powerpc/include/asm/cputhreads.h
> index 2bf8e93..4c8ad59 100644
> --- a/arch/powerpc/include/asm/cputhreads.h
> +++ b/arch/powerpc/include/asm/cputhreads.h
> @@ -55,7 +55,7 @@ static inline cpumask_t cpu_thread_mask_to_cores(const struct cpumask *threads)
>
> static inline int cpu_nr_cores(void)
> {
> - return NR_CPUS >> threads_shift;
> + return nr_cpu_ids >> threads_shift;
> }
Thanks for the patch!
Reviewed-by: Preeti U. Murthy <preeti@...ux.vnet.ibm.com>
>
> static inline cpumask_t cpu_online_cores_map(void)
>
--
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