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

pagewalk: use lockdep_assert_held for locking validation

Use lockdep to check for held locks instead of using home grown asserts.

Link: https://lore.kernel.org/r/20190828141955.22210-4-hch@lst.de
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Reviewed-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>

authored by

Christoph Hellwig and committed by
Jason Gunthorpe
b4bc7817 7b86ac33

+2 -2
+2 -2
mm/pagewalk.c
··· 317 317 if (!walk.mm) 318 318 return -EINVAL; 319 319 320 - VM_BUG_ON_MM(!rwsem_is_locked(&walk.mm->mmap_sem), walk.mm); 320 + lockdep_assert_held(&walk.mm->mmap_sem); 321 321 322 322 vma = find_vma(walk.mm, start); 323 323 do { ··· 367 367 if (!walk.mm) 368 368 return -EINVAL; 369 369 370 - VM_BUG_ON(!rwsem_is_locked(&vma->vm_mm->mmap_sem)); 370 + lockdep_assert_held(&walk.mm->mmap_sem); 371 371 372 372 err = walk_page_test(vma->vm_start, vma->vm_end, &walk); 373 373 if (err > 0)