kobject_add_internal failed for hci4:201 with -EEXIST, don't try to register things with the same name in the same directory. Bluetooth: hci4: failed to register connection device ================================================================== BUG: KASAN: use-after-free in l2cap_conn_ready net/bluetooth/l2cap_core.c:-1 [inline] BUG: KASAN: use-after-free in l2cap_connect_cfm+0x5c4/0xe5c net/bluetooth/l2cap_core.c:8294 Read of size 8 at addr ffff0000c125a488 by task kworker/u5:2/4028 CPU: 1 PID: 4028 Comm: kworker/u5:2 Not tainted 5.15.180-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025 Workqueue: hci4 hci_rx_work Call trace: dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106 print_address_description+0x7c/0x3f0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:434 [inline] kasan_report+0x174/0x1e4 mm/kasan/report.c:451 __asan_report_load8_noabort+0x44/0x50 mm/kasan/report_generic.c:309 l2cap_conn_ready net/bluetooth/l2cap_core.c:-1 [inline] l2cap_connect_cfm+0x5c4/0xe5c net/bluetooth/l2cap_core.c:8294 hci_connect_cfm include/net/bluetooth/hci_core.h:1505 [inline] le_conn_complete_evt+0xa30/0x1228 net/bluetooth/hci_event.c:5429 hci_le_conn_complete_evt net/bluetooth/hci_event.c:5454 [inline] hci_le_meta_evt+0x234/0x31c0 net/bluetooth/hci_event.c:6175 hci_event_packet+0xd34/0x12b4 net/bluetooth/hci_event.c:6524 hci_rx_work+0x1d0/0x830 net/bluetooth/hci_core.c:5160 process_one_work+0x790/0x11b8 kernel/workqueue.c:2310 worker_thread+0x910/0x1034 kernel/workqueue.c:2457 kthread+0x37c/0x45c kernel/kthread.c:334 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:870 Allocated by task 4028: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:434 [inline] ____kasan_kmalloc+0xbc/0xfc mm/kasan/common.c:513 __kasan_kmalloc+0x10/0x1c mm/kasan/common.c:522 kasan_kmalloc include/linux/kasan.h:264 [inline] kmem_cache_alloc_trace+0x27c/0x47c mm/slub.c:3247 kmalloc include/linux/slab.h:604 [inline] kzalloc include/linux/slab.h:735 [inline] l2cap_chan_create+0x58/0x694 net/bluetooth/l2cap_core.c:469 l2cap_sock_alloc net/bluetooth/l2cap_sock.c:1876 [inline] l2cap_sock_new_connection_cb+0x1b4/0x304 net/bluetooth/l2cap_sock.c:1476 l2cap_connect_cfm+0x2fc/0xe5c net/bluetooth/l2cap_core.c:8277 hci_connect_cfm include/net/bluetooth/hci_core.h:1505 [inline] le_conn_complete_evt+0xa30/0x1228 net/bluetooth/hci_event.c:5429 hci_le_conn_complete_evt net/bluetooth/hci_event.c:5454 [inline] hci_le_meta_evt+0x234/0x31c0 net/bluetooth/hci_event.c:6175 hci_event_packet+0xd34/0x12b4 net/bluetooth/hci_event.c:6524 hci_rx_work+0x1d0/0x830 net/bluetooth/hci_core.c:5160 process_one_work+0x790/0x11b8 kernel/workqueue.c:2310 worker_thread+0x910/0x1034 kernel/workqueue.c:2457 kthread+0x37c/0x45c kernel/kthread.c:334 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:870 Freed by task 4634: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4c/0x84 mm/kasan/common.c:46 kasan_set_free_info+0x28/0x4c mm/kasan/generic.c:360 ____kasan_slab_free+0x118/0x164 mm/kasan/common.c:366 __kasan_slab_free+0x18/0x28 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:1705 [inline] slab_free_freelist_hook+0x128/0x1ec mm/slub.c:1731 slab_free mm/slub.c:3499 [inline] kfree+0x178/0x410 mm/slub.c:4559 l2cap_chan_destroy net/bluetooth/l2cap_core.c:512 [inline] kref_put include/linux/kref.h:65 [inline] l2cap_chan_put+0x17c/0x268 net/bluetooth/l2cap_core.c:536 l2cap_sock_cleanup_listen+0x108/0x290 net/bluetooth/l2cap_sock.c:1459 l2cap_sock_teardown_cb+0x108/0x37c net/bluetooth/l2cap_sock.c:1576 l2cap_chan_close+0x198/0x828 net/bluetooth/l2cap_core.c:-1 l2cap_sock_shutdown+0x338/0x7d4 net/bluetooth/l2cap_sock.c:1378 l2cap_sock_release+0x78/0x1b4 net/bluetooth/l2cap_sock.c:1422 __sock_release net/socket.c:649 [inline] sock_close+0xb8/0x1fc net/socket.c:1336 __fput+0x1c4/0x800 fs/file_table.c:311 ____fput+0x20/0x30 fs/file_table.c:339 task_work_run+0x130/0x1e4 kernel/task_work.c:188 tracehook_notify_resume include/linux/tracehook.h:189 [inline] do_notify_resume+0x262c/0x32b8 arch/arm64/kernel/signal.c:946 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:133 [inline] exit_to_user_mode arch/arm64/kernel/entry-common.c:138 [inline] el0_svc+0xfc/0x1f0 arch/arm64/kernel/entry-common.c:609 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 Last potentially related work creation: kasan_save_stack+0x38/0x68 mm/kasan/common.c:38 kasan_record_aux_stack+0xd4/0x11c mm/kasan/generic.c:348 __call_rcu kernel/rcu/tree.c:3007 [inline] call_rcu+0x118/0xb40 kernel/rcu/tree.c:3087 netlink_release+0x13c4/0x19e0 net/netlink/af_netlink.c:800 __sock_release net/socket.c:649 [inline] sock_close+0xb8/0x1fc net/socket.c:1336 __fput+0x1c4/0x800 fs/file_table.c:311 ____fput+0x20/0x30 fs/file_table.c:339 task_work_run+0x130/0x1e4 kernel/task_work.c:188 tracehook_notify_resume include/linux/tracehook.h:189 [inline] do_notify_resume+0x262c/0x32b8 arch/arm64/kernel/signal.c:946 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:133 [inline] exit_to_user_mode arch/arm64/kernel/entry-common.c:138 [inline] el0_svc+0xfc/0x1f0 arch/arm64/kernel/entry-common.c:609 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 The buggy address belongs to the object at ffff0000c125a000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 1160 bytes inside of 2048-byte region [ffff0000c125a000, ffff0000c125a800) The buggy address belongs to the page: page:00000000bfe72b99 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101258 head:00000000bfe72b99 order:3 compound_mapcount:0 compound_pincount:0 flags: 0x5ffc00000010200(slab|head|node=0|zone=2|lastcpupid=0x7ff) raw: 05ffc00000010200 0000000000000000 0000000100000001 ffff0000c0002900 raw: 0000000000000000 0000000080080008 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff0000c125a380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff0000c125a400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff0000c125a480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff0000c125a500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff0000c125a580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== Unable to handle kernel paging request at virtual address fbd51fffffffff92 Mem abort info: ESR = 0x0000000096000004 EC = 0x25: DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 FSC = 0x04: level 0 translation fault Data abort info: ISV = 0, ISS = 0x00000004 CM = 0, WnR = 0 [fbd51fffffffff92] address between user and kernel address ranges Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP Modules linked in: CPU: 1 PID: 4028 Comm: kworker/u5:2 Tainted: G B 5.15.180-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025 Workqueue: hci4 hci_rx_work pstate: 20400005 (nzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : atomic_read include/linux/atomic/atomic-instrumented.h:28 [inline] pc : l2cap_chan_lock include/net/bluetooth/l2cap.h:855 [inline] pc : l2cap_conn_ready net/bluetooth/l2cap_core.c:1759 [inline] pc : l2cap_connect_cfm+0x530/0xe5c net/bluetooth/l2cap_core.c:8294 lr : instrument_atomic_read include/linux/instrumented.h:71 [inline] lr : atomic_read include/linux/atomic/atomic-instrumented.h:27 [inline] lr : l2cap_chan_lock include/net/bluetooth/l2cap.h:855 [inline] lr : l2cap_conn_ready net/bluetooth/l2cap_core.c:1759 [inline] lr : l2cap_connect_cfm+0x52c/0xe5c net/bluetooth/l2cap_core.c:8294 sp : ffff80001fb574c0 x29: ffff80001fb57560 x28: ffff0000c125a000 x27: ffff0000d749f4b8 x26: dfff800000000000 x25: ffff0000c125a4b8 x24: ffff0000e4cc881a x23: dead000000000100 x22: ffff0000e4cc8a60 x21: 1fffe0001dd31806 x20: ffff0000ee98c037 x19: deacfffffffffc94 x18: 1fffe0003683258e x17: 1fffe0003683258e x16: ffff8000088d9340 x15: ffff800014c1f2a0 x14: ffff0001b4192c80 x13: ffff0001b4192c7c x12: ffff700002e3cd64 x11: 0000000000000000 x10: 0000000000000000 x9 : ffff80001b859390 x8 : 1bd59fffffffff92 x7 : 0000000000000000 x6 : ffff80000826b1e8 x5 : 0000000000000000 x4 : 0000000000000000 x3 : ffff800010ef315c x2 : 0000000000000000 x1 : 0000000000000004 x0 : 0000000000000001 Call trace: atomic_read include/linux/atomic/atomic-instrumented.h:28 [inline] l2cap_chan_lock include/net/bluetooth/l2cap.h:855 [inline] l2cap_conn_ready net/bluetooth/l2cap_core.c:1759 [inline] l2cap_connect_cfm+0x530/0xe5c net/bluetooth/l2cap_core.c:8294 hci_connect_cfm include/net/bluetooth/hci_core.h:1505 [inline] le_conn_complete_evt+0xa30/0x1228 net/bluetooth/hci_event.c:5429 hci_le_conn_complete_evt net/bluetooth/hci_event.c:5454 [inline] hci_le_meta_evt+0x234/0x31c0 net/bluetooth/hci_event.c:6175 hci_event_packet+0xd34/0x12b4 net/bluetooth/hci_event.c:6524 hci_rx_work+0x1d0/0x830 net/bluetooth/hci_core.c:5160 process_one_work+0x790/0x11b8 kernel/workqueue.c:2310 worker_thread+0x910/0x1034 kernel/workqueue.c:2457 kthread+0x37c/0x45c kernel/kthread.c:334 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:870 Code: 52800081 aa1303e0 97c0c5fe d343fe68 (38fa6908) ---[ end trace f06eaaa405f80d4f ]--- ---------------- Code disassembly (best guess): 0: 52800081 mov w1, #0x4 // #4 4: aa1303e0 mov x0, x19 8: 97c0c5fe bl 0xffffffffff031800 c: d343fe68 lsr x8, x19, #3 * 10: 38fa6908 ldrsb w8, [x8, x26] <-- trapping instruction