Skip to content

mm/vmalloc: harden remap_vmalloc_range_partial against NULL pages

Ye Liu linux-mm lkml mm-commits 2 versions – In review

Get series with b4
b4 am [email protected] change-id 20261026-vmalloc_remap-012cf418c2a8

Versions newest first

  1. v2 Latest2 patches 4 repliesIn review
  2. v12 patches 2 repliesSuperseded

Changes in v2 from the cover letter

- patch 1: drop the vrealloc-shrink justification.
- patch 2: fail with -EINVAL rather than oopsing.
- Link to v1: https://patch.msgid.link/[email protected]

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2mm/vmalloc: drop VM_DMA_COHERENT from remap_vmalloc_range_partialmm/vmalloc.c+1 -12 replies
2/2mm/vmalloc: reject NULL pages in remap_vmalloc_range_partialmm/vmalloc.c+3 -02 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchJose A. Perez de AzpillagaUladzislau Rezki (Sony)
1/2R-b
2/2R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/2] mm/vmalloc: harden remap_vmalloc_range_partial against NULL pages

remap_vmalloc_range_partial() passes vmalloc_to_page()'s result to vm_insert_page() unchecked, oopsing via page_folio() if the page is NULL. The NULL case never happens today because VM_USERMAP areas keep every page mapped, but that assumption is nowhere checked.

Patch 1 drops VM_DMA_COHERENT from the allow-list -- a dead entry (no caller maps a DMA-coherent area through this path).

Patch 2 fails the mapping with -EINVAL instead of oopsing if vmalloc_to_page() ever returns NULL, with a WARN to mark the broken invariant.

Patch 1 is a behavior change (no in-tree caller affected) Patch 2 only changes a failure path that cannot be reached today. The two are independent.

---
Changes in v2:
- patch 1: drop the vrealloc-shrink justification.
- patch 2: fail with -EINVAL rather than oopsing.
- Link to v1: https://patch.msgid.link/[email protected]

---
Ye Liu (2):
mm/vmalloc: drop VM_DMA_COHERENT from remap_vmalloc_range_partial mm/vmalloc: reject NULL pages in remap_vmalloc_range_partial

 mm/vmalloc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

---
base-commit: 2efb7a11f1aa4d2dc285fe2680cca22cb9f72f64
change-id: 20261026-vmalloc_remap-012cf418c2a8

Best regards,

Signature · 1 line
Ye Liu <[email protected]>