linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: nico@fluxnic.net (Nicolas Pitre)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: ioremap: fix boundary check when reusing static mapping
Date: Wed, 25 Jan 2012 13:37:34 -0500 (EST)	[thread overview]
Message-ID: <alpine.LFD.2.02.1201251333230.2759@xanadu.home> (raw)
In-Reply-To: <1327515419-14097-1-git-send-email-pawel.moll@arm.com>

On Wed, 25 Jan 2012, Pawel Moll wrote:

> Since commit 576d2f2525612ecb5af029a76f21f22a3b82563d "ARM: add
> generic ioremap optimization by reusing static mappings" ioremap()
> is trying to reuse existing, static mapping when possible.
> 
> The condition checking boundaries of the requested and existing
> mappings didn't take in-page offset into consideration though,
> which lead to obscure and hard to debug problems when.

... when what?

Good catch nevertheless.

> Cc: Nicolas Pitre <nico@fluxnic.net>
> Signed-off-by: Pawel Moll <pawel.moll@arm.com>

Acked-by: Nicolas Pitre <nico@linaro.org>

> ---
>  arch/arm/mm/ioremap.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
> index 80632e8..ba15937 100644
> --- a/arch/arm/mm/ioremap.c
> +++ b/arch/arm/mm/ioremap.c
> @@ -225,7 +225,8 @@ void __iomem * __arm_ioremap_pfn_caller(unsigned long pfn,
>  		if ((area->flags & VM_ARM_MTYPE_MASK) != VM_ARM_MTYPE(mtype))
>  			continue;
>  		if (__phys_to_pfn(area->phys_addr) > pfn ||
> -		    __pfn_to_phys(pfn) + size-1 > area->phys_addr + area->size-1)
> +		    __pfn_to_phys(pfn) + offset + size-1 >
> +		    area->phys_addr + area->size-1)
>  			continue;
>  		/* we can drop the lock here as we know *area is static */
>  		read_unlock(&vmlist_lock);
> -- 
> 1.7.5.4
> 
> 

  reply	other threads:[~2012-01-25 18:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-25 18:16 [PATCH] ARM: ioremap: fix boundary check when reusing static mapping Pawel Moll
2012-01-25 18:37 ` Nicolas Pitre [this message]
2012-01-26 10:35   ` Pawel Moll
2012-01-28 22:55     ` Joachim Eastwood
2012-01-29  0:11       ` Russell King - ARM Linux
2012-01-29 13:10         ` Joachim Eastwood
2012-01-29 13:14           ` Russell King - ARM Linux
2012-01-29 13:22             ` Joachim Eastwood
2012-01-29 14:14               ` Russell King - ARM Linux
2012-01-29 14:33                 ` Joachim Eastwood
2012-01-29 14:55                   ` Russell King - ARM Linux
2012-01-29 15:13                     ` Nicolas Pitre
2012-01-30 11:10                     ` Pawel Moll

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=alpine.LFD.2.02.1201251333230.2759@xanadu.home \
    --to=nico@fluxnic.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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).