====================================================== WARNING: possible circular locking dependency detected 5.17.0-rc4-syzkaller-00229-g4f12b742eb2b #0 Not tainted ------------------------------------------------------ syz-executor.2/4159 is trying to acquire lock: ffffffff8cd14be8 (driver_lock){+.+.}-{3:3}, at: display_open+0x1f/0x220 drivers/media/rc/imon.c:503 but task is already holding lock: ffffffff8ca59ad0 (minor_rwsem#2){++++}-{3:3}, at: usb_open+0x24/0x2e0 drivers/usb/core/file.c:39 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (minor_rwsem#2){++++}-{3:3}: down_write+0x90/0x150 kernel/locking/rwsem.c:1514 usb_deregister_dev+0xaa/0x320 drivers/usb/core/file.c:239 imon_disconnect+0x62a/0x770 drivers/media/rc/imon.c:2531 usb_unbind_interface+0x1d8/0x8e0 drivers/usb/core/driver.c:458 __device_release_driver+0x5d7/0x700 drivers/base/dd.c:1206 device_release_driver_internal drivers/base/dd.c:1237 [inline] device_release_driver+0x26/0x40 drivers/base/dd.c:1260 bus_remove_device+0x2eb/0x5a0 drivers/base/bus.c:529 device_del+0x4f3/0xc80 drivers/base/core.c:3592 usb_disable_device+0x35b/0x7b0 drivers/usb/core/message.c:1419 usb_disconnect.cold+0x27a/0x78e drivers/usb/core/hub.c:2228 hub_port_connect drivers/usb/core/hub.c:5202 [inline] hub_port_connect_change drivers/usb/core/hub.c:5502 [inline] port_event drivers/usb/core/hub.c:5660 [inline] hub_event+0x1e39/0x44d0 drivers/usb/core/hub.c:5742 process_one_work+0x9ac/0x1650 kernel/workqueue.c:2307 worker_thread+0x657/0x1110 kernel/workqueue.c:2454 kthread+0x2e9/0x3a0 kernel/kthread.c:377 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 -> #0 (driver_lock){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3063 [inline] check_prevs_add kernel/locking/lockdep.c:3186 [inline] validate_chain kernel/locking/lockdep.c:3801 [inline] __lock_acquire+0x2ad4/0x56c0 kernel/locking/lockdep.c:5027 lock_acquire kernel/locking/lockdep.c:5639 [inline] lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5604 __mutex_lock_common kernel/locking/mutex.c:600 [inline] __mutex_lock+0x12f/0x12f0 kernel/locking/mutex.c:733 display_open+0x1f/0x220 drivers/media/rc/imon.c:503 usb_open+0x204/0x2e0 drivers/usb/core/file.c:48 chrdev_open+0x266/0x770 fs/char_dev.c:414 do_dentry_open+0x4b9/0x1250 fs/open.c:824 do_open fs/namei.c:3476 [inline] path_openat+0x1c9e/0x2940 fs/namei.c:3609 do_filp_open+0x1aa/0x400 fs/namei.c:3636 do_sys_openat2+0x16d/0x4d0 fs/open.c:1214 do_sys_open fs/open.c:1230 [inline] __do_compat_sys_openat fs/open.c:1290 [inline] __se_compat_sys_openat fs/open.c:1288 [inline] __ia32_compat_sys_openat+0x13f/0x1f0 fs/open.c:1288 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(minor_rwsem#2); lock(driver_lock); lock(minor_rwsem#2); lock(driver_lock); *** DEADLOCK *** 1 lock held by syz-executor.2/4159: #0: ffffffff8ca59ad0 (minor_rwsem#2){++++}-{3:3}, at: usb_open+0x24/0x2e0 drivers/usb/core/file.c:39 stack backtrace: CPU: 0 PID: 4159 Comm: syz-executor.2 Not tainted 5.17.0-rc4-syzkaller-00229-g4f12b742eb2b #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2143 check_prev_add kernel/locking/lockdep.c:3063 [inline] check_prevs_add kernel/locking/lockdep.c:3186 [inline] validate_chain kernel/locking/lockdep.c:3801 [inline] __lock_acquire+0x2ad4/0x56c0 kernel/locking/lockdep.c:5027 lock_acquire kernel/locking/lockdep.c:5639 [inline] lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5604 __mutex_lock_common kernel/locking/mutex.c:600 [inline] __mutex_lock+0x12f/0x12f0 kernel/locking/mutex.c:733 display_open+0x1f/0x220 drivers/media/rc/imon.c:503 usb_open+0x204/0x2e0 drivers/usb/core/file.c:48 chrdev_open+0x266/0x770 fs/char_dev.c:414 do_dentry_open+0x4b9/0x1250 fs/open.c:824 do_open fs/namei.c:3476 [inline] path_openat+0x1c9e/0x2940 fs/namei.c:3609 do_filp_open+0x1aa/0x400 fs/namei.c:3636 do_sys_openat2+0x16d/0x4d0 fs/open.c:1214 do_sys_open fs/open.c:1230 [inline] __do_compat_sys_openat fs/open.c:1290 [inline] __se_compat_sys_openat fs/open.c:1288 [inline] __ia32_compat_sys_openat+0x13f/0x1f0 fs/open.c:1288 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c RIP: 0023:0xf6eae549 Code: 03 74 c0 01 10 05 03 74 b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00 RSP: 002b:00000000f58a8170 EFLAGS: 00000286 ORIG_RAX: 0000000000000127 RAX: ffffffffffffffda RBX: 00000000ffffff9c RCX: 00000000f58a81c0 RDX: 0000000000000002 RSI: 0000000000000000 RDI: 00000000f6fe6000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 raw-gadget gadget: fail, usb_ep_enable returned -22 ================================================================== BUG: KASAN: use-after-free in __mutex_lock_common kernel/locking/mutex.c:579 [inline] BUG: KASAN: use-after-free in __mutex_lock+0x1059/0x12f0 kernel/locking/mutex.c:733 Read of size 8 at addr ffff888049e6e080 by task syz-executor.2/4159 CPU: 1 PID: 4159 Comm: syz-executor.2 Not tainted 5.17.0-rc4-syzkaller-00229-g4f12b742eb2b #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description.constprop.0.cold+0x8d/0x336 mm/kasan/report.c:255 __kasan_report mm/kasan/report.c:442 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:459 __mutex_lock_common kernel/locking/mutex.c:579 [inline] __mutex_lock+0x1059/0x12f0 kernel/locking/mutex.c:733 display_close+0x51/0x160 drivers/media/rc/imon.c:557 __fput+0x286/0x9f0 fs/file_table.c:317 task_work_run+0xdd/0x1a0 kernel/task_work.c:164 exit_task_work include/linux/task_work.h:32 [inline] do_exit+0xb29/0x2a30 kernel/exit.c:806 do_group_exit+0xd2/0x2f0 kernel/exit.c:935 get_signal+0x45a/0x2490 kernel/signal.c:2863 arch_do_signal_or_restart+0x2a9/0x1c40 arch/x86/kernel/signal.c:868 handle_signal_work kernel/entry/common.c:148 [inline] exit_to_user_mode_loop kernel/entry/common.c:172 [inline] exit_to_user_mode_prepare+0x17d/0x290 kernel/entry/common.c:207 __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline] syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:300 __do_fast_syscall_32+0x72/0xf0 arch/x86/entry/common.c:181 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c RIP: 0023:0xf6eae549 Code: Unable to access opcode bytes at RIP 0xf6eae51f. RSP: 002b:00000000f58a64b8 EFLAGS: 00000292 ORIG_RAX: 0000000000000036 RAX: ffffffffffffffea RBX: 0000000000000003 RCX: 0000000040095505 RDX: 00000000f754003c RSI: 00000000f754003e RDI: 00000000f754003c RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 5: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:436 [inline] ____kasan_kmalloc mm/kasan/common.c:515 [inline] ____kasan_kmalloc mm/kasan/common.c:474 [inline] __kasan_kmalloc+0xa9/0xd0 mm/kasan/common.c:524 kmalloc include/linux/slab.h:581 [inline] kzalloc include/linux/slab.h:715 [inline] imon_init_intf0 drivers/media/rc/imon.c:2216 [inline] imon_probe+0xf65/0x2b90 drivers/media/rc/imon.c:2431 usb_probe_interface+0x315/0x7f0 drivers/usb/core/driver.c:396 call_driver_probe drivers/base/dd.c:517 [inline] really_probe+0x245/0xcc0 drivers/base/dd.c:596 __driver_probe_device+0x338/0x4d0 drivers/base/dd.c:752 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:782 __device_attach_driver+0x20b/0x2f0 drivers/base/dd.c:899 bus_for_each_drv+0x15f/0x1e0 drivers/base/bus.c:427 __device_attach+0x228/0x4a0 drivers/base/dd.c:970 bus_probe_device+0x1e4/0x290 drivers/base/bus.c:487 device_add+0xb83/0x1e20 drivers/base/core.c:3405 usb_set_configuration+0x101e/0x1900 drivers/usb/core/message.c:2170 usb_generic_driver_probe+0xba/0x100 drivers/usb/core/generic.c:238 usb_probe_device+0xd9/0x2c0 drivers/usb/core/driver.c:293 call_driver_probe drivers/base/dd.c:517 [inline] really_probe+0x245/0xcc0 drivers/base/dd.c:596 __driver_probe_device+0x338/0x4d0 drivers/base/dd.c:752 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:782 __device_attach_driver+0x20b/0x2f0 drivers/base/dd.c:899 bus_for_each_drv+0x15f/0x1e0 drivers/base/bus.c:427 __device_attach+0x228/0x4a0 drivers/base/dd.c:970 bus_probe_device+0x1e4/0x290 drivers/base/bus.c:487 device_add+0xb83/0x1e20 drivers/base/core.c:3405 usb_new_device.cold+0x63f/0x108e drivers/usb/core/hub.c:2566 hub_port_connect drivers/usb/core/hub.c:5358 [inline] hub_port_connect_change drivers/usb/core/hub.c:5502 [inline] port_event drivers/usb/core/hub.c:5660 [inline] hub_event+0x2585/0x44d0 drivers/usb/core/hub.c:5742 process_one_work+0x9ac/0x1650 kernel/workqueue.c:2307 worker_thread+0x657/0x1110 kernel/workqueue.c:2454 kthread+0x2e9/0x3a0 kernel/kthread.c:377 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Freed by task 3679: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:45 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free+0x126/0x160 mm/kasan/common.c:328 kasan_slab_free include/linux/kasan.h:236 [inline] slab_free_hook mm/slub.c:1728 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1754 slab_free mm/slub.c:3509 [inline] kfree+0xd0/0x390 mm/slub.c:4562 free_imon_context drivers/media/rc/imon.c:486 [inline] imon_disconnect+0x60a/0x770 drivers/media/rc/imon.c:2546 usb_unbind_interface+0x1d8/0x8e0 drivers/usb/core/driver.c:458 __device_release_driver+0x5d7/0x700 drivers/base/dd.c:1206 device_release_driver_internal drivers/base/dd.c:1237 [inline] device_release_driver+0x26/0x40 drivers/base/dd.c:1260 bus_remove_device+0x2eb/0x5a0 drivers/base/bus.c:529 device_del+0x4f3/0xc80 drivers/base/core.c:3592 usb_disable_device+0x35b/0x7b0 drivers/usb/core/message.c:1419 usb_disconnect.cold+0x27a/0x78e drivers/usb/core/hub.c:2228 hub_port_connect drivers/usb/core/hub.c:5202 [inline] hub_port_connect_change drivers/usb/core/hub.c:5502 [inline] port_event drivers/usb/core/hub.c:5660 [inline] hub_event+0x1e39/0x44d0 drivers/usb/core/hub.c:5742 process_one_work+0x9ac/0x1650 kernel/workqueue.c:2307 worker_thread+0x657/0x1110 kernel/workqueue.c:2454 kthread+0x2e9/0x3a0 kernel/kthread.c:377 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 The buggy address belongs to the object at ffff888049e6e000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 128 bytes inside of 2048-byte region [ffff888049e6e000, ffff888049e6e800) The buggy address belongs to the page: page:ffffea0001279a00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x49e68 head:ffffea0001279a00 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 0000000000000000 dead000000000001 ffff888010c42000 raw: 0000000000000000 0000000000080008 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 3643, ts 123127937611, free_ts 11364587297 prep_new_page mm/page_alloc.c:2434 [inline] get_page_from_freelist+0xa72/0x2f50 mm/page_alloc.c:4165 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5389 alloc_pages+0x1aa/0x310 mm/mempolicy.c:2271 alloc_slab_page mm/slub.c:1799 [inline] allocate_slab+0x27f/0x3c0 mm/slub.c:1944 new_slab mm/slub.c:2004 [inline] ___slab_alloc+0xbe1/0x12b0 mm/slub.c:3018 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3105 slab_alloc_node mm/slub.c:3196 [inline] slab_alloc mm/slub.c:3238 [inline] __kmalloc+0x372/0x450 mm/slub.c:4420 kmalloc include/linux/slab.h:586 [inline] sk_prot_alloc+0x110/0x290 net/core/sock.c:1923 sk_alloc+0x32/0xa80 net/core/sock.c:1976 __netlink_create+0x63/0x2f0 net/netlink/af_netlink.c:645 netlink_create+0x3ad/0x5e0 net/netlink/af_netlink.c:708 __sock_create+0x353/0x790 net/socket.c:1468 sock_create net/socket.c:1519 [inline] __sys_socket+0xef/0x200 net/socket.c:1561 __do_compat_sys_socketcall+0x5dd/0x660 net/compat.c:449 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1352 [inline] free_pcp_prepare+0x374/0x870 mm/page_alloc.c:1404 free_unref_page_prepare mm/page_alloc.c:3325 [inline] free_unref_page+0x19/0x690 mm/page_alloc.c:3404 free_contig_range+0xa8/0xf0 mm/page_alloc.c:9335 destroy_args+0xa8/0x646 mm/debug_vm_pgtable.c:1018 debug_vm_pgtable+0x298e/0x2a20 mm/debug_vm_pgtable.c:1332 do_one_initcall+0x103/0x650 init/main.c:1300 do_initcall_level init/main.c:1373 [inline] do_initcalls init/main.c:1389 [inline] do_basic_setup init/main.c:1408 [inline] kernel_init_freeable+0x6b1/0x73a init/main.c:1613 kernel_init+0x1a/0x1d0 init/main.c:1502 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Memory state around the buggy address: ffff888049e6df80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888049e6e000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888049e6e080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888049e6e100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888049e6e180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 03 74 c0 01 add 0x1(%rax,%rax,8),%esi 4: 10 05 03 74 b8 01 adc %al,0x1b87403(%rip) # 0x1b8740d a: 10 06 adc %al,(%rsi) c: 03 74 b4 01 add 0x1(%rsp,%rsi,4),%esi 10: 10 07 adc %al,(%rdi) 12: 03 74 b0 01 add 0x1(%rax,%rsi,4),%esi 16: 10 08 adc %cl,(%rax) 18: 03 74 d8 01 add 0x1(%rax,%rbx,8),%esi 1c: 00 00 add %al,(%rax) 1e: 00 00 add %al,(%rax) 20: 00 51 52 add %dl,0x52(%rcx) 23: 55 push %rbp 24: 89 e5 mov %esp,%ebp 26: 0f 34 sysenter 28: cd 80 int $0x80 * 2a: 5d pop %rbp <-- trapping instruction 2b: 5a pop %rdx 2c: 59 pop %rcx 2d: c3 retq 2e: 90 nop 2f: 90 nop 30: 90 nop 31: 90 nop 32: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi 39: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi