================================================================== BUG: KASAN: slab-use-after-free in instrument_atomic_read_write include/linux/instrumented.h:96 [inline] BUG: KASAN: slab-use-after-free in atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:400 [inline] BUG: KASAN: slab-use-after-free in __refcount_sub_and_test include/linux/refcount.h:264 [inline] BUG: KASAN: slab-use-after-free in __refcount_dec_and_test include/linux/refcount.h:307 [inline] BUG: KASAN: slab-use-after-free in refcount_dec_and_test include/linux/refcount.h:325 [inline] BUG: KASAN: slab-use-after-free in kref_put include/linux/kref.h:64 [inline] BUG: KASAN: slab-use-after-free in sco_conn_put+0x38/0x224 net/bluetooth/sco.c:107 Write of size 4 at addr ffff0000c9f870fc by task syz.4.49/6807 CPU: 1 UID: 0 PID: 6807 Comm: syz.4.49 Not tainted 6.13.0-rc3-syzkaller-g573067a5a685 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call trace: show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:466 (C) __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0xe4/0x150 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x198/0x538 mm/kasan/report.c:489 kasan_report+0xd8/0x138 mm/kasan/report.c:602 kasan_check_range+0x268/0x2a8 mm/kasan/generic.c:189 __kasan_check_write+0x20/0x30 mm/kasan/shadow.c:37 instrument_atomic_read_write include/linux/instrumented.h:96 [inline] atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:400 [inline] __refcount_sub_and_test include/linux/refcount.h:264 [inline] __refcount_dec_and_test include/linux/refcount.h:307 [inline] refcount_dec_and_test include/linux/refcount.h:325 [inline] kref_put include/linux/kref.h:64 [inline] sco_conn_put+0x38/0x224 net/bluetooth/sco.c:107 sco_chan_del net/bluetooth/sco.c:236 [inline] __sco_sock_close+0x240/0x41c net/bluetooth/sco.c:511 sco_sock_close net/bluetooth/sco.c:526 [inline] sco_sock_release+0xb4/0x2c0 net/bluetooth/sco.c:1300 __sock_release net/socket.c:640 [inline] sock_close+0xa4/0x1e8 net/socket.c:1408 __fput+0x1bc/0x75c fs/file_table.c:450 ____fput+0x20/0x30 fs/file_table.c:478 task_work_run+0x230/0x2e0 kernel/task_work.c:239 get_signal+0x1358/0x1534 kernel/signal.c:2790 do_signal+0x22c/0x39f4 arch/arm64/kernel/signal.c:1663 do_notify_resume+0x74/0x1f4 arch/arm64/kernel/entry-common.c:148 exit_to_user_mode_prepare arch/arm64/kernel/entry-common.c:169 [inline] exit_to_user_mode arch/arm64/kernel/entry-common.c:178 [inline] el0_svc+0xac/0x168 arch/arm64/kernel/entry-common.c:745 el0t_64_sync_handler+0x84/0x108 arch/arm64/kernel/entry-common.c:762 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600 Allocated by task 6807: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x40/0x78 mm/kasan/common.c:68 kasan_save_alloc_info+0x40/0x50 mm/kasan/generic.c:568 poison_kmalloc_redzone mm/kasan/common.c:377 [inline] __kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:394 kasan_kmalloc include/linux/kasan.h:260 [inline] __kmalloc_cache_noprof+0x2cc/0x428 mm/slub.c:4329 kmalloc_noprof include/linux/slab.h:901 [inline] kzalloc_noprof include/linux/slab.h:1037 [inline] sco_conn_add+0xb4/0x30c net/bluetooth/sco.c:199 sco_connect net/bluetooth/sco.c:339 [inline] sco_sock_connect+0x2a0/0x824 net/bluetooth/sco.c:648 __sys_connect_file net/socket.c:2055 [inline] __sys_connect+0x260/0x294 net/socket.c:2074 __do_sys_connect net/socket.c:2080 [inline] __se_sys_connect net/socket.c:2077 [inline] __arm64_sys_connect+0x7c/0x94 net/socket.c:2077 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:49 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:132 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:744 el0t_64_sync_handler+0x84/0x108 arch/arm64/kernel/entry-common.c:762 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600 Freed by task 6808: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x40/0x78 mm/kasan/common.c:68 kasan_save_free_info+0x54/0x6c mm/kasan/generic.c:582 poison_slab_object mm/kasan/common.c:247 [inline] __kasan_slab_free+0x64/0x8c mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:233 [inline] slab_free_hook mm/slub.c:2353 [inline] slab_free mm/slub.c:4613 [inline] kfree+0x180/0x478 mm/slub.c:4761 sco_conn_free net/bluetooth/sco.c:97 [inline] kref_put include/linux/kref.h:65 [inline] sco_conn_put+0x14c/0x224 net/bluetooth/sco.c:107 sco_conn_del+0x204/0x468 net/bluetooth/sco.c:263 sco_connect_cfm+0xb4/0x8f4 net/bluetooth/sco.c:1417 hci_connect_cfm include/net/bluetooth/hci_core.h:2057 [inline] hci_conn_failed+0x228/0x3c0 net/bluetooth/hci_conn.c:1266 hci_conn_unlink+0x308/0x4b0 net/bluetooth/hci_conn.c:1103 hci_conn_del+0x60/0xaa4 net/bluetooth/hci_conn.c:1129 hci_conn_failed+0x29c/0x3c0 net/bluetooth/hci_conn.c:1267 hci_abort_conn_sync+0xa28/0xf54 net/bluetooth/hci_sync.c:5603 hci_disconnect_all_sync+0x220/0x410 net/bluetooth/hci_sync.c:5626 hci_suspend_sync+0x448/0xb84 net/bluetooth/hci_sync.c:6103 hci_suspend_dev+0x194/0x358 net/bluetooth/hci_core.c:2831 hci_suspend_notifier+0xc8/0x278 net/bluetooth/hci_core.c:2411 notifier_call_chain+0x1c4/0x550 kernel/notifier.c:85 notifier_call_chain_robust kernel/notifier.c:120 [inline] blocking_notifier_call_chain_robust+0xdc/0x1bc kernel/notifier.c:345 pm_notifier_call_chain_robust+0x34/0x64 kernel/power/main.c:102 snapshot_open+0x184/0x270 kernel/power/user.c:77 misc_open+0x2b8/0x328 drivers/char/misc.c:165 chrdev_open+0x3b0/0x4bc fs/char_dev.c:414 do_dentry_open+0xc0c/0x168c fs/open.c:945 vfs_open+0x48/0x2d4 fs/open.c:1075 do_open fs/namei.c:3828 [inline] path_openat+0x2300/0x2b14 fs/namei.c:3987 do_filp_open+0x1e8/0x404 fs/namei.c:4014 do_sys_openat2+0x124/0x1b8 fs/open.c:1402 do_sys_open fs/open.c:1417 [inline] __do_sys_openat fs/open.c:1433 [inline] __se_sys_openat fs/open.c:1428 [inline] __arm64_sys_openat+0x1f0/0x240 fs/open.c:1428 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:49 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:132 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:744 el0t_64_sync_handler+0x84/0x108 arch/arm64/kernel/entry-common.c:762 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600 The buggy address belongs to the object at ffff0000c9f87000 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 252 bytes inside of freed 256-byte region [ffff0000c9f87000, ffff0000c9f87100) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x109f86 head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x5ffc00000000040(head|node=0|zone=2|lastcpupid=0x7ff) page_type: f5(slab) raw: 05ffc00000000040 ffff0000c0001b40 dead000000000100 dead000000000122 raw: 0000000000000000 0000000000100010 00000001f5000000 0000000000000000 head: 05ffc00000000040 ffff0000c0001b40 dead000000000100 dead000000000122 head: 0000000000000000 0000000000100010 00000001f5000000 0000000000000000 head: 05ffc00000000001 fffffdffc327e181 ffffffffffffffff 0000000000000000 head: 0000000000000002 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff0000c9f86f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff0000c9f87000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff0000c9f87080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff0000c9f87100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff0000c9f87180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ================================================================== ------------[ cut here ]------------ refcount_t: underflow; use-after-free. WARNING: CPU: 1 PID: 6807 at lib/refcount.c:28 refcount_warn_saturate+0x1c8/0x20c lib/refcount.c:28 Modules linked in: CPU: 1 UID: 0 PID: 6807 Comm: syz.4.49 Tainted: G B 6.13.0-rc3-syzkaller-g573067a5a685 #0 Tainted: [B]=BAD_PAGE Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : refcount_warn_saturate+0x1c8/0x20c lib/refcount.c:28 lr : refcount_warn_saturate+0x1c8/0x20c lib/refcount.c:28 sp : ffff8000a45d76d0 x29: ffff8000a45d76d0 x28: ffff0000cdd57490 x27: 1fffe0001a16307a x26: 1fffe0001efa5802 x25: dfff800000000000 x24: ffff80008dfa1890 x23: dfff800000000000 x22: ffff0000c9f87008 x21: 0000000000000003 x20: ffff0000c9f870fc x19: ffff800092c5f000 x18: 0000000000000008 x17: 0000000000000000 x16: ffff80008b5fe85c x15: ffff700011f43a38 x14: 1ffff00011f43a38 x13: 0000000000000004 x12: ffffffffffffffff x11: 0000000000080000 x10: 00000000000338ab x9 : 37c25a7ac2853600 x8 : 37c25a7ac2853600 x7 : 0000000000000001 x6 : 0000000000000001 x5 : ffff8000a45d6df8 x4 : ffff80008fa8f840 x3 : ffff8000804a225c x2 : 0000000000000000 x1 : 0000000100000000 x0 : 0000000000000000 Call trace: refcount_warn_saturate+0x1c8/0x20c lib/refcount.c:28 (P) __refcount_sub_and_test include/linux/refcount.h:275 [inline] __refcount_dec_and_test include/linux/refcount.h:307 [inline] refcount_dec_and_test include/linux/refcount.h:325 [inline] kref_put include/linux/kref.h:64 [inline] sco_conn_put+0x170/0x224 net/bluetooth/sco.c:107 sco_chan_del net/bluetooth/sco.c:236 [inline] __sco_sock_close+0x240/0x41c net/bluetooth/sco.c:511 sco_sock_close net/bluetooth/sco.c:526 [inline] sco_sock_release+0xb4/0x2c0 net/bluetooth/sco.c:1300 __sock_release net/socket.c:640 [inline] sock_close+0xa4/0x1e8 net/socket.c:1408 __fput+0x1bc/0x75c fs/file_table.c:450 ____fput+0x20/0x30 fs/file_table.c:478 task_work_run+0x230/0x2e0 kernel/task_work.c:239 get_signal+0x1358/0x1534 kernel/signal.c:2790 do_signal+0x22c/0x39f4 arch/arm64/kernel/signal.c:1663 do_notify_resume+0x74/0x1f4 arch/arm64/kernel/entry-common.c:148 exit_to_user_mode_prepare arch/arm64/kernel/entry-common.c:169 [inline] exit_to_user_mode arch/arm64/kernel/entry-common.c:178 [inline] el0_svc+0xac/0x168 arch/arm64/kernel/entry-common.c:745 el0t_64_sync_handler+0x84/0x108 arch/arm64/kernel/entry-common.c:762 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600 irq event stamp: 2681 hardirqs last enabled at (2681): [] raw_spin_rq_unlock_irq kernel/sched/sched.h:1535 [inline] hardirqs last enabled at (2681): [] finish_lock_switch+0xbc/0x1e4 kernel/sched/core.c:5123 hardirqs last disabled at (2680): [] __schedule+0x2bc/0x27f0 kernel/sched/core.c:6660 softirqs last enabled at (2556): [] softirq_handle_end kernel/softirq.c:407 [inline] softirqs last enabled at (2556): [] handle_softirqs+0xb44/0xd34 kernel/softirq.c:589 softirqs last disabled at (1391): [] __do_softirq+0x14/0x20 kernel/softirq.c:595 ---[ end trace 0000000000000000 ]---