====================================================== WARNING: possible circular locking dependency detected 4.19.211-syzkaller #0 Not tainted ------------------------------------------------------ kworker/0:2/3689 is trying to acquire lock: 000000003c55d98a (&sb->s_type->i_mutex_key#10){++++}, at: inode_lock include/linux/fs.h:748 [inline] 000000003c55d98a (&sb->s_type->i_mutex_key#10){++++}, at: __generic_file_fsync+0xb0/0x1f0 fs/libfs.c:989 but task is already holding lock: 000000003ef931b6 ((work_completion)(&dio->complete_work)){+.+.}, at: process_one_work+0x79c/0x1570 kernel/workqueue.c:2128 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 ((work_completion)(&dio->complete_work)){+.+.}: worker_thread+0x64c/0x1130 kernel/workqueue.c:2296 kthread+0x33f/0x460 kernel/kthread.c:259 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415 -> #1 ((wq_completion)"dio/%s"sb->s_id){+.+.}: drain_workqueue+0x1a5/0x460 kernel/workqueue.c:2826 destroy_workqueue+0x75/0x790 kernel/workqueue.c:4183 __alloc_workqueue_key+0xb76/0xed0 kernel/workqueue.c:4160 sb_init_dio_done_wq+0x34/0x90 fs/direct-io.c:623 dio_set_defer_completion fs/direct-io.c:646 [inline] get_more_blocks fs/direct-io.c:724 [inline] do_direct_IO fs/direct-io.c:1003 [inline] do_blockdev_direct_IO fs/direct-io.c:1333 [inline] __blockdev_direct_IO+0x83a8/0xef40 fs/direct-io.c:1419 ext4_direct_IO_write fs/ext4/inode.c:3777 [inline] ext4_direct_IO+0xae4/0x1c50 fs/ext4/inode.c:3915 generic_file_direct_write+0x208/0x4a0 mm/filemap.c:3073 __generic_file_write_iter+0x2d0/0x610 mm/filemap.c:3252 ext4_file_write_iter+0x2fe/0xf20 fs/ext4/file.c:272 call_write_iter include/linux/fs.h:1821 [inline] aio_write+0x37f/0x5c0 fs/aio.c:1574 __io_submit_one fs/aio.c:1858 [inline] io_submit_one+0xecd/0x20c0 fs/aio.c:1909 __do_sys_io_submit fs/aio.c:1953 [inline] __se_sys_io_submit+0x11b/0x4a0 fs/aio.c:1924 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe -> #0 (&sb->s_type->i_mutex_key#10){++++}: down_write+0x34/0x90 kernel/locking/rwsem.c:70 inode_lock include/linux/fs.h:748 [inline] __generic_file_fsync+0xb0/0x1f0 fs/libfs.c:989 ext4_sync_file+0xa35/0x1420 fs/ext4/fsync.c:118 vfs_fsync_range+0x13a/0x220 fs/sync.c:197 generic_write_sync include/linux/fs.h:2750 [inline] dio_complete+0x763/0xac0 fs/direct-io.c:329 process_one_work+0x864/0x1570 kernel/workqueue.c:2153 worker_thread+0x64c/0x1130 kernel/workqueue.c:2296 kthread+0x33f/0x460 kernel/kthread.c:259 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415 other info that might help us debug this: Chain exists of: &sb->s_type->i_mutex_key#10 --> (wq_completion)"dio/%s"sb->s_id --> (work_completion)(&dio->complete_work) Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock((work_completion)(&dio->complete_work)); lock((wq_completion)"dio/%s"sb->s_id); lock((work_completion)(&dio->complete_work)); lock(&sb->s_type->i_mutex_key#10); *** DEADLOCK *** 2 locks held by kworker/0:2/3689: #0: 000000004fb60439 ((wq_completion)"dio/%s"sb->s_id){+.+.}, at: process_one_work+0x767/0x1570 kernel/workqueue.c:2124 #1: 000000003ef931b6 ((work_completion)(&dio->complete_work)){+.+.}, at: process_one_work+0x79c/0x1570 kernel/workqueue.c:2128 stack backtrace: CPU: 0 PID: 3689 Comm: kworker/0:2 Not tainted 4.19.211-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023 Workqueue: dio/sda1 dio_aio_complete_work Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x1fc/0x2ef lib/dump_stack.c:118 print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1222 check_prev_add kernel/locking/lockdep.c:1866 [inline] check_prevs_add kernel/locking/lockdep.c:1979 [inline] validate_chain kernel/locking/lockdep.c:2420 [inline] __lock_acquire+0x30c9/0x3ff0 kernel/locking/lockdep.c:3416 lock_acquire+0x170/0x3c0 kernel/locking/lockdep.c:3908 down_write+0x34/0x90 kernel/locking/rwsem.c:70 inode_lock include/linux/fs.h:748 [inline] __generic_file_fsync+0xb0/0x1f0 fs/libfs.c:989 ext4_sync_file+0xa35/0x1420 fs/ext4/fsync.c:118 vfs_fsync_range+0x13a/0x220 fs/sync.c:197 generic_write_sync include/linux/fs.h:2750 [inline] dio_complete+0x763/0xac0 fs/direct-io.c:329 process_one_work+0x864/0x1570 kernel/workqueue.c:2153 worker_thread+0x64c/0x1130 kernel/workqueue.c:2296 kthread+0x33f/0x460 kernel/kthread.c:259 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415 kauditd_printk_skb: 62 callbacks suppressed audit: type=1800 audit(1674813176.631:623): pid=31579 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.2" name="bus" dev="sda1" ino=15562 res=0 overlayfs: upper fs does not support tmpfile. overlayfs: upper fs does not support xattr, falling back to index=off and metacopy=off. overlayfs: './file0' not a directory audit: type=1800 audit(1674813176.721:624): pid=31622 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.2" name="bus" dev="sda1" ino=15553 res=0 audit: type=1800 audit(1674813176.721:625): pid=31622 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.2" name="bus" dev="sda1" ino=15553 res=0 audit: type=1800 audit(1674813176.721:626): pid=31622 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.2" name="bus" dev="sda1" ino=15553 res=0 audit: type=1800 audit(1674813176.721:627): pid=31622 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.2" name="bus" dev="sda1" ino=15553 res=0 audit: type=1800 audit(1674813176.721:628): pid=31622 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.2" name="bus" dev="sda1" ino=15553 res=0 audit: type=1800 audit(1674813176.721:629): pid=31622 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.2" name="bus" dev="sda1" ino=15553 res=0 audit: type=1800 audit(1674813176.721:630): pid=31622 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.2" name="bus" dev="sda1" ino=15553 res=0 audit: type=1800 audit(1674813176.721:631): pid=31622 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.2" name="bus" dev="sda1" ino=15553 res=0 audit: type=1800 audit(1674813176.721:632): pid=31622 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.2" name="bus" dev="sda1" ino=15553 res=0 netlink: 16 bytes leftover after parsing attributes in process `syz-executor.5'. netlink: 16 bytes leftover after parsing attributes in process `syz-executor.5'. netlink: 16 bytes leftover after parsing attributes in process `syz-executor.5'. netlink: 'syz-executor.0': attribute type 1 has an invalid length. base_sock_release(00000000a7fa9be5) sk=00000000f91bb1b1 device bond2 entered promiscuous mode device bond2 left promiscuous mode netlink: 'syz-executor.0': attribute type 1 has an invalid length. device bond3 entered promiscuous mode device bond3 left promiscuous mode netlink: 'syz-executor.0': attribute type 1 has an invalid length. device bond4 entered promiscuous mode device bond4 left promiscuous mode netlink: 'syz-executor.0': attribute type 1 has an invalid length. device bond5 entered promiscuous mode device bond5 left promiscuous mode x_tables: duplicate underflow at hook 2 hub 9-0:1.0: USB hub found hub 9-0:1.0: 8 ports detected x_tables: duplicate underflow at hook 2 base_sock_release(000000008f14f0f3) sk=000000001de3ef2a usb usb9: usbfs: interface 0 claimed by hub while 'syz-executor.5' sets config #0 x_tables: duplicate underflow at hook 2 x_tables: duplicate underflow at hook 2 x_tables: duplicate underflow at hook 2 usb usb9: usbfs: interface 0 claimed by hub while 'syz-executor.5' sets config #0 x_tables: duplicate underflow at hook 2 x_tables: duplicate underflow at hook 2 base_sock_release(0000000000a06cf3) sk=0000000094734d6b REISERFS (device loop5): found reiserfs format "3.5" with non-standard journal REISERFS (device loop5): using ordered data mode reiserfs: using flush barriers REISERFS (device loop5): journal params: device loop5, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30 REISERFS (device loop5): checking transaction log (loop5) ieee80211 phy45: Selected rate control algorithm 'minstrel_ht' REISERFS (device loop5): Using r5 hash to sort names REISERFS (device loop5): using 3.5.x disk format REISERFS (device loop5): Created .reiserfs_priv - reserved for xattr storage. kauditd_printk_skb: 57 callbacks suppressed audit: type=1800 audit(1674813181.682:690): pid=32145 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.5" name="bus" dev="loop5" ino=2 res=0 ieee80211 phy46: Selected rate control algorithm 'minstrel_ht' audit: type=1804 audit(1674813182.332:691): pid=32216 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.2" name="/root/syzkaller-testdir1074432291/syzkaller.rYdL0u/115/bus" dev="sda1" ino=15577 res=1 audit: type=1800 audit(1674813182.332:692): pid=32216 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.2" name="bus" dev="sda1" ino=15577 res=0 audit: type=1804 audit(1674813182.442:693): pid=32215 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.4" name="/root/syzkaller-testdir2949690121/syzkaller.ULtLRZ/456/bus" dev="sda1" ino=15155 res=1 audit: type=1804 audit(1674813182.482:694): pid=32215 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.4" name="/root/syzkaller-testdir2949690121/syzkaller.ULtLRZ/456/bus" dev="sda1" ino=15155 res=1 ieee80211 phy47: Selected rate control algorithm 'minstrel_ht' REISERFS (device loop5): found reiserfs format "3.5" with non-standard journal REISERFS (device loop5): using ordered data mode reiserfs: using flush barriers audit: type=1804 audit(1674813182.502:695): pid=32247 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.2" name="/root/syzkaller-testdir1074432291/syzkaller.rYdL0u/116/bus" dev="sda1" ino=15155 res=1 REISERFS (device loop5): journal params: device loop5, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30 audit: type=1800 audit(1674813182.502:696): pid=32247 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor.2" name="bus" dev="sda1" ino=15155 res=0 REISERFS (device loop5): checking transaction log (loop5) audit: type=1804 audit(1674813182.532:697): pid=32254 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=ToMToU comm="syz-executor.2" name="/root/syzkaller-testdir1074432291/syzkaller.rYdL0u/116/bus" dev="sda1" ino=15155 res=1 audit: type=1804 audit(1674813182.532:698): pid=32255 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.2" name="/root/syzkaller-testdir1074432291/syzkaller.rYdL0u/116/bus" dev="sda1" ino=15155 res=1 REISERFS (device loop5): Using r5 hash to sort names REISERFS (device loop5): using 3.5.x disk format REISERFS (device loop5): Created .reiserfs_priv - reserved for xattr storage. audit: type=1804 audit(1674813182.642:699): pid=32271 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.4" name="/root/syzkaller-testdir2949690121/syzkaller.ULtLRZ/457/bus" dev="sda1" ino=15538 res=1 IPVS: ftp: loaded support on port[0] = 21 REISERFS (device loop5): found reiserfs format "3.5" with non-standard journal REISERFS (device loop5): using ordered data mode reiserfs: using flush barriers REISERFS (device loop5): journal params: device loop5, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30 REISERFS (device loop5): checking transaction log (loop5) REISERFS (device loop5): Using r5 hash to sort names IPVS: ftp: loaded support on port[0] = 21 REISERFS (device loop5): using 3.5.x disk format REISERFS (device loop5): Created .reiserfs_priv - reserved for xattr storage. IPVS: ftp: loaded support on port[0] = 21 ieee802154 phy0 wpan0: encryption failed: -22 ieee802154 phy1 wpan1: encryption failed: -22