From: Liam R. Howlett Date: Mon, 4 Jan 2021 19:54:49 +0000 (-0500) Subject: kernel/sys: Use maple tree iterators instead of linked list X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=36fdf2335e246f92aea0fc57330d42b831a823c4;p=users%2Fjedix%2Flinux-maple.git kernel/sys: Use maple tree iterators instead of linked list Signed-off-by: Liam R. Howlett --- diff --git a/kernel/sys.c b/kernel/sys.c index a68e266c912d..a5cee14f027a 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -1877,9 +1877,11 @@ static int prctl_set_mm_exe_file(struct mm_struct *mm, unsigned int fd) err = -EBUSY; if (exe_file) { struct vm_area_struct *vma; + MA_STATE(mas, &mm->mm_mt, 0, 0); mmap_read_lock(mm); - for (vma = mm->mmap; vma; vma = vma->vm_next) { + rcu_read_lock(); + mas_for_each(&mas, vma, ULONG_MAX) { if (!vma->vm_file) continue; if (path_equal(&vma->vm_file->f_path, @@ -1887,6 +1889,7 @@ static int prctl_set_mm_exe_file(struct mm_struct *mm, unsigned int fd) goto exit_err; } + rcu_read_unlock(); mmap_read_unlock(mm); fput(exe_file); } @@ -1901,6 +1904,7 @@ exit: fdput(exe); return err; exit_err: + rcu_read_unlock(); mmap_read_unlock(mm); fput(exe_file); goto exit;