lkml.org 
[lkml]   [2023]   [Aug]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH v4 5/6] mm: always lock new vma before inserting into vma tree
On Mon, 14 Aug 2023 16:54:01 +0200 Jann Horn <jannh@google.com> wrote:

> > @@ -403,6 +403,8 @@ static int vma_link(struct mm_struct *mm, struct vm_area_struct *vma)
> >
> > vma_iter_store(&vmi, vma);
> >
> > + vma_start_write(vma);
> > +
> > if (vma->vm_file) {
> > mapping = vma->vm_file->f_mapping;
> > i_mmap_lock_write(mapping);
>
> The "vma_start_write()" has to be ordered before the
> "vma_iter_store(&vmi, vma)".

Thanks. This?


--- a/mm/mmap.c~mm-always-lock-new-vma-before-inserting-into-vma-tree-fix
+++ a/mm/mmap.c
@@ -401,10 +401,10 @@ static int vma_link(struct mm_struct *mm
if (vma_iter_prealloc(&vmi, vma))
return -ENOMEM;

- vma_iter_store(&vmi, vma);
-
vma_start_write(vma);

+ vma_iter_store(&vmi, vma);
+
if (vma->vm_file) {
mapping = vma->vm_file->f_mapping;
i_mmap_lock_write(mapping);
_
\
 
 \ /
  Last update: 2023-08-14 21:17    [W:0.068 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site