====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ syz.8.2086/11362 is trying to acquire lock: ffff888023ce6918 (&disk->open_mutex){+.+.}-{3:3}, at: del_gendisk+0x145/0x780 block/genhd.c:595 but task is already holding lock: ffff8880219380e0 (&shost->scan_mutex){+.+.}-{3:3}, at: scsi_remove_host+0x2e/0x730 drivers/scsi/hosts.c:168 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #7 (&shost->scan_mutex){+.+.}-{3:3}: __mutex_lock_common+0x1e5/0x2400 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 scsi_remove_host+0x2e/0x730 drivers/scsi/hosts.c:168 virtscsi_remove+0x12f/0x1d0 drivers/scsi/virtio_scsi.c:933 virtio_dev_remove+0x92/0x1a0 drivers/virtio/virtio.c:300 __device_release_driver drivers/base/dd.c:1247 [inline] device_release_driver_internal+0x44c/0x710 drivers/base/dd.c:1282 bus_remove_device+0x2dd/0x400 drivers/base/bus.c:531 device_del+0x63f/0xa80 drivers/base/core.c:3615 device_unregister+0x1c/0xc0 drivers/base/core.c:3660 unregister_virtio_device+0x33/0x60 drivers/virtio/virtio.c:449 virtio_pci_remove+0x7b/0xe0 drivers/virtio/virtio_pci_common.c:589 pci_device_remove+0x93/0x230 drivers/pci/pci-driver.c:471 __device_release_driver drivers/base/dd.c:1247 [inline] device_release_driver_internal+0x44c/0x710 drivers/base/dd.c:1282 unbind_store+0x2e2/0x300 drivers/base/bus.c:193 kernfs_fop_write_iter+0x3a8/0x500 fs/kernfs/file.c:296 call_write_iter include/linux/fs.h:2173 [inline] new_sync_write fs/read_write.c:507 [inline] vfs_write+0x748/0xd70 fs/read_write.c:594 ksys_write+0x153/0x260 fs/read_write.c:647 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #6 (&of->mutex){+.+.}-{3:3}: __mutex_lock_common+0x1e5/0x2400 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 kernfs_file_read_iter fs/kernfs/file.c:203 [inline] kernfs_fop_read_iter+0x185/0x560 fs/kernfs/file.c:242 __kernel_read+0x51d/0x980 fs/read_write.c:443 integrity_kernel_read+0x86/0xd0 security/integrity/iint.c:228 ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:485 [inline] ima_calc_file_shash security/integrity/ima/ima_crypto.c:516 [inline] ima_calc_file_hash+0x946/0x1940 security/integrity/ima/ima_crypto.c:573 ima_collect_measurement+0x335/0x7e0 security/integrity/ima/ima_api.c:255 process_measurement+0x1185/0x1c20 security/integrity/ima/ima_main.c:351 ima_file_check+0xc7/0x110 security/integrity/ima/ima_main.c:533 do_open fs/namei.c:3618 [inline] path_openat+0x27cf/0x2fb0 fs/namei.c:3750 do_filp_open+0x1df/0x400 fs/namei.c:3777 do_sys_openat2+0x14b/0x500 fs/open.c:1255 do_sys_open fs/open.c:1271 [inline] __do_sys_openat fs/open.c:1287 [inline] __se_sys_openat fs/open.c:1282 [inline] __x64_sys_openat+0x135/0x160 fs/open.c:1282 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #5 (&iint_mutex_key[depth]){+.+.}-{3:3}: __mutex_lock_common+0x1e5/0x2400 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 process_measurement+0x724/0x1c20 security/integrity/ima/ima_main.c:261 ima_file_check+0xc7/0x110 security/integrity/ima/ima_main.c:533 do_open fs/namei.c:3618 [inline] path_openat+0x27cf/0x2fb0 fs/namei.c:3750 do_filp_open+0x1df/0x400 fs/namei.c:3777 do_sys_openat2+0x14b/0x500 fs/open.c:1255 do_sys_open fs/open.c:1271 [inline] __do_sys_openat fs/open.c:1287 [inline] __se_sys_openat fs/open.c:1282 [inline] __x64_sys_openat+0x135/0x160 fs/open.c:1282 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #4 (sb_writers#3){.+.+}-{0:0}: percpu_down_read include/linux/percpu-rwsem.h:51 [inline] __sb_start_write include/linux/fs.h:1811 [inline] sb_start_write include/linux/fs.h:1881 [inline] file_start_write include/linux/fs.h:3043 [inline] lo_write_bvec+0x194/0x780 drivers/block/loop.c:315 lo_write_simple drivers/block/loop.c:338 [inline] do_req_filebacked drivers/block/loop.c:656 [inline] loop_handle_cmd drivers/block/loop.c:2235 [inline] loop_process_work+0x1b66/0x24c0 drivers/block/loop.c:2275 process_one_work+0x867/0xff0 kernel/workqueue.c:2310 worker_thread+0xad7/0x12a0 kernel/workqueue.c:2457 kthread+0x42e/0x520 kernel/kthread.c:334 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 -> #3 ((work_completion)(&lo->rootcg_work)){+.+.}-{0:0}: process_one_work+0x7ba/0xff0 kernel/workqueue.c:2286 worker_thread+0xad7/0x12a0 kernel/workqueue.c:2457 kthread+0x42e/0x520 kernel/kthread.c:334 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 -> #2 ((wq_completion)loop0){+.+.}-{0:0}: flush_workqueue+0x16a/0x1390 kernel/workqueue.c:2830 drain_workqueue+0xca/0x370 kernel/workqueue.c:2995 destroy_workqueue+0x7b/0xb20 kernel/workqueue.c:4439 __loop_clr_fd+0x22f/0xb50 drivers/block/loop.c:1384 blkdev_put+0x52b/0x780 block/bdev.c:-1 deactivate_locked_super+0x93/0xf0 fs/super.c:335 cleanup_mnt+0x426/0x4d0 fs/namespace.c:1148 task_work_run+0x125/0x1a0 kernel/task_work.c:188 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop+0x10f/0x130 kernel/entry/common.c:181 exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:214 __syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline] syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:307 do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #1 (&lo->lo_mutex){+.+.}-{3:3}: __mutex_lock_common+0x1e5/0x2400 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_killable_nested+0x17/0x20 kernel/locking/mutex.c:758 lo_open+0x6a/0x100 drivers/block/loop.c:2056 blkdev_get_whole+0x90/0x390 block/bdev.c:665 blkdev_get_by_dev+0x2da/0xa50 block/bdev.c:823 blkdev_open+0x128/0x2c0 block/fops.c:466 do_dentry_open+0x7f7/0xf90 fs/open.c:826 do_open fs/namei.c:3616 [inline] path_openat+0x2718/0x2fb0 fs/namei.c:3750 do_filp_open+0x1df/0x400 fs/namei.c:3777 do_sys_openat2+0x14b/0x500 fs/open.c:1255 do_sys_open fs/open.c:1271 [inline] __do_sys_openat fs/open.c:1287 [inline] __se_sys_openat fs/open.c:1282 [inline] __x64_sys_openat+0x135/0x160 fs/open.c:1282 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #0 (&disk->open_mutex){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain kernel/locking/lockdep.c:3788 [inline] __lock_acquire+0x2c66/0x7b50 kernel/locking/lockdep.c:5012 lock_acquire+0x19e/0x400 kernel/locking/lockdep.c:5623 __mutex_lock_common+0x1e5/0x2400 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 del_gendisk+0x145/0x780 block/genhd.c:595 sd_remove+0x9b/0xf0 drivers/scsi/sd.c:3510 __device_release_driver drivers/base/dd.c:1249 [inline] device_release_driver_internal+0x487/0x710 drivers/base/dd.c:1282 bus_remove_device+0x2dd/0x400 drivers/base/bus.c:531 device_del+0x63f/0xa80 drivers/base/core.c:3615 __scsi_remove_device+0x1f3/0x3c0 drivers/scsi/scsi_sysfs.c:1479 scsi_forget_host+0xcc/0x110 drivers/scsi/scsi_scan.c:1950 scsi_remove_host+0x121/0x730 drivers/scsi/hosts.c:180 virtscsi_remove+0x12f/0x1d0 drivers/scsi/virtio_scsi.c:933 virtio_dev_remove+0x92/0x1a0 drivers/virtio/virtio.c:300 __device_release_driver drivers/base/dd.c:1247 [inline] device_release_driver_internal+0x44c/0x710 drivers/base/dd.c:1282 bus_remove_device+0x2dd/0x400 drivers/base/bus.c:531 device_del+0x63f/0xa80 drivers/base/core.c:3615 device_unregister+0x1c/0xc0 drivers/base/core.c:3660 unregister_virtio_device+0x33/0x60 drivers/virtio/virtio.c:449 virtio_pci_remove+0x7b/0xe0 drivers/virtio/virtio_pci_common.c:589 pci_device_remove+0x93/0x230 drivers/pci/pci-driver.c:471 __device_release_driver drivers/base/dd.c:1247 [inline] device_release_driver_internal+0x44c/0x710 drivers/base/dd.c:1282 unbind_store+0x2e2/0x300 drivers/base/bus.c:193 kernfs_fop_write_iter+0x3a8/0x500 fs/kernfs/file.c:296 call_write_iter include/linux/fs.h:2173 [inline] new_sync_write fs/read_write.c:507 [inline] vfs_write+0x748/0xd70 fs/read_write.c:594 ksys_write+0x153/0x260 fs/read_write.c:647 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 other info that might help us debug this: Chain exists of: &disk->open_mutex --> &of->mutex --> &shost->scan_mutex Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&shost->scan_mutex); lock(&of->mutex); lock(&shost->scan_mutex); lock(&disk->open_mutex); *** DEADLOCK *** 7 locks held by syz.8.2086/11362: #0: ffff888077002d70 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x2bf/0x370 fs/file.c:1056 #1: ffff88807d778460 (sb_writers#8){.+.+}-{0:0}, at: vfs_write+0x296/0xd70 fs/read_write.c:590 #2: ffff888061d48c88 (&of->mutex){+.+.}-{3:3}, at: kernfs_fop_write_iter+0x1dc/0x500 fs/kernfs/file.c:287 #3: ffff88801bd2e248 (&dev->mutex){....}-{3:3}, at: device_lock include/linux/device.h:809 [inline] #3: ffff88801bd2e248 (&dev->mutex){....}-{3:3}, at: __device_driver_lock drivers/base/dd.c:1064 [inline] #3: ffff88801bd2e248 (&dev->mutex){....}-{3:3}, at: device_release_driver_internal+0xa1/0x710 drivers/base/dd.c:1279 #4: ffff8881462a2200 (&dev->mutex){....}-{3:3}, at: device_lock include/linux/device.h:809 [inline] #4: ffff8881462a2200 (&dev->mutex){....}-{3:3}, at: __device_driver_lock drivers/base/dd.c:1064 [inline] #4: ffff8881462a2200 (&dev->mutex){....}-{3:3}, at: device_release_driver_internal+0xa1/0x710 drivers/base/dd.c:1279 #5: ffff8880219380e0 (&shost->scan_mutex){+.+.}-{3:3}, at: scsi_remove_host+0x2e/0x730 drivers/scsi/hosts.c:168 #6: ffff8880219ca3d8 (&dev->mutex){....}-{3:3}, at: device_lock include/linux/device.h:809 [inline] #6: ffff8880219ca3d8 (&dev->mutex){....}-{3:3}, at: __device_driver_lock drivers/base/dd.c:1064 [inline] #6: ffff8880219ca3d8 (&dev->mutex){....}-{3:3}, at: device_release_driver_internal+0xa1/0x710 drivers/base/dd.c:1279 stack backtrace: CPU: 0 PID: 11362 Comm: syz.8.2086 Not tainted syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026 Call Trace: dump_stack_lvl+0x188/0x250 lib/dump_stack.c:106 check_noncircular+0x296/0x330 kernel/locking/lockdep.c:2133 check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain kernel/locking/lockdep.c:3788 [inline] __lock_acquire+0x2c66/0x7b50 kernel/locking/lockdep.c:5012 lock_acquire+0x19e/0x400 kernel/locking/lockdep.c:5623 __mutex_lock_common+0x1e5/0x2400 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 del_gendisk+0x145/0x780 block/genhd.c:595 sd_remove+0x9b/0xf0 drivers/scsi/sd.c:3510 __device_release_driver drivers/base/dd.c:1249 [inline] device_release_driver_internal+0x487/0x710 drivers/base/dd.c:1282 bus_remove_device+0x2dd/0x400 drivers/base/bus.c:531 device_del+0x63f/0xa80 drivers/base/core.c:3615 __scsi_remove_device+0x1f3/0x3c0 drivers/scsi/scsi_sysfs.c:1479 scsi_forget_host+0xcc/0x110 drivers/scsi/scsi_scan.c:1950 scsi_remove_host+0x121/0x730 drivers/scsi/hosts.c:180 virtscsi_remove+0x12f/0x1d0 drivers/scsi/virtio_scsi.c:933 virtio_dev_remove+0x92/0x1a0 drivers/virtio/virtio.c:300 __device_release_driver drivers/base/dd.c:1247 [inline] device_release_driver_internal+0x44c/0x710 drivers/base/dd.c:1282 bus_remove_device+0x2dd/0x400 drivers/base/bus.c:531 device_del+0x63f/0xa80 drivers/base/core.c:3615 device_unregister+0x1c/0xc0 drivers/base/core.c:3660 unregister_virtio_device+0x33/0x60 drivers/virtio/virtio.c:449 virtio_pci_remove+0x7b/0xe0 drivers/virtio/virtio_pci_common.c:589 pci_device_remove+0x93/0x230 drivers/pci/pci-driver.c:471 __device_release_driver drivers/base/dd.c:1247 [inline] device_release_driver_internal+0x44c/0x710 drivers/base/dd.c:1282 unbind_store+0x2e2/0x300 drivers/base/bus.c:193 kernfs_fop_write_iter+0x3a8/0x500 fs/kernfs/file.c:296 call_write_iter include/linux/fs.h:2173 [inline] new_sync_write fs/read_write.c:507 [inline] vfs_write+0x748/0xd70 fs/read_write.c:594 ksys_write+0x153/0x260 fs/read_write.c:647 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 RIP: 0033:0x7f68ca5950d9 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 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 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f68c87ed028 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f68ca81cfa0 RCX: 00007f68ca5950d9 RDX: 000000000000000c RSI: 00002000000000c0 RDI: 0000000000000003 RBP: 00007f68ca62c024 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f68ca81d038 R14: 00007f68ca81cfa0 R15: 00007ffea9a139a8 sd 0:0:1:0: [sda] Synchronizing SCSI cache