lkml.org 
[lkml]   [2021]   [Apr]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 73/94] kernel/sys: Use maple tree iterators instead of linked list
Date
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
---
kernel/sys.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/kernel/sys.c b/kernel/sys.c
index 3a583a29815f..3a33ef07cc22 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1864,9 +1864,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,
@@ -1874,6 +1876,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);
}
@@ -1888,6 +1891,7 @@ static int prctl_set_mm_exe_file(struct mm_struct *mm, unsigned int fd)
fdput(exe);
return err;
exit_err:
+ rcu_read_unlock();
mmap_read_unlock(mm);
fput(exe_file);
goto exit;
--
2.30.2
\
 
 \ /
  Last update: 2021-04-28 17:41    [W:1.765 / U:0.696 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site