kobject_add_internal failed for hci5:201 with -EEXIST, don't try to register things with the same name in the same directory. Bluetooth: hci5: failed to register connection device ================================================================== BUG: KASAN: use-after-free in __l2cap_chan_add+0x64b/0x930 net/bluetooth/l2cap_core.c:621 Write of size 1 at addr ffff88801ed000ee by task kworker/u5:0/146 CPU: 1 PID: 146 Comm: kworker/u5:0 Not tainted syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/02/2025 Workqueue: hci5 hci_rx_work Call Trace: dump_stack_lvl+0x168/0x230 lib/dump_stack.c:106 print_address_description+0x60/0x2d0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:434 [inline] kasan_report+0xdf/0x130 mm/kasan/report.c:451 __l2cap_chan_add+0x64b/0x930 net/bluetooth/l2cap_core.c:621 l2cap_connect_cfm+0x455/0x10d0 net/bluetooth/l2cap_core.c:8310 hci_connect_cfm include/net/bluetooth/hci_core.h:1505 [inline] le_conn_complete_evt+0xdaf/0x1590 net/bluetooth/hci_event.c:5439 hci_le_conn_complete_evt net/bluetooth/hci_event.c:5464 [inline] hci_le_meta_evt+0x289/0x3b80 net/bluetooth/hci_event.c:6186 hci_event_packet+0xe05/0x12f0 net/bluetooth/hci_event.c:6535 hci_rx_work+0x255/0xa10 net/bluetooth/hci_core.c:5160 process_one_work+0x863/0x1000 kernel/workqueue.c:2310 worker_thread+0xaa8/0x12a0 kernel/workqueue.c:2457 kthread+0x436/0x520 kernel/kthread.c:334 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 Allocated by task 146: 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 mm/kasan/common.c:513 [inline] __kasan_kmalloc+0xb5/0xf0 mm/kasan/common.c:522 kmalloc include/linux/slab.h:607 [inline] kzalloc include/linux/slab.h:738 [inline] l2cap_chan_create+0x4c/0x730 net/bluetooth/l2cap_core.c:469 l2cap_sock_alloc+0x13a/0x200 net/bluetooth/l2cap_sock.c:1882 l2cap_sock_new_connection_cb+0xd1/0x1c0 net/bluetooth/l2cap_sock.c:1479 l2cap_connect_cfm+0x35d/0x10d0 net/bluetooth/l2cap_core.c:8303 hci_connect_cfm include/net/bluetooth/hci_core.h:1505 [inline] le_conn_complete_evt+0xdaf/0x1590 net/bluetooth/hci_event.c:5439 hci_le_conn_complete_evt net/bluetooth/hci_event.c:5464 [inline] hci_le_meta_evt+0x289/0x3b80 net/bluetooth/hci_event.c:6186 hci_event_packet+0xe05/0x12f0 net/bluetooth/hci_event.c:6535 hci_rx_work+0x255/0xa10 net/bluetooth/hci_core.c:5160 process_one_work+0x863/0x1000 kernel/workqueue.c:2310 worker_thread+0xaa8/0x12a0 kernel/workqueue.c:2457 kthread+0x436/0x520 kernel/kthread.c:334 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 Freed by task 2569: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:46 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360 ____kasan_slab_free+0xd5/0x110 mm/kasan/common.c:366 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:1710 [inline] slab_free_freelist_hook+0xea/0x170 mm/slub.c:1736 slab_free mm/slub.c:3504 [inline] kfree+0xef/0x2a0 mm/slub.c:4564 l2cap_sock_cleanup_listen+0xea/0x270 net/bluetooth/l2cap_sock.c:1462 l2cap_sock_release+0x66/0x1e0 net/bluetooth/l2cap_sock.c:1420 __sock_release net/socket.c:651 [inline] sock_close+0xd5/0x240 net/socket.c:1346 __fput+0x234/0x930 fs/file_table.c:311 task_work_run+0x125/0x1a0 kernel/task_work.c:188 exit_task_work include/linux/task_work.h:33 [inline] do_exit+0x61e/0x20a0 kernel/exit.c:883 do_group_exit+0x12e/0x300 kernel/exit.c:997 get_signal+0x6ca/0x12c0 kernel/signal.c:2900 arch_do_signal_or_restart+0xc1/0x1300 arch/x86/kernel/signal.c:867 handle_signal_work kernel/entry/common.c:154 [inline] exit_to_user_mode_loop+0x9e/0x130 kernel/entry/common.c:178 exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:214 __syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline] syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:307 do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x66/0xd0 The buggy address belongs to the object at ffff88801ed00000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 238 bytes inside of 2048-byte region [ffff88801ed00000, ffff88801ed00800) The buggy address belongs to the page: page:ffffea00007b4000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1ed00 head:ffffea00007b4000 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 0000000000000000 0000000400000001 ffff888016842000 raw: 0000000000000000 0000000000080008 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 5042, ts 99953666786, free_ts 99462424264 prep_new_page mm/page_alloc.c:2426 [inline] get_page_from_freelist+0x1b77/0x1c60 mm/page_alloc.c:4192 __alloc_pages+0x1e1/0x470 mm/page_alloc.c:5487 alloc_slab_page mm/slub.c:1780 [inline] allocate_slab mm/slub.c:1917 [inline] new_slab+0xc0/0x4b0 mm/slub.c:1980 ___slab_alloc+0x81e/0xdf0 mm/slub.c:3013 __slab_alloc mm/slub.c:3100 [inline] slab_alloc_node mm/slub.c:3191 [inline] slab_alloc mm/slub.c:3233 [inline] __kmalloc_track_caller+0x1cb/0x330 mm/slub.c:4930 kmemdup+0x22/0x50 mm/util.c:128 neigh_sysctl_register+0x9b/0xa80 net/core/neighbour.c:3652 addrconf_sysctl_register+0xac/0x1b0 net/ipv6/addrconf.c:7144 ipv6_add_dev+0xbf3/0x1190 net/ipv6/addrconf.c:454 addrconf_notify+0x66f/0xf00 net/ipv6/addrconf.c:3576 notifier_call_chain kernel/notifier.c:83 [inline] raw_notifier_call_chain+0xcb/0x160 kernel/notifier.c:391 call_netdevice_notifiers_extack net/core/dev.c:2061 [inline] call_netdevice_notifiers net/core/dev.c:2075 [inline] register_netdevice+0x1275/0x16b0 net/core/dev.c:10428 virt_wifi_newlink+0x3e9/0x820 drivers/net/wireless/virt_wifi.c:567 __rtnl_newlink net/core/rtnetlink.c:3526 [inline] rtnl_newlink+0x114c/0x17d0 net/core/rtnetlink.c:3574 rtnetlink_rcv_msg+0x7ff/0xe90 net/core/rtnetlink.c:5684 netlink_rcv_skb+0x1e0/0x430 net/netlink/af_netlink.c:2507 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1340 [inline] free_pcp_prepare mm/page_alloc.c:1391 [inline] free_unref_page_prepare+0x637/0x6c0 mm/page_alloc.c:3317 free_unref_page+0x94/0x280 mm/page_alloc.c:3396 free_slab mm/slub.c:2020 [inline] discard_slab mm/slub.c:2026 [inline] __unfreeze_partials+0x1a5/0x200 mm/slub.c:2512 put_cpu_partial+0x12d/0x190 mm/slub.c:2592 qlist_free_all+0x35/0x90 mm/kasan/quarantine.c:176 kasan_quarantine_reduce+0x150/0x160 mm/kasan/quarantine.c:283 __kasan_slab_alloc+0x2f/0xd0 mm/kasan/common.c:444 kasan_slab_alloc include/linux/kasan.h:254 [inline] slab_post_alloc_hook+0x4c/0x380 mm/slab.h:519 slab_alloc_node mm/slub.c:3225 [inline] slab_alloc mm/slub.c:3233 [inline] kmem_cache_alloc+0x100/0x290 mm/slub.c:3238 sock_alloc_inode+0x17/0xb0 net/socket.c:305 alloc_inode fs/inode.c:261 [inline] new_inode_pseudo+0x5f/0x210 fs/inode.c:1001 sock_alloc net/socket.c:628 [inline] __sock_create+0x129/0x900 net/socket.c:1460 sock_create net/socket.c:1552 [inline] __sys_socket+0xe2/0x170 net/socket.c:1594 __do_sys_socket net/socket.c:1603 [inline] __se_sys_socket net/socket.c:1601 [inline] __x64_sys_socket+0x76/0x80 net/socket.c:1601 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 Memory state around the buggy address: ffff88801ecfff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88801ed00000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88801ed00080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88801ed00100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88801ed00180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================