From 01f5f3d718cbfffd570a371949384add0871c1e6 Mon Sep 17 00:00:00 2001 From: Suren Baghdasaryan Date: Thu, 20 Feb 2025 12:02:08 -0800 Subject: [PATCH] FROMGIT: mm: fix a crash due to vma_end_read() that should have been removed Handling a vma lock failure due to vma being detached from under us got changed but vma_end_read() in that path was left untouched while it should have been removed. Remove it. Link: https://lkml.kernel.org/r/20250220200208.323769-1-surenb@google.com Fixes: 758f7664c3d1 ("mm: replace vm_lock and detached flag with a reference count") Signed-off-by: Suren Baghdasaryan Reported-by: Heiko Carstens Closes: https://lore.kernel.org/all/20250220185304.8313A7d-hca@linux.ibm.com/ Cc: Christian Brauner Cc: David Hildenbrand Cc: David Howells Cc: Davidlohr Bueso Cc: Hillf Danton Cc: Hugh Dickins Cc: Jann Horn Cc: Johannes Weiner Cc: Jonathan Corbet Cc: Klara Modin Cc: Liam R. Howlett Cc: Lokesh Gidra Cc: Lorenzo Stoakes Cc: Mateusz Guzik Cc: Matthew Wilcox Cc: Mel Gorman Cc: Michal Hocko Cc: Minchan Kim Cc: Oleg Nesterov Cc: Pasha Tatashin Cc: "Paul E . McKenney" Cc: Peter Xu Cc: Peter Zijlstra (Intel) Cc: Shakeel Butt Cc: Shivank Garg Cc: Sourav Panda Cc: Stephen Rothwell Cc: Vlastimil Babka Cc: Wei Yang Cc: Will Deacon Signed-off-by: Andrew Morton (cherry picked from commit de7092cdf6f7f43d7af4c33dea1566f3ef8cb93d https: //git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-unstable) Bug: 322132947 Change-Id: Ief9538a816e75d7101f4736d715b882604da233e Signed-off-by: Suren Baghdasaryan --- mm/memory.c | 1 - 1 file changed, 1 deletion(-) diff --git a/mm/memory.c b/mm/memory.c index 91b8c26bc060..38b3f33f1531 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -6337,7 +6337,6 @@ retry: if (IS_ERR_OR_NULL(vma)) { /* Check if the VMA got isolated after we found it */ if (PTR_ERR(vma) == -EAGAIN) { - vma_end_read(vma); count_vm_vma_lock_event(VMA_LOCK_MISS); /* The area was replaced with another one */ goto retry;