Ack+Applied: [Vivid][PATCH] powerpc: fix memory corruption by pnv_alloc_idle_core_states

Leann Ogasawara leann.ogasawara at canonical.com
Fri Apr 10 15:19:11 UTC 2015


Acked-by: Leann Ogasawara <leann.ogasawara at canonical.com>

Applied to Vivid master-next.

Thanks,
Leann

On Fri, 2015-04-10 at 10:09 -0500, Chris J Arges wrote:
> From: Jan Stancek <jstancek at redhat.com>
> 
> BugLink: http://bugs.launchpad.net/bugs/1442678
> 
> 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 at redhat.com>
> Signed-off-by: Michael Ellerman <mpe at ellerman.id.au>
> (cherry picked from commit d52356e7f48e400ca258c6763a232a92fa82ff68)
> Signed-off-by: Chris J Arges <chris.j.arges at canonical.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;
>  }
>  
>  static inline cpumask_t cpu_online_cores_map(void)
> -- 
> 1.9.1
> 
> 






More information about the kernel-team mailing list