====================================================== WARNING: possible circular locking dependency detected 5.4.0-rc2+ #0 Not tainted ------------------------------------------------------ syz-executor510/7856 is trying to acquire lock: ffff8880a8eab100 (&rp->fetch_lock){+.+.}, at: mon_bin_vma_fault+0x6d/0x260 drivers/usb/mon/mon_bin.c:1237 but task is already holding lock: ffff8880900f6b58 (&mm->mmap_sem#2){++++}, at: __mm_populate+0x156/0x3d0 mm/gup.c:1251 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&mm->mmap_sem#2){++++}: lock_acquire+0x158/0x250 kernel/locking/lockdep.c:4487 __might_fault+0xf5/0x160 mm/memory.c:4450 _copy_to_user+0x2c/0x150 lib/usercopy.c:26 copy_to_user include/linux/uaccess.h:152 [inline] mon_bin_read+0x1ac/0x7b0 drivers/usb/mon/mon_bin.c:825 __vfs_read+0xb8/0x730 fs/read_write.c:425 vfs_read+0x1dd/0x420 fs/read_write.c:461 ksys_read+0x117/0x220 fs/read_write.c:587 __do_sys_read fs/read_write.c:597 [inline] __se_sys_read fs/read_write.c:595 [inline] __x64_sys_read+0x7b/0x90 fs/read_write.c:595 do_syscall_64+0xf7/0x1c0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe -> #0 (&rp->fetch_lock){+.+.}: check_prev_add kernel/locking/lockdep.c:2476 [inline] check_prevs_add kernel/locking/lockdep.c:2581 [inline] validate_chain+0x161e/0x7bc0 kernel/locking/lockdep.c:2971 __lock_acquire+0xc75/0x1be0 kernel/locking/lockdep.c:3955 lock_acquire+0x158/0x250 kernel/locking/lockdep.c:4487 __mutex_lock_common+0x14c/0x2e20 kernel/locking/mutex.c:956 __mutex_lock kernel/locking/mutex.c:1103 [inline] mutex_lock_nested+0x1b/0x30 kernel/locking/mutex.c:1118 mon_bin_vma_fault+0x6d/0x260 drivers/usb/mon/mon_bin.c:1237 __do_fault+0x144/0x3d0 mm/memory.c:3092 do_cow_fault mm/memory.c:3518 [inline] do_fault mm/memory.c:3620 [inline] handle_pte_fault mm/memory.c:3849 [inline] __handle_mm_fault mm/memory.c:3973 [inline] handle_mm_fault+0x369f/0x5ff0 mm/memory.c:4010 faultin_page mm/gup.c:640 [inline] __get_user_pages+0x1002/0x1610 mm/gup.c:845 populate_vma_page_range+0x1fd/0x250 mm/gup.c:1223 __mm_populate+0x278/0x3d0 mm/gup.c:1271 mm_populate include/linux/mm.h:2362 [inline] vm_mmap_pgoff+0x1a0/0x1d0 mm/util.c:501 ksys_mmap_pgoff+0x46b/0x560 mm/mmap.c:1629 __do_sys_mmap arch/x86/kernel/sys_x86_64.c:100 [inline] __se_sys_mmap arch/x86/kernel/sys_x86_64.c:91 [inline] __x64_sys_mmap+0x103/0x120 arch/x86/kernel/sys_x86_64.c:91 do_syscall_64+0xf7/0x1c0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&mm->mmap_sem#2); lock(&rp->fetch_lock); lock(&mm->mmap_sem#2); lock(&rp->fetch_lock); *** DEADLOCK *** 1 lock held by syz-executor510/7856: #0: ffff8880900f6b58 (&mm->mmap_sem#2){++++}, at: __mm_populate+0x156/0x3d0 mm/gup.c:1251 stack backtrace: CPU: 0 PID: 7856 Comm: syz-executor510 Not tainted 5.4.0-rc2+ #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x1d8/0x2f8 lib/dump_stack.c:113 print_circular_bug+0xc2d/0xe60 kernel/locking/lockdep.c:1685 check_noncircular+0x206/0x3a0 kernel/locking/lockdep.c:1809 check_prev_add kernel/locking/lockdep.c:2476 [inline] check_prevs_add kernel/locking/lockdep.c:2581 [inline] validate_chain+0x161e/0x7bc0 kernel/locking/lockdep.c:2971 __lock_acquire+0xc75/0x1be0 kernel/locking/lockdep.c:3955 lock_acquire+0x158/0x250 kernel/locking/lockdep.c:4487 __mutex_lock_common+0x14c/0x2e20 kernel/locking/mutex.c:956 __mutex_lock kernel/locking/mutex.c:1103 [inline] mutex_lock_nested+0x1b/0x30 kernel/locking/mutex.c:1118 mon_bin_vma_fault+0x6d/0x260 drivers/usb/mon/mon_bin.c:1237 __do_fault+0x144/0x3d0 mm/memory.c:3092 do_cow_fault mm/memory.c:3518 [inline] do_fault mm/memory.c:3620 [inline] handle_pte_fault mm/memory.c:3849 [inline] __handle_mm_fault mm/memory.c:3973 [inline] handle_mm_fault+0x369f/0x5ff0 mm/memory.c:4010 faultin_page mm/gup.c:640 [inline] __get_user_pages+0x1002/0x1610 mm/gup.c:845 populate_vma_page_range+0x1fd/0x250 mm/gup.c:1223 __mm_populate+0x278/0x3d0 mm/gup.c:1271 mm_populate include/linux/mm.h:2362 [inline] vm_mmap_pgoff+0x1a0/0x1d0 mm/util.c:501 ksys_mmap_pgoff+0x46b/0x560 mm/mmap.c:1629 __do_sys_mmap arch/x86/kernel/sys_x86_64.c:100 [inline] __se_sys_mmap arch/x86/kernel/sys_x86_64.c:91 [inline] __x64_sys_mmap+0x103/0x120 arch/x86/kernel/sys_x86_64.c:91 do_syscall_64+0xf7/0x1c0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x44a729 Code: e8 0c e8 ff ff 48 83 c4 18 c3 0f 1f 80 00 00 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 7b cb fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007ff695595cd8 EFLAGS: 00000246 ORIG_RAX: 0000000000000009 RAX: ffffffffffffffda RBX: 00000000006dbc28 RCX: 000000000044a729 RDX: 000000000300001f RSI: 0000000000003000 RDI: 0000000020ffa000 RBP: 00000000006dbc20 R08: 0000000000000004 R09: 0000000000000000 R10: 0000000000002012 R11: 0000000000000246 R12: 00000000006dbc2c R13: 00007ffc26c9ac7f R14: 00007ff6955969c0 R15: 00000000006dbc20