===================================== WARNING: bad unlock balance detected! 4.14.216-syzkaller #0 Not tainted ------------------------------------- syz-executor.3/29396 is trying to release lock (&file->mut) at: [] ucma_destroy_id+0x1eb/0x420 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.3/29396: #0: (&file->mut){+.+.}, at: [] ucma_destroy_id+0x18c/0x420 drivers/infiniband/core/ucma.c:604 stack backtrace: CPU: 0 PID: 29396 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_unlock_imbalance_bug include/trace/events/lock.h:58 [inline] __lock_release kernel/locking/lockdep.c:3769 [inline] lock_release.cold+0x70/0xbf kernel/locking/lockdep.c:4017 __mutex_unlock_slowpath+0x75/0x770 kernel/locking/mutex.c:1018 ucma_destroy_id+0x1eb/0x420 drivers/infiniband/core/ucma.c:606 ucma_write+0x206/0x2c0 drivers/infiniband/core/ucma.c:1672 __vfs_write+0xe4/0x630 fs/read_write.c:480 vfs_write+0x17f/0x4d0 fs/read_write.c:544 SYSC_write fs/read_write.c:590 [inline] SyS_write+0xf2/0x210 fs/read_write.c:582 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb RIP: 0033:0x45e219 RSP: 002b:00007f5da2af3c68 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 000000000045e219 RDX: 0000000000000018 RSI: 0000000020000080 RDI: 0000000000000003 RBP: 000000000119c068 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000119c034 R13: 00007ffdf66cf77f R14: 00007f5da2af49c0 R15: 000000000119c034 ================================================================== 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+0x5bd/0x770 kernel/locking/mutex.c:1027 Read of size 8 at addr ffff8880ac243040 by task syz-executor.3/29396 CPU: 0 PID: 29396 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_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252 kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:351 kasan_report mm/kasan/report.c:409 [inline] __asan_report_load8_noabort+0x68/0x70 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+0x5bd/0x770 kernel/locking/mutex.c:1027 ucma_destroy_id+0x1eb/0x420 drivers/infiniband/core/ucma.c:606 ucma_write+0x206/0x2c0 drivers/infiniband/core/ucma.c:1672 __vfs_write+0xe4/0x630 fs/read_write.c:480 vfs_write+0x17f/0x4d0 fs/read_write.c:544 SYSC_write fs/read_write.c:590 [inline] SyS_write+0xf2/0x210 fs/read_write.c:582 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb RIP: 0033:0x45e219 RSP: 002b:00007f5da2af3c68 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 000000000045e219 RDX: 0000000000000018 RSI: 0000000020000080 RDI: 0000000000000003 RBP: 000000000119c068 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000119c034 R13: 00007ffdf66cf77f R14: 00007f5da2af49c0 R15: 000000000119c034 Allocated by task 29355: save_stack mm/kasan/kasan.c:447 [inline] set_track mm/kasan/kasan.c:459 [inline] kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551 kmem_cache_alloc_trace+0x131/0x3d0 mm/slab.c:3618 kmalloc include/linux/slab.h:488 [inline] ucma_open+0x4a/0x280 drivers/infiniband/core/ucma.c:1704 misc_open+0x337/0x460 drivers/char/misc.c:154 chrdev_open+0x23c/0x6d0 fs/char_dev.c:423 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 Freed by task 29354: save_stack mm/kasan/kasan.c:447 [inline] set_track mm/kasan/kasan.c:459 [inline] kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524 __cache_free mm/slab.c:3496 [inline] kfree+0xc9/0x250 mm/slab.c:3815 ucma_close+0x299/0x340 drivers/infiniband/core/ucma.c:1763 __fput+0x25f/0x7a0 fs/file_table.c:210 task_work_run+0x11f/0x190 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:191 [inline] exit_to_usermode_loop+0x1ad/0x200 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+0x4a3/0x640 arch/x86/entry/common.c:297 entry_SYSCALL_64_after_hwframe+0x46/0xbb The buggy address belongs to the object at ffff8880ac243040 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 0 bytes inside of 256-byte region [ffff8880ac243040, ffff8880ac243140) The buggy address belongs to the page: page:ffffea0002b090c0 count:1 mapcount:0 mapping:ffff8880ac243040 index:0x0 flags: 0xfff00000000100(slab) raw: 00fff00000000100 ffff8880ac243040 0000000000000000 000000010000000c raw: ffffea0002b9b420 ffffea0002af4660 ffff88813fe807c0 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8880ac242f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880ac242f80: fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc >ffff8880ac243000: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb ^ ffff8880ac243080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880ac243100: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ==================================================================