From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Laura Abbott <lauraa@codeaurora.org>
Cc: linux-mm@kvack.org, yinghai@kernel.org,
linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH] mm/memblock.c: Correctly check whether to trim a block
Date: Thu, 29 Mar 2012 15:01:46 +1100 [thread overview]
Message-ID: <1332993706.3010.3.camel@pasglop> (raw)
In-Reply-To: <1332987958-10766-1-git-send-email-lauraa@codeaurora.org>
On Wed, 2012-03-28 at 19:25 -0700, Laura Abbott wrote:
> Currently in __memblock_remove, the check to trim the top of
> a block off only checks if the requested base is less than the
> memblock end. If the end of the requested region is equal to
> the start of a memblock, this will incorrectly try to remove
> the block, possibly causing an integer underflow:
>
> ---------------------------------------
> | | |
> | | |
> base end = rgn->base rend
>
> An additional check is needed to see if the end of the requested
> region is greater than the memblock region:
__memblock_remove() open coded logic is gone now, re-implemented
in term of memblock_isolate_range()... though I suppose your
patch might have value in -stable...
Cheers,
Ben.
> ----------------------
> | |
> | |
> rgn->base base rend end
> | |
> | |
> --------------------
>
> Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
> ---
> mm/memblock.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/mm/memblock.c b/mm/memblock.c
> index 5338237..e174ee0 100644
> --- a/mm/memblock.c
> +++ b/mm/memblock.c
> @@ -459,7 +459,7 @@ static long __init_memblock __memblock_remove(struct memblock_type *type,
> }
>
> /* And check if we need to trim the top of a block */
> - if (base < rend)
> + if (base < rend && end > rend)
> rgn->size -= rend - base;
>
> }
WARNING: multiple messages have this Message-ID (diff)
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Laura Abbott <lauraa@codeaurora.org>
Cc: linux-mm@kvack.org, yinghai@kernel.org,
linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH] mm/memblock.c: Correctly check whether to trim a block
Date: Thu, 29 Mar 2012 15:01:46 +1100 [thread overview]
Message-ID: <1332993706.3010.3.camel@pasglop> (raw)
In-Reply-To: <1332987958-10766-1-git-send-email-lauraa@codeaurora.org>
On Wed, 2012-03-28 at 19:25 -0700, Laura Abbott wrote:
> Currently in __memblock_remove, the check to trim the top of
> a block off only checks if the requested base is less than the
> memblock end. If the end of the requested region is equal to
> the start of a memblock, this will incorrectly try to remove
> the block, possibly causing an integer underflow:
>
> ---------------------------------------
> | | |
> | | |
> base end = rgn->base rend
>
> An additional check is needed to see if the end of the requested
> region is greater than the memblock region:
__memblock_remove() open coded logic is gone now, re-implemented
in term of memblock_isolate_range()... though I suppose your
patch might have value in -stable...
Cheers,
Ben.
> ----------------------
> | |
> | |
> rgn->base base rend end
> | |
> | |
> --------------------
>
> Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
> ---
> mm/memblock.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/mm/memblock.c b/mm/memblock.c
> index 5338237..e174ee0 100644
> --- a/mm/memblock.c
> +++ b/mm/memblock.c
> @@ -459,7 +459,7 @@ static long __init_memblock __memblock_remove(struct memblock_type *type,
> }
>
> /* And check if we need to trim the top of a block */
> - if (base < rend)
> + if (base < rend && end > rend)
> rgn->size -= rend - base;
>
> }
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2012-03-29 4:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-29 2:25 [PATCH] mm/memblock.c: Correctly check whether to trim a block Laura Abbott
2012-03-29 2:25 ` Laura Abbott
2012-03-29 4:01 ` Benjamin Herrenschmidt [this message]
2012-03-29 4:01 ` Benjamin Herrenschmidt
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=1332993706.3010.3.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=lauraa@codeaurora.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=yinghai@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.