All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Hao Ge" <hao.ge@linux.dev>,
	"Suren Baghdasaryan" <surenb@google.com>,
	"Uladzislau Rezki" <urezki@gmail.com>,
	"Dev Jain" <dev.jain@arm.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"David Hildenbrand (Arm)" <david@kernel.org>,
	"Madhavan Srinivasan" <maddy@linux.ibm.com>,
	"Michael Ellerman" <mpe@ellerman.id.au>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
	"Ritesh Harjani (IBM)" <ritesh.list@gmail.com>,
	"Shrikanth Hegde" <sshegde@linux.ibm.com>,
	"Alexander Potapenko" <glider@google.com>,
	"Marco Elver" <elver@google.com>,
	"Dmitry Vyukov" <dvyukov@google.com>,
	"Dennis Zhou" <dennis@kernel.org>, "Tejun Heo" <tj@kernel.org>,
	"Christoph Lameter" <cl@gentwo.org>
Cc: kasan-dev@googlegroups.com, linux-mm@kvack.org
Subject: Re: [PATCH v6 05/10] mm/vmalloc: reject an unaligned range in vmap_page_range()
Date: Thu, 03 Dec 2026 19:44:44 +0000	[thread overview]
Message-ID: <sashiko-outbox-248542@kernel.org> (raw)
In-Reply-To: <20261203092728.157806-6-hao.ge@linux.dev>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] mm: vmap_page_range() alignment check breaks omap_cf_probe()
--

commit 875f66737f08161fc6c689e08e79f67012524a9b
Author: Hao Ge <hao.ge@linux.dev>

mm/vmalloc: reject an unaligned range in vmap_page_range()

This commit moves the PAGE_SIZE alignment check from vmap_pte_range() to
vmap_page_range(), checking both addr and end before installing any page
tables.

> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index 6e25c2db8a9c8..5453df175a571 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c

[ ... ]

> @@ -369,6 +366,11 @@ int vmap_page_range(unsigned long addr, unsigned long end,
>  {
>  	int err;
>  
> +	if (WARN_ON_ONCE(!PAGE_ALIGNED(addr)))
> +		return -EINVAL;
> +	if (WARN_ON_ONCE(!PAGE_ALIGNED(end)))
> +		return -EINVAL;
> +
>  	err = vmap_range_noflush(addr, end, phys_addr, pgprot_nx(prot),
>  				 ioremap_max_page_shift);
>  	flush_cache_vmap(addr, end);

[Severity: Medium]
Does this alignment check break omap_cf_probe() on ARM?

In drivers/pcmcia/omap_cf.c, omap_cf_probe() declares an I/O resource with
DEFINE_RES_IO(SZ_64, SZ_4K) and passes it to pci_remap_iospace().  On ARM,
arch/arm/mm/ioremap.c:pci_remap_iospace() adds res->start to PCI_IOBASE and
forwards the unaligned vaddr and end directly to vmap_page_range().

Previously vmap_pte_range() only checked PAGE_ALIGNED(end - addr), which
passed because the size is SZ_4K.  With the new checks on addr and end,
vmap_page_range() warns and returns -EINVAL, causing omap_cf_probe() to fail
with -ENOMEM and breaking CompactFlash initialization on OMAP16xx boards.

drivers/pcmcia/omap_cf.c should be updated to use a PAGE_SIZE-aligned I/O
resource start before or alongside enforcing this check.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203092728.157806-1-hao.ge@linux.dev?part=5


  reply	other threads:[~2026-12-03 19:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  9:27 [PATCH v6 00/10] mm/vmalloc: fix up vmap error handling Hao Ge
2026-12-03  9:27 ` [PATCH v6 01/10] mm/vmalloc: allow the vmap unmap paths to run in atomic context Hao Ge
2026-12-03 19:44   ` sashiko-bot
2026-12-03  9:27 ` [PATCH v6 02/10] mm/kmsan: undo the shadow mapping when the origin mapping fails Hao Ge
2026-12-03  9:27 ` [PATCH v6 03/10] mm/vmalloc: fix a typo in the __vunmap_range_noflush() comment Hao Ge
2026-12-03 19:44   ` sashiko-bot
2026-12-03  9:27 ` [PATCH v6 04/10] mm/kmsan: fix the metadata cache flush ordering Hao Ge
2026-12-03  9:27 ` [PATCH v6 05/10] mm/vmalloc: reject an unaligned range in vmap_page_range() Hao Ge
2026-12-03 19:44   ` sashiko-bot [this message]
2026-12-03  9:27 ` [PATCH v6 06/10] mm/vmalloc: reject an unaligned range in __vunmap_range_noflush() Hao Ge
2026-12-03  9:27 ` [PATCH v6 07/10] mm/vmalloc: undo what a failed vmap_page_range() installed Hao Ge
2026-12-03 19:44   ` sashiko-bot
2026-12-03  9:27 ` [PATCH v6 08/10] mm/vmalloc: undo what a failed __vmap_pages_range_noflush() installed Hao Ge
2026-12-03  9:27 ` [PATCH v6 09/10] powerpc: drop redundant unmaps of failed vmap mappings Hao Ge
2026-12-03  9:27 ` [PATCH v6 10/10] mm/percpu: stop unmapping the CPU that failed to map Hao Ge

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=sashiko-outbox-248542@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=chleroy@kernel.org \
    --cc=cl@gentwo.org \
    --cc=david@kernel.org \
    --cc=dennis@kernel.org \
    --cc=dev.jain@arm.com \
    --cc=dvyukov@google.com \
    --cc=elver@google.com \
    --cc=glider@google.com \
    --cc=hao.ge@linux.dev \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-mm@kvack.org \
    --cc=maddy@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=ritesh.list@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=sshegde@linux.ibm.com \
    --cc=surenb@google.com \
    --cc=tj@kernel.org \
    --cc=urezki@gmail.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 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.