Re: [PATCH v2 2/2] mm/vmalloc: reject NULL pages in remap_vmalloc_range_partial

From: Jose A. Perez de Azpillaga

Date: Thu Oct 29 2026 - 08:04:39 EST


On 10/29/26 10:19 AM, Ye Liu wrote:
> From: Ye Liu <liuye@xxxxxxxxxx>
>
> remap_vmalloc_range_partial() passes vmalloc_to_page()'s result to
> vm_insert_page() unchecked, oopsing via page_folio() on a NULL page.
> The NULL case cannot happen today because VM_USERMAP areas keep every
> page mapped, but nothing enforces that invariant. Warn once and fail
> the mapping with -EINVAL instead of oopsing if it is ever broken.
>
> Suggested-by: Jose A. Perez de Azpillaga <azpijr@xxxxxxxxx>
> Signed-off-by: Ye Liu <liuye@xxxxxxxxxx>
> ---
> mm/vmalloc.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index a888eca016a8..dabef40ea88b 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -4906,6 +4906,9 @@ int remap_vmalloc_range_partial(struct vm_area_struct *vma, unsigned long uaddr,
> struct page *page = vmalloc_to_page(kaddr);
> int ret;
>
> + if (WARN_ON_ONCE(!page))
> + return -EINVAL;
> +

thanks for picking this up :)

Reviewed-by: Jose A. Perez de Azpillaga <azpijr@xxxxxxxxx>

--
cheers,
jose a. p-a