===================================== WARNING: bad unlock balance detected! 4.14.168-syzkaller #0 Not tainted ------------------------------------- syz-executor.4/22292 is trying to release lock (&file->mut) at: [] ucma_destroy_id+0x236/0x400 drivers/infiniband/core/ucma.c:606 but there are no more locks to release! other info that might help us debug this: 1 lock held by syz-executor.4/22292: #0: (&file->mut){+.+.}, at: [] ucma_destroy_id+0x1d3/0x400 drivers/infiniband/core/ucma.c:604 stack backtrace: CPU: 1 PID: 22292 Comm: syz-executor.4 Not tainted 4.14.168-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+0xf7/0x13b lib/dump_stack.c:58 print_unlock_imbalance_bug.cold.62+0x114/0x123 kernel/locking/lockdep.c:3548 __lock_release kernel/locking/lockdep.c:3765 [inline] lock_release+0x623/0x830 kernel/locking/lockdep.c:4013 __mutex_unlock_slowpath+0x7d/0x7e0 kernel/locking/mutex.c:1018 mutex_unlock+0xd/0x10 kernel/locking/mutex.c:614 ucma_destroy_id+0x236/0x400 drivers/infiniband/core/ucma.c:606 ucma_write+0x1f1/0x2c0 drivers/infiniband/core/ucma.c:1672 __vfs_write+0xdb/0x840 fs/read_write.c:480 vfs_write+0x150/0x4f0 fs/read_write.c:544 SYSC_write fs/read_write.c:590 [inline] SyS_write+0x100/0x250 fs/read_write.c:582 do_syscall_64+0x1c7/0x5b0 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 RIP: 0033:0x45a679 RSP: 002b:00007f2d2d9d0c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 000000000045a679 RDX: 0000000000000018 RSI: 0000000020000140 RDI: 0000000000000003 RBP: 000000000075bfc8 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f2d2d9d16d4 R13: 00000000004d2b20 R14: 00000000004e3ba8 R15: 00000000ffffffff ================================================================== BUG: KASAN: use-after-free in __read_once_size include/linux/compiler.h:183 [inline] BUG: KASAN: use-after-free in atomic64_read arch/x86/include/asm/atomic64_64.h:22 [inline] BUG: KASAN: use-after-free in atomic_long_read include/asm-generic/atomic-long.h:45 [inline] BUG: KASAN: use-after-free in __mutex_unlock_slowpath+0x6c7/0x7e0 kernel/locking/mutex.c:1027 Read of size 8 at addr ffff8880a8dd2780 by task syz-executor.4/22292 CPU: 1 PID: 22292 Comm: syz-executor.4 Not tainted 4.14.168-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+0xf7/0x13b lib/dump_stack.c:58 print_address_description.cold.7+0x9/0x1c9 mm/kasan/report.c:252 kasan_report_error mm/kasan/report.c:351 [inline] kasan_report.cold.8+0x11a/0x2d3 mm/kasan/report.c:409 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430 __read_once_size include/linux/compiler.h:183 [inline] atomic64_read arch/x86/include/asm/atomic64_64.h:22 [inline] atomic_long_read include/asm-generic/atomic-long.h:45 [inline] __mutex_unlock_slowpath+0x6c7/0x7e0 kernel/locking/mutex.c:1027 mutex_unlock+0xd/0x10 kernel/locking/mutex.c:614 ucma_destroy_id+0x236/0x400 drivers/infiniband/core/ucma.c:606 ucma_write+0x1f1/0x2c0 drivers/infiniband/core/ucma.c:1672 __vfs_write+0xdb/0x840 fs/read_write.c:480 vfs_write+0x150/0x4f0 fs/read_write.c:544 SYSC_write fs/read_write.c:590 [inline] SyS_write+0x100/0x250 fs/read_write.c:582 do_syscall_64+0x1c7/0x5b0 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 RIP: 0033:0x45a679 RSP: 002b:00007f2d2d9d0c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 000000000045a679 RDX: 0000000000000018 RSI: 0000000020000140 RDI: 0000000000000003 RBP: 000000000075bfc8 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f2d2d9d16d4 R13: 00000000004d2b20 R14: 00000000004e3ba8 R15: 00000000ffffffff Allocated by task 22323: save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59 save_stack+0x43/0xd0 mm/kasan/kasan.c:447 set_track mm/kasan/kasan.c:459 [inline] kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:551 kmem_cache_alloc_trace+0x152/0x7a0 mm/slab.c:3618 kmalloc include/linux/slab.h:488 [inline] ucma_open+0x4d/0x260 drivers/infiniband/core/ucma.c:1704 misc_open+0x31b/0x4d0 drivers/char/misc.c:154 chrdev_open+0x1e9/0x5b0 fs/char_dev.c:423 do_dentry_open+0x620/0xdb0 fs/open.c:777 vfs_open+0xfc/0x240 fs/open.c:891 do_last fs/namei.c:3425 [inline] path_openat+0xe6d/0x3b50 fs/namei.c:3566 do_filp_open+0x16b/0x220 fs/namei.c:3600 do_sys_open+0x1c2/0x340 fs/open.c:1084 SYSC_openat fs/open.c:1111 [inline] SyS_openat+0xf/0x20 fs/open.c:1105 do_syscall_64+0x1c7/0x5b0 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 Freed by task 22274: save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59 save_stack+0x43/0xd0 mm/kasan/kasan.c:447 set_track mm/kasan/kasan.c:459 [inline] kasan_slab_free+0x71/0xc0 mm/kasan/kasan.c:524 __cache_free mm/slab.c:3496 [inline] kfree+0xcc/0x270 mm/slab.c:3815 ucma_close+0x246/0x2e0 drivers/infiniband/core/ucma.c:1763 __fput+0x232/0x750 fs/file_table.c:210 ____fput+0x9/0x10 fs/file_table.c:244 task_work_run+0xe5/0x170 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:191 [inline] exit_to_usermode_loop+0x16a/0x1b0 arch/x86/entry/common.c:164 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline] syscall_return_slowpath arch/x86/entry/common.c:270 [inline] do_syscall_64+0x416/0x5b0 arch/x86/entry/common.c:297 entry_SYSCALL_64_after_hwframe+0x42/0xb7 The buggy address belongs to the object at ffff8880a8dd2780 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 0 bytes inside of 256-byte region [ffff8880a8dd2780, ffff8880a8dd2880) The buggy address belongs to the page: page:ffffea0002a37480 count:1 mapcount:0 mapping:ffff8880a8dd2000 index:0x0 flags: 0xfffe0000000100(slab) raw: 00fffe0000000100 ffff8880a8dd2000 0000000000000000 000000010000000c raw: ffffea0002a5f620 ffffea00025bfea0 ffff8880aa8007c0 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8880a8dd2680: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff8880a8dd2700: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc >ffff8880a8dd2780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880a8dd2800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880a8dd2880: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00 ==================================================================