From: Suren Baghdasaryan Date: Tue, 11 Jul 2023 00:46:32 +0000 (-0700) Subject: mm/mmap: Fix VM_LOCKED check in do_vmi_align_munmap() X-Git-Tag: archive/raspbian/6.1.38-2+rpi1^2~27 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=12660ea0061bb5a442b1e8b597b1787f02a14789;p=linux.git mm/mmap: Fix VM_LOCKED check in do_vmi_align_munmap() Origin: https://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git/tree/queue-6.1/mm-mmap-fix-vm_locked-check-in-do_vmi_align_munmap.patch 6.1 backport of the patch [1] uses 'next' vma instead of 'split' vma. Fix the mistake. [1] commit 606c812eb1d5 ("mm/mmap: Fix error path in do_vmi_align_munmap()") Fixes: a149174ff8bb ("mm/mmap: Fix error path in do_vmi_align_munmap()") Signed-off-by: Suren Baghdasaryan Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Gbp-Pq: Topic bugfix/all Gbp-Pq: Name mm-mmap-fix-vm_locked-check-in-do_vmi_align_munmap.patch --- diff --git a/mm/mmap.c b/mm/mmap.c index b8af52db3bb..1597a96b667 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2484,7 +2484,7 @@ do_mas_align_munmap(struct ma_state *mas, struct vm_area_struct *vma, error = mas_store_gfp(&mas_detach, split, GFP_KERNEL); if (error) goto munmap_gather_failed; - if (next->vm_flags & VM_LOCKED) + if (split->vm_flags & VM_LOCKED) locked_vm += vma_pages(split); count++;