From: Donet Tom <donettom@linux.ibm.com>
To: DaeMyung Kang <charsyam@gmail.com>,
Mike Rapoport <rppt@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/memblock: fix off-by-one page leak in reserve_mem_release_by_name()
Date: Tue, 14 Apr 2026 15:40:28 +0530 [thread overview]
Message-ID: <c55c706a-6352-47ff-af80-a293283153bf@linux.ibm.com> (raw)
In-Reply-To: <20260414094439.982853-1-charsyam@gmail.com>
Hi
On 4/14/26 3:14 PM, DaeMyung Kang wrote:
> free_reserved_area() treats its 'end' argument as exclusive: it aligns
> end down via 'end & PAGE_MASK' and iterates with 'pos < end'.
>
> reserve_mem_release_by_name() instead passes 'start + map->size - 1',
> which causes the last page of a page-aligned reservation to never be
> freed. For a reservation spanning N pages, only N - 1 pages are
> released back to the allocator.
>
> Fix it by passing the exclusive end address, 'start + map->size'.
>
> Signed-off-by: DaeMyung Kang <charsyam@gmail.com>
Do we need a fixes tag?
-Donet
> ---
> mm/memblock.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/memblock.c b/mm/memblock.c
> index b3ddfdec7a80..d4a02f1750e9 100644
> --- a/mm/memblock.c
> +++ b/mm/memblock.c
> @@ -2434,7 +2434,7 @@ int reserve_mem_release_by_name(const char *name)
> return 0;
>
> start = phys_to_virt(map->start);
> - end = start + map->size - 1;
> + end = start + map->size;
> snprintf(buf, sizeof(buf), "reserve_mem:%s", name);
> free_reserved_area(start, end, 0, buf);
> map->size = 0;
next prev parent reply other threads:[~2026-04-14 10:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-14 9:44 DaeMyung Kang
2026-04-14 10:10 ` Donet Tom [this message]
2026-04-14 10:43 ` [PATCH v2] " DaeMyung Kang
2026-04-14 11:13 ` Donet Tom
2026-04-14 11:20 ` CharSyam
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=c55c706a-6352-47ff-af80-a293283153bf@linux.ibm.com \
--to=donettom@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=charsyam@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rostedt@goodmis.org \
--cc=rppt@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox