mm/damon/vaddr: protect vma traversal in __damon_va_thre_regions() with rcu read lock
Subsystems (2)
SeongJae Park
maintainerPATCH 1/1 mm/damon/vaddr: protect vma traversal in __damon_va_thre_regions() with rcu read lock
From: "Liam R. Howlett" <[email protected]>
Traversing VMAs of a given maple tree should be protected by rcu read lock. However, __damon_va_three_regions() is not doing the protection. Hold the lock.
Reported-by Guenter Roeck <[email protected]>
Fixes d0cf3dd47f0d ("damon: convert __damon_va_three_regions to use the VMA iterator")
Signed-off-by Liam R. Howlett <[email protected]>
Tested-by Guenter Roeck <[email protected]>
Signed-off-by SeongJae Park <[email protected]>
--- mm/damon/vaddr.c | 2 ++ 1 file changed, 2 insertions(+)
mm/damon/vaddr.c +2 -0
@@ -126,6 +126,7 @@ static int __damon_va_three_regions(struct mm_struct *mm,* If this is too slow, it can be optimised to examine the maple * tree gaps. */ +rcu_read_lock ();for_each_vma (vmi, vma) {unsigned long gap;
@@ -146,6 +147,7 @@ static int __damon_va_three_regions(struct mm_struct *mm, next: prev = vma; } +rcu_read_unlock ();if (!sz_range (&second_gap) || !sz_range (&first_gap))return -EINVAL ;
Signature · 1 line
2.39.2