kobject_add_internal failed for hci0:201 with -EEXIST, don't try to register things with the same name in the same directory. Bluetooth: hci0: failed to register connection device ================================================================== BUG: KASAN: use-after-free in l2cap_sock_new_connection_cb+0x1d4/0x284 net/bluetooth/l2cap_sock.c:1517 Read of size 8 at addr ffff0000f5a0f540 by task kworker/u5:2/4307 CPU: 1 PID: 4307 Comm: kworker/u5:2 Not tainted 6.1.129-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024 Workqueue: hci0 hci_rx_work Call trace: dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:316 [inline] print_report+0x174/0x4c0 mm/kasan/report.c:427 kasan_report+0xd4/0x130 mm/kasan/report.c:531 __asan_report_load8_noabort+0x2c/0x38 mm/kasan/report_generic.c:351 l2cap_sock_new_connection_cb+0x1d4/0x284 net/bluetooth/l2cap_sock.c:1517 l2cap_connect_cfm+0x2f8/0xe10 net/bluetooth/l2cap_core.c:8319 hci_connect_cfm+0x120/0x1d0 include/net/bluetooth/hci_core.h:1809 le_conn_complete_evt+0xab8/0xff4 net/bluetooth/hci_event.c:5864 hci_le_conn_complete_evt+0x114/0x404 net/bluetooth/hci_event.c:5890 hci_le_meta_evt+0x2b8/0x47c net/bluetooth/hci_event.c:7059 hci_event_func net/bluetooth/hci_event.c:7370 [inline] hci_event_packet+0x6f8/0x109c net/bluetooth/hci_event.c:7425 hci_rx_work+0x310/0xa84 net/bluetooth/hci_core.c:4086 process_one_work+0x804/0x1484 kernel/workqueue.c:2292 worker_thread+0x8e4/0xfec kernel/workqueue.c:2439 kthread+0x250/0x2d8 kernel/kthread.c:376 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:864 Allocated by task 4307: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4c/0x80 mm/kasan/common.c:52 kasan_save_alloc_info+0x24/0x30 mm/kasan/generic.c:505 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:383 kasan_kmalloc include/linux/kasan.h:211 [inline] __do_kmalloc_node mm/slab_common.c:936 [inline] __kmalloc+0xd8/0x1c4 mm/slab_common.c:949 kmalloc include/linux/slab.h:568 [inline] sk_prot_alloc+0xc4/0x1f0 net/core/sock.c:2050 sk_alloc+0x44/0x3e0 net/core/sock.c:2103 bt_sock_alloc+0x4c/0x140 net/bluetooth/af_bluetooth.c:148 l2cap_sock_alloc net/bluetooth/l2cap_sock.c:1911 [inline] l2cap_sock_new_connection_cb+0xe4/0x284 net/bluetooth/l2cap_sock.c:1502 l2cap_connect_cfm+0x2f8/0xe10 net/bluetooth/l2cap_core.c:8319 hci_connect_cfm+0x120/0x1d0 include/net/bluetooth/hci_core.h:1809 le_conn_complete_evt+0xab8/0xff4 net/bluetooth/hci_event.c:5864 hci_le_conn_complete_evt+0x114/0x404 net/bluetooth/hci_event.c:5890 hci_le_meta_evt+0x2b8/0x47c net/bluetooth/hci_event.c:7059 hci_event_func net/bluetooth/hci_event.c:7370 [inline] hci_event_packet+0x6f8/0x109c net/bluetooth/hci_event.c:7425 hci_rx_work+0x310/0xa84 net/bluetooth/hci_core.c:4086 process_one_work+0x804/0x1484 kernel/workqueue.c:2292 worker_thread+0x8e4/0xfec kernel/workqueue.c:2439 kthread+0x250/0x2d8 kernel/kthread.c:376 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:864 Freed by task 9150: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4c/0x80 mm/kasan/common.c:52 kasan_save_free_info+0x38/0x5c mm/kasan/generic.c:516 ____kasan_slab_free+0x144/0x1c0 mm/kasan/common.c:236 __kasan_slab_free+0x18/0x28 mm/kasan/common.c:244 kasan_slab_free include/linux/kasan.h:177 [inline] slab_free_hook mm/slub.c:1724 [inline] slab_free_freelist_hook mm/slub.c:1750 [inline] slab_free mm/slub.c:3661 [inline] __kmem_cache_free+0x2c0/0x4b4 mm/slub.c:3674 kfree+0xcc/0x1b8 mm/slab_common.c:988 sk_prot_free net/core/sock.c:2086 [inline] __sk_destruct+0x4bc/0x760 net/core/sock.c:2172 sk_destruct net/core/sock.c:2187 [inline] __sk_free+0x388/0x4f4 net/core/sock.c:2198 sk_free+0x60/0xc8 net/core/sock.c:2209 sock_put include/net/sock.h:2036 [inline] l2cap_sock_kill+0x12c/0x234 net/bluetooth/l2cap_sock.c:1284 l2cap_sock_cleanup_listen+0xf8/0x290 net/bluetooth/l2cap_sock.c:1482 l2cap_sock_release+0x5c/0x1b4 net/bluetooth/l2cap_sock.c:1445 __sock_release net/socket.c:654 [inline] sock_close+0xb8/0x1fc net/socket.c:1400 __fput+0x1c8/0x7c8 fs/file_table.c:320 ____fput+0x20/0x30 fs/file_table.c:348 task_work_run+0x240/0x2f0 kernel/task_work.c:203 get_signal+0x1330/0x1528 kernel/signal.c:2648 do_signal arch/arm64/kernel/signal.c:1076 [inline] do_notify_resume+0x388/0x2cb8 arch/arm64/kernel/signal.c:1129 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:137 [inline] exit_to_user_mode arch/arm64/kernel/entry-common.c:142 [inline] el0_svc+0x9c/0x168 arch/arm64/kernel/entry-common.c:638 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585 Last potentially related work creation: kasan_save_stack+0x40/0x70 mm/kasan/common.c:45 __kasan_record_aux_stack+0xcc/0xe8 mm/kasan/generic.c:486 kasan_record_aux_stack_noalloc+0x14/0x20 mm/kasan/generic.c:496 call_rcu+0xfc/0xa40 kernel/rcu/tree.c:2845 netlink_release+0x13c0/0x1910 net/netlink/af_netlink.c:800 __sock_release net/socket.c:654 [inline] sock_close+0xb8/0x1fc net/socket.c:1400 __fput+0x1c8/0x7c8 fs/file_table.c:320 ____fput+0x20/0x30 fs/file_table.c:348 task_work_run+0x240/0x2f0 kernel/task_work.c:203 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] do_notify_resume+0x2080/0x2cb8 arch/arm64/kernel/signal.c:1132 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:137 [inline] exit_to_user_mode arch/arm64/kernel/entry-common.c:142 [inline] el0_svc+0x9c/0x168 arch/arm64/kernel/entry-common.c:638 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585 Second to last potentially related work creation: kasan_save_stack+0x40/0x70 mm/kasan/common.c:45 __kasan_record_aux_stack+0xcc/0xe8 mm/kasan/generic.c:486 kasan_record_aux_stack_noalloc+0x14/0x20 mm/kasan/generic.c:496 call_rcu+0xfc/0xa40 kernel/rcu/tree.c:2845 netlink_release+0x13c0/0x1910 net/netlink/af_netlink.c:800 __sock_release net/socket.c:654 [inline] sock_close+0xb8/0x1fc net/socket.c:1400 __fput+0x1c8/0x7c8 fs/file_table.c:320 ____fput+0x20/0x30 fs/file_table.c:348 task_work_run+0x240/0x2f0 kernel/task_work.c:203 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] do_notify_resume+0x2080/0x2cb8 arch/arm64/kernel/signal.c:1132 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:137 [inline] exit_to_user_mode arch/arm64/kernel/entry-common.c:142 [inline] el0_svc+0x9c/0x168 arch/arm64/kernel/entry-common.c:638 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585 The buggy address belongs to the object at ffff0000f5a0f000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 1344 bytes inside of 2048-byte region [ffff0000f5a0f000, ffff0000f5a0f800) The buggy address belongs to the physical page: page:00000000b898a23e refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x135a08 head:00000000b898a23e order:3 compound_mapcount:0 compound_pincount:0 flags: 0x5ffc00000010200(slab|head|node=0|zone=2|lastcpupid=0x7ff) raw: 05ffc00000010200 fffffc000344c400 dead000000000002 ffff0000c0002900 raw: 0000000000000000 0000000080080008 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff0000f5a0f400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff0000f5a0f480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff0000f5a0f500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff0000f5a0f580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff0000f5a0f600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ------------[ cut here ]------------ refcount_t: addition on 0; use-after-free. WARNING: CPU: 1 PID: 4307 at lib/refcount.c:25 refcount_warn_saturate+0x1a8/0x20c lib/refcount.c:25 Modules linked in: CPU: 1 PID: 4307 Comm: kworker/u5:2 Tainted: G B 6.1.129-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024 Workqueue: hci0 hci_rx_work pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : refcount_warn_saturate+0x1a8/0x20c lib/refcount.c:25 lr : refcount_warn_saturate+0x1a8/0x20c lib/refcount.c:25 sp : ffff800021277480 x29: ffff800021277480 x28: ffff0000f5a09000 x27: ffff0000dde314c8 x26: 1fffe0001eb41207 x25: 1fffe0001b3f4200 x24: dfff800000000000 x23: ffff0000d0342014 x22: 00000000ffffffff x21: 0000000000000002 x20: ffff0000f5a09018 x19: ffff8000184d8000 x18: 1fffe0003679cb76 x17: 0000000000000000 x16: ffff80001226f180 x15: 0000000000000002 x14: 00000000ffffffff x13: 0000000000000001 x12: 0000000000100000 x11: 0000000000055fd0 x10: ffff800033a2d000 x9 : 351f0992d98c2400 x8 : 351f0992d98c2400 x7 : 0000000000000001 x6 : 0000000000000001 x5 : ffff800021276d78 x4 : ffff800015bd5320 x3 : ffff80000834ac64 x2 : 0000000000000001 x1 : 0000000100000000 x0 : 0000000000000000 Call trace: refcount_warn_saturate+0x1a8/0x20c lib/refcount.c:25 __refcount_inc include/linux/refcount.h:250 [inline] refcount_inc include/linux/refcount.h:267 [inline] kref_get include/linux/kref.h:45 [inline] l2cap_chan_hold+0x98/0x124 net/bluetooth/l2cap_core.c:522 __l2cap_chan_add+0x278/0x6d4 net/bluetooth/l2cap_core.c:652 l2cap_connect_cfm+0x3ac/0xe10 net/bluetooth/l2cap_core.c:8326 hci_connect_cfm+0x120/0x1d0 include/net/bluetooth/hci_core.h:1809 le_conn_complete_evt+0xab8/0xff4 net/bluetooth/hci_event.c:5864 hci_le_conn_complete_evt+0x114/0x404 net/bluetooth/hci_event.c:5890 hci_le_meta_evt+0x2b8/0x47c net/bluetooth/hci_event.c:7059 hci_event_func net/bluetooth/hci_event.c:7370 [inline] hci_event_packet+0x6f8/0x109c net/bluetooth/hci_event.c:7425 hci_rx_work+0x310/0xa84 net/bluetooth/hci_core.c:4086 process_one_work+0x804/0x1484 kernel/workqueue.c:2292 worker_thread+0x8e4/0xfec kernel/workqueue.c:2439 kthread+0x250/0x2d8 kernel/kthread.c:376 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:864 irq event stamp: 8005 hardirqs last enabled at (8005): [] raw_spin_rq_unlock_irq kernel/sched/sched.h:1367 [inline] hardirqs last enabled at (8005): [] finish_lock_switch+0xbc/0x1e8 kernel/sched/core.c:5002 hardirqs last disabled at (8004): [] __schedule+0x2a4/0x1d44 kernel/sched/core.c:6458 softirqs last enabled at (7752): [] spin_unlock_bh include/linux/spinlock.h:396 [inline] softirqs last enabled at (7752): [] release_sock+0x178/0x1cc net/core/sock.c:3514 softirqs last disabled at (7748): [] spin_lock_bh include/linux/spinlock.h:356 [inline] softirqs last disabled at (7748): [] release_sock+0x3c/0x1cc net/core/sock.c:3501 ---[ end trace 0000000000000000 ]--- ------------[ cut here ]------------ ODEBUG: assert_init not available (active state 0) object type: timer_list hint: l2cap_chan_timeout+0x0/0x288 WARNING: CPU: 1 PID: 4307 at lib/debugobjects.c:518 debug_print_object+0x148/0x1d4 lib/debugobjects.c:515 Modules linked in: CPU: 1 PID: 4307 Comm: kworker/u5:2 Tainted: G B W 6.1.129-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024 Workqueue: hci0 hci_rx_work pstate: 604000c5 (nZCv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : debug_print_object+0x148/0x1d4 lib/debugobjects.c:515 lr : debug_print_object+0x148/0x1d4 lib/debugobjects.c:515 sp : ffff800021277050 x29: ffff800021277050 x28: dfff800000000000 x27: ffff70000424ee18 x26: ffff0000da111168 x25: ffff8000083f2774 x24: dfff800000000000 x23: 0000000000000000 x22: ffff80001158a7d4 x21: ffff800012977a00 x20: ffff80001249b020 x19: ffff800012977540 x18: 1fffe0003679cb76 x17: 203a657079742074 x16: ffff80001232163c x15: 0000000000000002 x14: 00000000ffffffff x13: 0000000000000001 x12: 0000000000100000 x11: 0000000000072e20 x10: ffff800033a2d000 x9 : 351f0992d98c2400 x8 : 351f0992d98c2400 x7 : 0000000000000001 x6 : 0000000000000001 x5 : ffff800021276938 x4 : ffff800015bd5320 x3 : ffff800008587574 x2 : 0000000000000001 x1 : 0000000100000000 x0 : 0000000000000000 Call trace: debug_print_object+0x148/0x1d4 lib/debugobjects.c:515 debug_object_assert_init+0x318/0x3c8 lib/debugobjects.c:900 debug_timer_assert_init kernel/time/timer.c:792 [inline] debug_assert_init kernel/time/timer.c:837 [inline] timer_delete+0xa8/0x2b4 kernel/time/timer.c:1277 del_timer include/linux/timer.h:211 [inline] try_to_grab_pending+0xa4/0x65c kernel/workqueue.c:1278 __cancel_work+0xb0/0x2b0 kernel/workqueue.c:3251 cancel_delayed_work+0x24/0x38 kernel/workqueue.c:3289 l2cap_clear_timer include/net/bluetooth/l2cap.h:892 [inline] l2cap_chan_ready net/bluetooth/l2cap_core.c:1397 [inline] l2cap_le_start+0x8e4/0x13a8 net/bluetooth/l2cap_core.c:1521 l2cap_conn_ready net/bluetooth/l2cap_core.c:1790 [inline] l2cap_connect_cfm+0x5ac/0xe10 net/bluetooth/l2cap_core.c:8336 hci_connect_cfm+0x120/0x1d0 include/net/bluetooth/hci_core.h:1809 le_conn_complete_evt+0xab8/0xff4 net/bluetooth/hci_event.c:5864 hci_le_conn_complete_evt+0x114/0x404 net/bluetooth/hci_event.c:5890 hci_le_meta_evt+0x2b8/0x47c net/bluetooth/hci_event.c:7059 hci_event_func net/bluetooth/hci_event.c:7370 [inline] hci_event_packet+0x6f8/0x109c net/bluetooth/hci_event.c:7425 hci_rx_work+0x310/0xa84 net/bluetooth/hci_core.c:4086 process_one_work+0x804/0x1484 kernel/workqueue.c:2292 worker_thread+0x8e4/0xfec kernel/workqueue.c:2439 kthread+0x250/0x2d8 kernel/kthread.c:376 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:864 irq event stamp: 8005 hardirqs last enabled at (8005): [] raw_spin_rq_unlock_irq kernel/sched/sched.h:1367 [inline] hardirqs last enabled at (8005): [] finish_lock_switch+0xbc/0x1e8 kernel/sched/core.c:5002 hardirqs last disabled at (8004): [] __schedule+0x2a4/0x1d44 kernel/sched/core.c:6458 softirqs last enabled at (7752): [] spin_unlock_bh include/linux/spinlock.h:396 [inline] softirqs last enabled at (7752): [] release_sock+0x178/0x1cc net/core/sock.c:3514 softirqs last disabled at (7748): [] spin_lock_bh include/linux/spinlock.h:356 [inline] softirqs last disabled at (7748): [] release_sock+0x3c/0x1cc net/core/sock.c:3501 ---[ end trace 0000000000000000 ]--- Unable to handle kernel paging request at virtual address dfff800000000013 KASAN: null-ptr-deref in range [0x0000000000000098-0x000000000000009f] Mem abort info: ESR = 0x0000000096000006 EC = 0x25: DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 FSC = 0x06: level 2 translation fault Data abort info: ISV = 0, ISS = 0x00000006 CM = 0, WnR = 0 [dfff800000000013] address between user and kernel address ranges Internal error: Oops: 0000000096000006 [#1] PREEMPT SMP Modules linked in: CPU: 1 PID: 4307 Comm: kworker/u5:2 Tainted: G B W 6.1.129-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024 Workqueue: hci0 hci_rx_work pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : debug_spin_lock_before kernel/locking/spinlock_debug.c:85 [inline] pc : do_raw_spin_lock+0x80/0x358 kernel/locking/spinlock_debug.c:114 lr : __raw_spin_lock_bh include/linux/spinlock_api_smp.h:127 [inline] lr : _raw_spin_lock_bh+0x5c/0x6c kernel/locking/spinlock.c:178 sp : ffff800021277240 x29: ffff8000212772d0 x28: ffff800021277260 x27: 1fffe0001eb41206 x26: 1fffe0001eb41200 x25: ffff70000424ee84 x24: dfff800000000000 x23: dfff800000000000 x22: 0000000000000130 x21: 0000000000000000 x20: 0000000000000098 x19: 000000000000009c x18: 1fffe0003679cb76 x17: 203a657079742074 x16: ffff80000831ac50 x15: 0000000000000002 x14: 00000000ffffffff x13: 0000000000000001 x12: 0000000000100000 x11: ffff80000831ac50 x10: 1ffff0000424ee4c x9 : 0000000000000013 x8 : f3f3f304f1f1f1f1 x7 : 0000000000000000 x6 : ffff800010594dd4 x5 : 0000000000000000 x4 : 0000000000000001 x3 : 0000000000000000 x2 : 0000000000000000 x1 : ffff800012976f20 x0 : 0000000000000098 Call trace: do_raw_spin_lock+0x80/0x358 kernel/locking/spinlock_debug.c:114 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:127 [inline] _raw_spin_lock_bh+0x5c/0x6c kernel/locking/spinlock.c:178 spin_lock_bh include/linux/spinlock.h:356 [inline] lock_sock_nested+0x90/0x138 net/core/sock.c:3491 lock_sock include/net/sock.h:1756 [inline] l2cap_sock_ready_cb+0x4c/0x130 net/bluetooth/l2cap_sock.c:1694 l2cap_chan_ready net/bluetooth/l2cap_core.c:1409 [inline] l2cap_le_start+0xa80/0x13a8 net/bluetooth/l2cap_core.c:1521 l2cap_conn_ready net/bluetooth/l2cap_core.c:1790 [inline] l2cap_connect_cfm+0x5ac/0xe10 net/bluetooth/l2cap_core.c:8336 hci_connect_cfm+0x120/0x1d0 include/net/bluetooth/hci_core.h:1809 le_conn_complete_evt+0xab8/0xff4 net/bluetooth/hci_event.c:5864 hci_le_conn_complete_evt+0x114/0x404 net/bluetooth/hci_event.c:5890 hci_le_meta_evt+0x2b8/0x47c net/bluetooth/hci_event.c:7059 hci_event_func net/bluetooth/hci_event.c:7370 [inline] hci_event_packet+0x6f8/0x109c net/bluetooth/hci_event.c:7425 hci_rx_work+0x310/0xa84 net/bluetooth/hci_core.c:4086 process_one_work+0x804/0x1484 kernel/workqueue.c:2292 worker_thread+0x8e4/0xfec kernel/workqueue.c:2439 kthread+0x250/0x2d8 kernel/kthread.c:376 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:864 Code: d343fe69 f9001beb f8376948 aa0003f4 (38f76928) ---[ end trace 0000000000000000 ]--- ---------------- Code disassembly (best guess): 0: d343fe69 lsr x9, x19, #3 4: f9001beb str x11, [sp, #48] 8: f8376948 str x8, [x10, x23] c: aa0003f4 mov x20, x0 * 10: 38f76928 ldrsb w8, [x9, x23] <-- trapping instruction