mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 12:17:12 +09:00
UPSTREAM: 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: 33313a747e ("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>
(cherry picked from commit 1c7873e336)
Change-Id: I85f9cfb6ee8f3d9fefda5518c5637a7dff64bac3
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
0d9960403c
commit
371f8d901a
@@ -2899,11 +2899,11 @@ cannot_expand:
|
|||||||
goto free_vma;
|
goto free_vma;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Lock the VMA since it is modified after insertion into VMA tree */
|
||||||
|
vma_start_write(vma);
|
||||||
if (vma->vm_file)
|
if (vma->vm_file)
|
||||||
i_mmap_lock_write(vma->vm_file->f_mapping);
|
i_mmap_lock_write(vma->vm_file->f_mapping);
|
||||||
|
|
||||||
/* Lock the VMA since it is modified after insertion into VMA tree */
|
|
||||||
vma_start_write(vma);
|
|
||||||
mas_store_prealloc(&mas, vma);
|
mas_store_prealloc(&mas, vma);
|
||||||
mm->map_count++;
|
mm->map_count++;
|
||||||
if (vma->vm_file) {
|
if (vma->vm_file) {
|
||||||
|
|||||||
Reference in New Issue
Block a user