[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240816111405.11793-2-spasswolf@web.de>
Date: Fri, 16 Aug 2024 13:13:42 +0200
From: Bert Karwatzki <spasswolf@....de>
To: "Liam R . Howlett" <Liam.Howlett@...cle.com>
Cc: Bert Karwatzki <spasswolf@....de>,
Suren Baghdasaryan <surenb@...gle.com>,
Vlastimil Babka <vbabka@...e.cz>,
Lorenzo Stoakes <lstoakes@...il.com>,
Matthew Wilcox <willy@...radead.org>,
sidhartha.kumar@...cle.com,
"Paul E . McKenney" <paulmck@...nel.org>,
Jiri Olsa <olsajiri@...il.com>,
linux-kernel@...r.kernel.org,
linux-mm@...ck.org,
Andrew Morton <akpm@...ux-foundation.org>,
Kees Cook <kees@...nel.org>,
Jeff Xu <jeffxu@...omium.org>
Subject: [PATCH v5.1 01/19] mm/mmap: Correctly position vma_iterator in __split_vma()
The vma iterator may be left pointing to the newly created vma. This
happens when inserting the new vma at the end of the old vma
(!new_below).
The incorrect position in the vma iterator is not exposed currently
since the vma iterator is repositioned in the munmap path and is not
reused in any of the other paths.
This has limited impact in the current code, but is required for future
changes.
Fixes: b2b3b886738f ("mm: don't use __vma_adjust() in __split_vma()")
Signed-off-by: Liam R. Howlett <Liam.Howlett@...cle.com>
Reviewed-by: Suren Baghdasaryan <surenb@...gle.com>
Reviewed-by: Lorenzo Stoakes <lstoakes@...il.com>
---
mm/vma.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/mm/vma.c b/mm/vma.c
index 84965f2cd580..02e4f7cf489f 100644
--- a/mm/vma.c
+++ b/mm/vma.c
@@ -246,6 +246,9 @@ static int __split_vma(struct vma_iterator *vmi, struct vm_area_struct *vma,
/* Success. */
if (new_below)
vma_next(vmi);
+ else
+ vma_prev(vmi);
+
return 0;
out_free_mpol:
--
2.45.2
Powered by blists - more mailing lists