The patch titled Subject: mm/vmalloc: fix size check for remap_vmalloc_range_partial() has been added to the -mm tree. Its filename is mm-vmalloc-fix-size-check-for-remap_vmalloc_range_partial.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-vmalloc-fix-size-check-for-remap_vmalloc_range_partial.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-vmalloc-fix-size-check-for-remap_vmalloc_range_partial.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Roman Penyaev <rpenyaev@xxxxxxx> Subject: mm/vmalloc: fix size check for remap_vmalloc_range_partial() area->size can include adjacent guard page but get_vm_area_size() returns actual size of the area. This fixes possible kernel crash when userspace tries to map area on 1 page bigger: size check passes but the following vmalloc_to_page() returns NULL on last guard (non-existing) page. Link: http://lkml.kernel.org/r/20190103145954.16942-2-rpenyaev@xxxxxxx Signed-off-by: Roman Penyaev <rpenyaev@xxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxx> Cc: Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx> Cc: Joe Perches <joe@xxxxxxxxxxx> Cc: "Luis R. Rodriguez" <mcgrof@xxxxxxxxxx> Cc: <stable@xxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/vmalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/vmalloc.c~mm-vmalloc-fix-size-check-for-remap_vmalloc_range_partial +++ a/mm/vmalloc.c @@ -2248,7 +2248,7 @@ int remap_vmalloc_range_partial(struct v if (!(area->flags & VM_USERMAP)) return -EINVAL; - if (kaddr + size > area->addr + area->size) + if (kaddr + size > area->addr + get_vm_area_size(area)) return -EINVAL; do { _ Patches currently in -mm which might be from rpenyaev@xxxxxxx are epoll-make-sure-all-elements-in-ready-list-are-in-fifo-order.patch epoll-loosen-irq-safety-in-ep_poll_callback.patch epoll-unify-awaking-of-wakeup-source-on-ep_poll_callback-path.patch epoll-use-rwlock-in-order-to-reduce-ep_poll_callback-contention.patch mm-vmalloc-fix-size-check-for-remap_vmalloc_range_partial.patch mm-vmalloc-do-not-call-kmemleak_free-on-not-yet-accounted-memory.patch mm-vmalloc-pass-vm_usermap-flags-directly-to-__vmalloc_node_range.patch