mm/memory.c: simplify pfnmap_lockdep_assert
Use local `mapping' to reduce the pointer chasing.
akpm: extracted from a bugfix which Linus fixed with b1b4675167 ("mm:
fix follow_pfnmap API lockdep assert").
Link: https://lkml.kernel.org/r/20241004-fix-null-deref-v4-1-d0a8ec01ac85@iiitd.ac.in
Signed-off-by: Manas <manas18244@iiitd.ac.in>
Reviewed-by: Peter Xu <peterx@redhat.com>
Cc: Anup Sharma <anupnewsmail@gmail.com>
Cc: Shuah Khan <skhan@linuxfoundation.org>
Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
+1
-1
@@ -6388,7 +6388,7 @@ static inline void pfnmap_lockdep_assert(struct vm_area_struct *vma)
|
||||
struct address_space *mapping = file ? file->f_mapping : NULL;
|
||||
|
||||
if (mapping)
|
||||
lockdep_assert(lockdep_is_held(&vma->vm_file->f_mapping->i_mmap_rwsem) ||
|
||||
lockdep_assert(lockdep_is_held(&mapping->i_mmap_rwsem) ||
|
||||
lockdep_is_held(&vma->vm_mm->mmap_lock));
|
||||
else
|
||||
lockdep_assert(lockdep_is_held(&vma->vm_mm->mmap_lock));
|
||||
|
||||
Reference in New Issue
Block a user