Skip to content

Commit

Permalink
powerpc: fix memory corruption by pnv_alloc_idle_core_states
Browse files Browse the repository at this point in the history
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: 7cba160 (powernv/cpuidle: Redesign idle states management)
Signed-off-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
  • Loading branch information
jstancek authored and mpe committed Apr 1, 2015
1 parent e42391c commit d52356e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/powerpc/include/asm/cputhreads.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d52356e

Please sign in to comment.