From: Preeti U Murthy <preeti@linux.vnet.ibm.com>
To: Jan Stancek <jstancek@redhat.com>,
linuxppc-dev@lists.ozlabs.org, mpe@ellerman.id.au
Cc: linux-kernel@vger.kernel.org, benh@kernel.crashing.org,
paulus@samba.org, mikey@neuling.org, shreyas@linux.vnet.ibm.com,
sbest@redhat.com
Subject: Re: [PATCH] powerpc: fix memory corruption by pnv_alloc_idle_core_states
Date: Wed, 01 Apr 2015 15:07:13 +0530 [thread overview]
Message-ID: <551BBC49.707@linux.vnet.ibm.com> (raw)
In-Reply-To: <67174f780b3615749546d5a6d5bfba4c4f26a855.1427818011.git.jstancek@redhat.com>
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@redhat.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@linux.vnet.ibm.com>
>
> static inline cpumask_t cpu_online_cores_map(void)
>
prev parent reply other threads:[~2015-04-01 9:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-31 16:11 [PATCH] powerpc: fix memory corruption by pnv_alloc_idle_core_states Jan Stancek
2015-04-01 2:40 ` Michael Ellerman
2015-04-01 9:37 ` Preeti U Murthy [this message]
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=551BBC49.707@linux.vnet.ibm.com \
--to=preeti@linux.vnet.ibm.com \
--cc=benh@kernel.crashing.org \
--cc=jstancek@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mikey@neuling.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
--cc=sbest@redhat.com \
--cc=shreyas@linux.vnet.ibm.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;
as well as URLs for NNTP newsgroup(s).