All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hongfu Li <hongfu.li@linux.dev>
To: akpm@linux-foundation.org, liam@infradead.org, ljs@kernel.org,
	vbabka@kernel.org, jannh@google.com, pfalcato@suse.de,
	david@kernel.org, jeffxu@chromium.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	hongfu.li@linux.dev, Hongfu Li <lihongfu@kylinos.cn>
Subject: [PATCH] mm/mseal: Fix range_contains_unmapped() ignoring its mm argument
Date: Thu, 16 Jul 2026 17:33:47 +0800	[thread overview]
Message-ID: <20260716093347.75055-1-hongfu.li@linux.dev> (raw)

From: Hongfu Li <lihongfu@kylinos.cn>

range_contains_unmapped() accepts an explicit struct mm_struct *mm
argument, yet hardcodes current->mm inside VMA_ITERATOR(), ignoring
the passed address space.

Its only caller do_mseal() currently passes current->mm, so the bug
does not manifest right now. However this mismatch between prototype
and implementation is a latent bug.

Replace current->mm with the passed mm parameter to match the
function prototype.

Fixes: 530e09096413 ("mm/mseal: simplify and rename VMA gap check")
Signed-off-by: Hongfu Li <lihongfu@kylinos.cn>
---
 mm/mseal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/mseal.c b/mm/mseal.c
index 9781647483d1..8d82e50900ba 100644
--- a/mm/mseal.c
+++ b/mm/mseal.c
@@ -41,7 +41,7 @@ static bool range_contains_unmapped(struct mm_struct *mm,
 {
 	struct vm_area_struct *vma;
 	unsigned long prev_end = start;
-	VMA_ITERATOR(vmi, current->mm, start);
+	VMA_ITERATOR(vmi, mm, start);
 
 	for_each_vma_range(vmi, vma, end) {
 		if (vma->vm_start > prev_end)
-- 
2.54.0


             reply	other threads:[~2026-07-16  9:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-16  9:33 Hongfu Li [this message]
2026-07-16 10:19 ` [PATCH] mm/mseal: Fix range_contains_unmapped() ignoring its mm argument Lorenzo Stoakes (ARM)

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=20260716093347.75055-1-hongfu.li@linux.dev \
    --to=hongfu.li@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=jannh@google.com \
    --cc=jeffxu@chromium.org \
    --cc=liam@infradead.org \
    --cc=lihongfu@kylinos.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=pfalcato@suse.de \
    --cc=vbabka@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.