summaryrefslogtreecommitdiffstats
path: root/mm/mmap.c
diff options
context:
space:
mode:
authorLiam R. Howlett <Liam.Howlett@oracle.com>2023-05-18 10:55:44 -0400
committerAndrew Morton <akpm@linux-foundation.org>2023-06-09 16:25:35 -0700
commit5c1c03de1b1636f041a275e777171307cac8d958 (patch)
tree1bd50823eb4817f8f1a13814ab01bb06ea8d7411 /mm/mmap.c
parentbb5dbd2272b8d7b3a34d234bb916819afbf802d1 (diff)
downloadlinux-stable-5c1c03de1b1636f041a275e777171307cac8d958.tar.gz
linux-stable-5c1c03de1b1636f041a275e777171307cac8d958.tar.bz2
linux-stable-5c1c03de1b1636f041a275e777171307cac8d958.zip
mm: avoid rewalk in mmap_region
If the iterator has moved to the previous entry, then step forward one range, back to the gap. Link: https://lkml.kernel.org/r/20230518145544.1722059-36-Liam.Howlett@oracle.com Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com> Cc: David Binderman <dcb314@hotmail.com> Cc: Peng Zhang <zhangpeng.00@bytedance.com> Cc: Sergey Senozhatsky <senozhatsky@chromium.org> Cc: Vernon Yang <vernon2gm@gmail.com> Cc: Wei Yang <richard.weiyang@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/mmap.c')
-rw-r--r--mm/mmap.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index 19d3c843be0c..44be7fdfaac9 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2606,6 +2606,9 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
}
cannot_expand:
+ if (prev)
+ vma_iter_next_range(&vmi);
+
/*
* Determine the object being mapped and call the appropriate
* specific mapper. the address has already been validated, but