====================================================== WARNING: possible circular locking dependency detected 5.2.0-rc7+ #40 Not tainted ------------------------------------------------------ syz-executor621/9182 is trying to acquire lock: 00000000289b893d (&rp->fetch_lock){+.+.}, at: mon_bin_vma_fault+0x73/0x2d0 drivers/usb/mon/mon_bin.c:1237 but task is already holding lock: 000000007bed88ca (&mm->mmap_sem#2){++++}, at: __mm_populate+0x270/0x380 mm/gup.c:1588 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&mm->mmap_sem#2){++++}: __might_fault mm/memory.c:4496 [inline] __might_fault+0x15e/0x1e0 mm/memory.c:4481 _copy_to_user+0x30/0x120 lib/usercopy.c:25 copy_to_user include/linux/uaccess.h:152 [inline] mon_bin_read+0x329/0x640 drivers/usb/mon/mon_bin.c:825 do_loop_readv_writev fs/read_write.c:714 [inline] do_loop_readv_writev fs/read_write.c:701 [inline] do_iter_read+0x4a4/0x660 fs/read_write.c:935 vfs_readv+0xf0/0x160 fs/read_write.c:997 do_preadv+0x1c4/0x280 fs/read_write.c:1089 __do_sys_preadv fs/read_write.c:1139 [inline] __se_sys_preadv fs/read_write.c:1134 [inline] __x64_sys_preadv+0x9a/0xf0 fs/read_write.c:1134 do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301 entry_SYSCALL_64_after_hwframe+0x49/0xbe -> #0 (&rp->fetch_lock){+.+.}: lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4303 __mutex_lock_common kernel/locking/mutex.c:926 [inline] __mutex_lock+0xf7/0x1310 kernel/locking/mutex.c:1073 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:1088 mon_bin_vma_fault+0x73/0x2d0 drivers/usb/mon/mon_bin.c:1237 __do_fault+0x111/0x4d0 mm/memory.c:3127 do_cow_fault mm/memory.c:3566 [inline] do_fault mm/memory.c:3668 [inline] handle_pte_fault mm/memory.c:3897 [inline] __handle_mm_fault+0xf67/0x3eb0 mm/memory.c:4021 handle_mm_fault+0x3b7/0xa90 mm/memory.c:4058 faultin_page mm/gup.c:654 [inline] __get_user_pages+0x7b6/0x1a40 mm/gup.c:857 populate_vma_page_range+0x20d/0x2a0 mm/gup.c:1560 __mm_populate+0x204/0x380 mm/gup.c:1608 mm_populate include/linux/mm.h:2411 [inline] vm_mmap_pgoff+0x213/0x230 mm/util.c:368 ksys_mmap_pgoff+0x4aa/0x630 mm/mmap.c:1611 __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+0xe9/0x1b0 arch/x86/kernel/sys_x86_64.c:91 do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301 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-executor621/9182: #0: 000000007bed88ca (&mm->mmap_sem#2){++++}, at: __mm_populate+0x270/0x380 mm/gup.c:1588 stack backtrace: CPU: 1 PID: 9182 Comm: syz-executor621 Not tainted 5.2.0-rc7+ #40 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+0x172/0x1f0 lib/dump_stack.c:113 print_circular_bug.cold+0x1cc/0x28f kernel/locking/lockdep.c:1565 check_prev_add kernel/locking/lockdep.c:2310 [inline] check_prevs_add kernel/locking/lockdep.c:2418 [inline] validate_chain kernel/locking/lockdep.c:2800 [inline] __lock_acquire+0x3755/0x5490 kernel/locking/lockdep.c:3793 lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4303 __mutex_lock_common kernel/locking/mutex.c:926 [inline] __mutex_lock+0xf7/0x1310 kernel/locking/mutex.c:1073 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:1088 mon_bin_vma_fault+0x73/0x2d0 drivers/usb/mon/mon_bin.c:1237 __do_fault+0x111/0x4d0 mm/memory.c:3127 do_cow_fault mm/memory.c:3566 [inline] do_fault mm/memory.c:3668 [inline] handle_pte_fault mm/memory.c:3897 [inline] __handle_mm_fault+0xf67/0x3eb0 mm/memory.c:4021 handle_mm_fault+0x3b7/0xa90 mm/memory.c:4058 faultin_page mm/gup.c:654 [inline] __get_user_pages+0x7b6/0x1a40 mm/gup.c:857 populate_vma_page_range+0x20d/0x2a0 mm/gup.c:1560 __mm_populate+0x204/0x380 mm/gup.c:1608 mm_populate include/linux/mm.h:2411 [inline] vm_mmap_pgoff+0x213/0x230 mm/util.c:368 ksys_mmap_pgoff+0x4aa/0x630 mm/mmap.c:1611 __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+0xe9/0x1b0 arch/x86/kernel/sys_x86_64.c:91 do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x44a6f9 Code: e8 8c b5 02 00 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 2b cc fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f3074b40cd8 EFLAGS: 00000246 ORIG_RAX: 0000000000000009 RAX: ffffffffffffffda RBX: 00000000006dbc38 RCX: 000000000044a6f9 RDX: 0000000000000002 RSI: 0000000000400000 RDI: 0000000020a05000 RBP: 00000000006dbc30 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000000008012 R11: 0000000000000246 R12: 00000000006dbc3c R13: 00007ffd532021ef R14: 00007f3074b419c0 R15: 20c49ba5e353f7cf