Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm: lock newly mapped VMA with corrected ordering

Lockdep is certainly right to complain about

(&vma->vm_lock->lock){++++}-{3:3}, at: vma_start_write+0x2d/0x3f
but task is already holding lock:
(&mapping->i_mmap_rwsem){+.+.}-{3:3}, at: mmap_region+0x4dc/0x6db

Invert those to the usual ordering.

Fixes: 33313a747e81 ("mm: lock newly mapped VMA which can be modified after it becomes visible")
Cc: stable@vger.kernel.org
Signed-off-by: Hugh Dickins <hughd@google.com>
Tested-by: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Hugh Dickins and committed by
Linus Torvalds
1c7873e3 946c6b59

+2 -2
+2 -2
mm/mmap.c
··· 2809 2809 if (vma_iter_prealloc(&vmi)) 2810 2810 goto close_and_free_vma; 2811 2811 2812 + /* Lock the VMA since it is modified after insertion into VMA tree */ 2813 + vma_start_write(vma); 2812 2814 if (vma->vm_file) 2813 2815 i_mmap_lock_write(vma->vm_file->f_mapping); 2814 2816 2815 - /* Lock the VMA since it is modified after insertion into VMA tree */ 2816 - vma_start_write(vma); 2817 2817 vma_iter_store(&vmi, vma); 2818 2818 mm->map_count++; 2819 2819 if (vma->vm_file) {