Re: [PATCH 2/2] mm/vmalloc: warn on NULL page in remap_vmalloc_range_partial
From: Jose A. Perez de Azpillaga
Date: Wed Oct 28 2026 - 06:59:46 EST
On 10/26/26 7:09 AM, Ye Liu wrote:
> From: Ye Liu <liuye@xxxxxxxxxx>
>
> remap_vmalloc_range_partial() oopses if vmalloc_to_page() returns
> NULL, which never happens today because VM_USERMAP areas keep every
> page mapped. Add a WARN_ON(!page) to flag a break before the oops.
>
> Signed-off-by: Ye Liu <liuye@xxxxxxxxxx>
> ---
> mm/vmalloc.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index a888eca016a8..59ba203a4eff 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -4906,6 +4906,7 @@ int remap_vmalloc_range_partial(struct vm_area_struct *vma, unsigned long uaddr,
> struct page *page = vmalloc_to_page(kaddr);
> int ret;
>
> + WARN_ON(!page);
> ret = vm_insert_page(vma, uaddr, page);
doesn't this still hand the NULL page to vm_insert_page() right after,
so we warn and then oops anyway? wouldn't something like this be what
you want here?
if (WARN_ON_ONCE(!page))
return -EINVAL;
--
cheers,
jose a. p-a