================================================================== BUG: KASAN: use-after-free in atomic_inc include/asm-generic/atomic-instrumented.h:109 [inline] BUG: KASAN: use-after-free in hci_sock_bind+0x5b4/0x1120 net/bluetooth/hci_sock.c:1223 Write of size 4 at addr ffff888080ac2e60 by task syz-executor107/9041 CPU: 1 PID: 9041 Comm: syz-executor107 Not tainted 4.19.94-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x197/0x210 lib/dump_stack.c:118 print_address_description.cold+0x7c/0x20d mm/kasan/report.c:256 kasan_report_error mm/kasan/report.c:354 [inline] kasan_report mm/kasan/report.c:412 [inline] kasan_report.cold+0x8c/0x2ba mm/kasan/report.c:396 check_memory_region_inline mm/kasan/kasan.c:260 [inline] check_memory_region+0x123/0x190 mm/kasan/kasan.c:267 kasan_check_write+0x14/0x20 mm/kasan/kasan.c:278 atomic_inc include/asm-generic/atomic-instrumented.h:109 [inline] hci_sock_bind+0x5b4/0x1120 net/bluetooth/hci_sock.c:1223 __sys_bind+0x239/0x290 net/socket.c:1482 __do_sys_bind net/socket.c:1493 [inline] __se_sys_bind net/socket.c:1491 [inline] __x64_sys_bind+0x73/0xb0 net/socket.c:1491 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x449299 Code: e8 ac e7 ff ff 48 83 c4 18 c3 0f 1f 80 00 00 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 0f 83 4b 06 fc ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f4a80986d88 EFLAGS: 00000246 ORIG_RAX: 0000000000000031 RAX: ffffffffffffffda RBX: 00000000006e4a08 RCX: 0000000000449299 RDX: 0000000000000006 RSI: 00000000200007c0 RDI: 0000000000000004 RBP: 00000000006e4a00 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006e4a0c R13: 0000000000000005 R14: 0000000000000004 R15: 00007f4a809876d0 Allocated by task 9039: save_stack+0x45/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] kasan_kmalloc mm/kasan/kasan.c:553 [inline] kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:531 kmem_cache_alloc_trace+0x152/0x760 mm/slab.c:3625 kmalloc include/linux/slab.h:515 [inline] kzalloc include/linux/slab.h:709 [inline] hci_alloc_dev+0x43/0x1d00 net/bluetooth/hci_core.c:3053 __vhci_create_device+0x101/0x5a0 drivers/bluetooth/hci_vhci.c:114 vhci_create_device drivers/bluetooth/hci_vhci.c:163 [inline] vhci_get_user drivers/bluetooth/hci_vhci.c:219 [inline] vhci_write+0x2d6/0x470 drivers/bluetooth/hci_vhci.c:299 call_write_iter include/linux/fs.h:1820 [inline] new_sync_write fs/read_write.c:474 [inline] __vfs_write+0x587/0x810 fs/read_write.c:487 vfs_write+0x20c/0x560 fs/read_write.c:549 ksys_write+0x14f/0x2d0 fs/read_write.c:599 __do_sys_write fs/read_write.c:611 [inline] __se_sys_write fs/read_write.c:608 [inline] __x64_sys_write+0x73/0xb0 fs/read_write.c:608 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 9035: save_stack+0x45/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528 __cache_free mm/slab.c:3503 [inline] kfree+0xcf/0x220 mm/slab.c:3822 bt_host_release+0x19/0x30 net/bluetooth/hci_sysfs.c:86 device_release+0x7b/0x210 drivers/base/core.c:892 kobject_cleanup lib/kobject.c:662 [inline] kobject_release lib/kobject.c:691 [inline] kref_put include/linux/kref.h:70 [inline] kobject_put+0x193/0x290 lib/kobject.c:708 put_device+0x20/0x30 drivers/base/core.c:2082 hci_free_dev+0x19/0x20 net/bluetooth/hci_core.c:3145 vhci_release+0x7e/0xf0 drivers/bluetooth/hci_vhci.c:355 __fput+0x2dd/0x8b0 fs/file_table.c:278 ____fput+0x16/0x20 fs/file_table.c:309 task_work_run+0x145/0x1c0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:193 [inline] exit_to_usermode_loop+0x273/0x2c0 arch/x86/entry/common.c:167 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline] syscall_return_slowpath arch/x86/entry/common.c:271 [inline] do_syscall_64+0x53d/0x620 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff888080ac1e00 which belongs to the cache kmalloc-8192 of size 8192 The buggy address is located 4192 bytes inside of 8192-byte region [ffff888080ac1e00, ffff888080ac3e00) The buggy address belongs to the page: page:ffffea000202b000 count:1 mapcount:0 mapping:ffff88812c315080 index:0x0 compound_mapcount: 0 flags: 0xfffe0000008100(slab|head) raw: 00fffe0000008100 ffffea000248ec08 ffffea00025d7908 ffff88812c315080 raw: 0000000000000000 ffff888080ac1e00 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888080ac2d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888080ac2d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888080ac2e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888080ac2e80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888080ac2f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================