batman_adv: batadv0: Removing interface: batadv_slave_0 block nbd3: shutting down sockets netlink: 12 bytes leftover after parsing attributes in process `syz-executor.0'. team0: Device batadv_slave_0 is up. Set it down before adding it as a team port ====================================================== WARNING: possible circular locking dependency detected ip_tables: iptables: counters copy to user failed while replacing table 4.14.216-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.3/15199 is trying to acquire lock: (&bdev->bd_mutex){+.+.}, at: [] blkdev_reread_part+0x1b/0x40 block/ioctl.c:192 but task is already holding lock: (&nbd->config_lock){+.+.}, at: [] nbd_ioctl+0x11f/0xa80 drivers/block/nbd.c:1359 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&nbd->config_lock){+.+.}: __mutex_lock_common kernel/locking/mutex.c:756 [inline] __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893 nbd_open+0x1b4/0x380 drivers/block/nbd.c:1407 __blkdev_get+0x306/0x1090 fs/block_dev.c:1470 blkdev_get+0x88/0x890 fs/block_dev.c:1611 team0: Device batadv_slave_0 is up. Set it down before adding it as a team port blkdev_open+0x1cc/0x250 fs/block_dev.c:1772 do_dentry_open+0x44b/0xec0 fs/open.c:777 vfs_open+0x105/0x220 fs/open.c:888 do_last fs/namei.c:3428 [inline] path_openat+0x628/0x2970 fs/namei.c:3569 do_filp_open+0x179/0x3c0 fs/namei.c:3603 do_sys_open+0x296/0x410 fs/open.c:1081 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb -> #1 (nbd_index_mutex){+.+.}: __mutex_lock_common kernel/locking/mutex.c:756 [inline] __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893 nbd_open+0x22/0x380 drivers/block/nbd.c:1394 __blkdev_get+0x306/0x1090 fs/block_dev.c:1470 blkdev_get+0x88/0x890 fs/block_dev.c:1611 blkdev_open+0x1cc/0x250 fs/block_dev.c:1772 do_dentry_open+0x44b/0xec0 fs/open.c:777 vfs_open+0x105/0x220 fs/open.c:888 do_last fs/namei.c:3428 [inline] path_openat+0x628/0x2970 fs/namei.c:3569 do_filp_open+0x179/0x3c0 fs/namei.c:3603 do_sys_open+0x296/0x410 fs/open.c:1081 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb -> #0 (&bdev->bd_mutex){+.+.}: lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998 __mutex_lock_common kernel/locking/mutex.c:756 [inline] __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893 blkdev_reread_part+0x1b/0x40 block/ioctl.c:192 nbd_bdev_reset drivers/block/nbd.c:1068 [inline] nbd_clear_sock_ioctl drivers/block/nbd.c:1272 [inline] __nbd_ioctl drivers/block/nbd.c:1296 [inline] nbd_ioctl+0x7cb/0xa80 drivers/block/nbd.c:1366 __blkdev_driver_ioctl block/ioctl.c:297 [inline] blkdev_ioctl+0x540/0x1830 block/ioctl.c:594 block_ioctl+0xd9/0x120 fs/block_dev.c:1893 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:500 [inline] do_vfs_ioctl+0x75a/0xff0 fs/ioctl.c:684 SYSC_ioctl fs/ioctl.c:701 [inline] SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb other info that might help us debug this: Chain exists of: &bdev->bd_mutex --> nbd_index_mutex --> &nbd->config_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&nbd->config_lock); lock(nbd_index_mutex); lock(&nbd->config_lock); lock(&bdev->bd_mutex); *** DEADLOCK *** 1 lock held by syz-executor.3/15199: #0: (&nbd->config_lock){+.+.}, at: [] nbd_ioctl+0x11f/0xa80 drivers/block/nbd.c:1359 stack backtrace: CPU: 0 PID: 15199 Comm: syz-executor.3 Not tainted 4.14.216-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x1b2/0x281 lib/dump_stack.c:58 print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1258 check_prev_add kernel/locking/lockdep.c:1905 [inline] check_prevs_add kernel/locking/lockdep.c:2022 [inline] validate_chain kernel/locking/lockdep.c:2464 [inline] __lock_acquire+0x2e0e/0x3f20 kernel/locking/lockdep.c:3491 lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998 __mutex_lock_common kernel/locking/mutex.c:756 [inline] __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893 blkdev_reread_part+0x1b/0x40 block/ioctl.c:192 nbd_bdev_reset drivers/block/nbd.c:1068 [inline] nbd_clear_sock_ioctl drivers/block/nbd.c:1272 [inline] __nbd_ioctl drivers/block/nbd.c:1296 [inline] nbd_ioctl+0x7cb/0xa80 drivers/block/nbd.c:1366 __blkdev_driver_ioctl block/ioctl.c:297 [inline] blkdev_ioctl+0x540/0x1830 block/ioctl.c:594 block_ioctl+0xd9/0x120 fs/block_dev.c:1893 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:500 [inline] do_vfs_ioctl+0x75a/0xff0 fs/ioctl.c:684 SYSC_ioctl fs/ioctl.c:701 [inline] SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb RIP: 0033:0x45e219 RSP: 002b:00007f3329001c68 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 000000000045e219 RDX: 0000000000000000 RSI: 000000000000ab04 RDI: 0000000000000007 RBP: 000000000119c060 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000119c034 R13: 00007fff31d4e7af R14: 00007f33290029c0 R15: 000000000119c034 netlink: 12 bytes leftover after parsing attributes in process `syz-executor.0'. block nbd3: shutting down sockets team0: Device batadv_slave_0 is up. Set it down before adding it as a team port block nbd5: shutting down sockets arp_tables: arptables: counters copy to user failed while replacing table block nbd2: shutting down sockets ip_tables: iptables: counters copy to user failed while replacing table block nbd2: shutting down sockets block nbd5: shutting down sockets team0: Device batadv_slave_0 is up. Set it down before adding it as a team port block nbd2: shutting down sockets block nbd3: shutting down sockets netlink: 12 bytes leftover after parsing attributes in process `syz-executor.0'. arp_tables: arptables: counters copy to user failed while replacing table ip_tables: iptables: counters copy to user failed while replacing table block nbd5: shutting down sockets team0: Device batadv_slave_0 is up. Set it down before adding it as a team port block nbd3: shutting down sockets block nbd2: shutting down sockets arp_tables: arptables: counters copy to user failed while replacing table block nbd2: shutting down sockets block nbd2: shutting down sockets arp_tables: arptables: counters copy to user failed while replacing table netlink: 12 bytes leftover after parsing attributes in process `syz-executor.2'. batman_adv: batadv0: Interface deactivated: batadv_slave_0 batman_adv: batadv0: Removing interface: batadv_slave_0 team0: Device batadv_slave_0 is up. Set it down before adding it as a team port ip_tables: iptables: counters copy to user failed while replacing table netlink: 12 bytes leftover after parsing attributes in process `syz-executor.2'. team0: Device batadv_slave_0 is up. Set it down before adding it as a team port team0: Device batadv_slave_0 is up. Set it down before adding it as a team port netlink: 12 bytes leftover after parsing attributes in process `syz-executor.2'. ptrace attach of "/root/syz-executor.2"[15577] was attempted by "/root/syz-executor.2"[15583] ptrace attach of "/root/syz-executor.0"[15624] was attempted by "/root/syz-executor.0"[15629] ptrace attach of "/root/syz-executor.1"[15622] was attempted by "/root/syz-executor.1"[15628] ptrace attach of "/root/syz-executor.2"[15627] was attempted by "/root/syz-executor.2"[15631] ptrace attach of "/root/syz-executor.2"[15640] was attempted by "/root/syz-executor.2"[15645] ptrace attach of "/root/syz-executor.1"[15641] was attempted by "/root/syz-executor.1"[15644] ptrace attach of "/root/syz-executor.0"[15642] was attempted by "/root/syz-executor.0"[15646] ptrace attach of "/root/syz-executor.5"[15663] was attempted by "/root/syz-executor.5"[15671] ptrace attach of "/root/syz-executor.2"[15660] was attempted by "/root/syz-executor.2"[15670] ptrace attach of "/root/syz-executor.4"[15667] was attempted by "/root/syz-executor.4"[15675] __report_access: 7 callbacks suppressed ptrace attach of "/root/syz-executor.1"[15713] was attempted by "/root/syz-executor.1"[15717] ptrace attach of "/root/syz-executor.2"[15715] was attempted by "/root/syz-executor.2"[15722] ptrace attach of "/root/syz-executor.4"[15716] was attempted by "/root/syz-executor.4"[15723] ptrace attach of "/root/syz-executor.1"[15728] was attempted by "/root/syz-executor.1"[15732]