diff options
author | Andrew Morton <akpm@linux-foundation.org> | 2008-07-05 15:29:05 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-05 16:07:56 -0400 |
commit | 20cbc972617069c1ed434f62151e4de57d26ea46 (patch) | |
tree | 067d4d64badaa772a8c132c03f4e42875e35e3c4 /fs | |
parent | fbe0825752dc34b505777fd59cde4a6ce832eb16 (diff) |
Fix clear_refs_write() use of struct mm_walk
Don't use a static entry, so as to prevent races during concurrent use
of this function.
Reported-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Matt Mackall <mpm@selenic.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/proc/task_mmu.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index ab8ccc9d14ff..05053d701ac5 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -476,10 +476,10 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf, | |||
476 | return -ESRCH; | 476 | return -ESRCH; |
477 | mm = get_task_mm(task); | 477 | mm = get_task_mm(task); |
478 | if (mm) { | 478 | if (mm) { |
479 | static struct mm_walk clear_refs_walk; | 479 | struct mm_walk clear_refs_walk = { |
480 | memset(&clear_refs_walk, 0, sizeof(clear_refs_walk)); | 480 | .pmd_entry = clear_refs_pte_range, |
481 | clear_refs_walk.pmd_entry = clear_refs_pte_range; | 481 | .mm = mm, |
482 | clear_refs_walk.mm = mm; | 482 | }; |
483 | down_read(&mm->mmap_sem); | 483 | down_read(&mm->mmap_sem); |
484 | for (vma = mm->mmap; vma; vma = vma->vm_next) { | 484 | for (vma = mm->mmap; vma; vma = vma->vm_next) { |
485 | clear_refs_walk.private = vma; | 485 | clear_refs_walk.private = vma; |