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_connect_cfm+0x5c8/0xe10 net/bluetooth/l2cap_core.c:8336 Read of size 8 at addr ffff0000c45f3498 by task kworker/u5:3/4301 CPU: 1 PID: 4301 Comm: kworker/u5:3 Not tainted 6.1.127-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/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_connect_cfm+0x5c8/0xe10 net/bluetooth/l2cap_core.c:8336 hci_connect_cfm+0x120/0x1d0 include/net/bluetooth/hci_core.h:1809 le_conn_complete_evt+0xa88/0xfe0 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+0x7ac/0x1404 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 4301: 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] kmalloc_trace+0x7c/0x94 mm/slab_common.c:1031 kmalloc include/linux/slab.h:563 [inline] kzalloc include/linux/slab.h:699 [inline] l2cap_chan_create+0x58/0x6a0 net/bluetooth/l2cap_core.c:469 l2cap_sock_alloc net/bluetooth/l2cap_sock.c:1920 [inline] l2cap_sock_new_connection_cb+0x160/0x298 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+0xa88/0xfe0 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+0x7ac/0x1404 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 6507: 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 l2cap_chan_destroy net/bluetooth/l2cap_core.c:515 [inline] kref_put include/linux/kref.h:65 [inline] l2cap_chan_put+0x174/0x254 net/bluetooth/l2cap_core.c:539 l2cap_sock_cleanup_listen+0x108/0x290 net/bluetooth/l2cap_sock.c:1485 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 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 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+0x1274/0x179c 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 ffff0000c45f3000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 1176 bytes inside of 2048-byte region [ffff0000c45f3000, ffff0000c45f3800) The buggy address belongs to the physical page: page:00000000b5c4249d refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1045f0 head:00000000b5c4249d order:3 compound_mapcount:0 compound_pincount:0 flags: 0x5ffc00000010200(slab|head|node=0|zone=2|lastcpupid=0x7ff) raw: 05ffc00000010200 fffffc0003dd6800 dead000000000002 ffff0000c0002900 raw: 0000000000000000 0000000080080008 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff0000c45f3380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff0000c45f3400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff0000c45f3480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff0000c45f3500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff0000c45f3580: 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 fbd51fffffffff90 KASAN: maybe wild-memory-access in range [0xdeacfffffffffc80-0xdeacfffffffffc87] 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 [fbd51fffffffff90] address between user and kernel address ranges Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP Modules linked in: CPU: 1 PID: 4301 Comm: kworker/u5:3 Tainted: G B 6.1.127-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Workqueue: hci0 hci_rx_work pstate: 80400005 (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:863 [inline] pc : l2cap_conn_ready net/bluetooth/l2cap_core.c:1782 [inline] pc : l2cap_connect_cfm+0x534/0xe10 net/bluetooth/l2cap_core.c:8336 lr : instrument_atomic_read include/linux/instrumented.h:72 [inline] lr : atomic_read include/linux/atomic/atomic-instrumented.h:27 [inline] lr : l2cap_chan_lock include/net/bluetooth/l2cap.h:863 [inline] lr : l2cap_conn_ready net/bluetooth/l2cap_core.c:1782 [inline] lr : l2cap_connect_cfm+0x530/0xe10 net/bluetooth/l2cap_core.c:8336 sp : ffff800021157540 x29: ffff8000211575e0 x28: ffff0000c45f3000 x27: ffff0000cfdc64c8 x26: dfff800000000000 x25: ffff0000c45f34c8 x24: ffff0000f243281a x23: dead000000000100 x22: ffff0000f2432a60 x21: 1fffe0001c3d3c07 x20: ffff0000e1e9e039 x19: deacfffffffffc84 x18: 1fffe000367a0176 x17: ffff800015a8d000 x16: ffff8000089758ac x15: ffff0001b3d00bbc x14: ffff0001b3d00bb8 x13: 1fffe000367a0176 x12: 0000000000100000 x11: 00000000000a0aa2 x10: ffff800033a1d000 x9 : ffff80001ccaa9d0 x8 : 1bd59fffffffff90 x7 : 1fffe000367a0177 x6 : ffff800008277b18 x5 : 0000000000000000 x4 : 0000000000000001 x3 : ffff8000115c9d80 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:863 [inline] l2cap_conn_ready net/bluetooth/l2cap_core.c:1782 [inline] l2cap_connect_cfm+0x534/0xe10 net/bluetooth/l2cap_core.c:8336 hci_connect_cfm+0x120/0x1d0 include/net/bluetooth/hci_core.h:1809 le_conn_complete_evt+0xa88/0xfe0 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+0x7ac/0x1404 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: 52800081 aa1303e0 97a56213 d343fe68 (38fa6908) ---[ end trace 0000000000000000 ]--- ---------------- Code disassembly (best guess): 0: 52800081 mov w1, #0x4 // #4 4: aa1303e0 mov x0, x19 8: 97a56213 bl 0xfffffffffe958854 c: d343fe68 lsr x8, x19, #3 * 10: 38fa6908 ldrsb w8, [x8, x26] <-- trapping instruction