Bluetooth: hci0: Opcode 0x1003 failed: -110 ================================================================== BUG: KASAN: use-after-free in hlist_add_head include/linux/list.h:930 [inline] BUG: KASAN: use-after-free in enqueue_timer+0xa6/0x480 kernel/time/timer.c:605 Write of size 8 at addr ffff88810cd548e0 by task kworker/u5:0/45 CPU: 1 PID: 45 Comm: kworker/u5:0 Not tainted 6.1.115-syzkaller-00090-g0d968ced7330 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Workqueue: hci0 hci_power_on Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:284 [inline] print_report+0x158/0x4e0 mm/kasan/report.c:395 kasan_report+0x13c/0x170 mm/kasan/report.c:495 __asan_report_store8_noabort+0x17/0x20 mm/kasan/report_generic.c:356 hlist_add_head include/linux/list.h:930 [inline] enqueue_timer+0xa6/0x480 kernel/time/timer.c:605 internal_add_timer kernel/time/timer.c:634 [inline] __mod_timer+0x8d3/0xcf0 kernel/time/timer.c:1115 schedule_timeout+0x18f/0x390 kernel/time/timer.c:1964 __hci_cmd_sync_sk+0x2ad/0xfa0 net/bluetooth/hci_sync.c:170 __hci_cmd_sync_status_sk net/bluetooth/hci_sync.c:257 [inline] __hci_cmd_sync_status net/bluetooth/hci_sync.c:281 [inline] hci_read_local_features_sync net/bluetooth/hci_sync.c:3456 [inline] hci_init_stage_sync net/bluetooth/hci_sync.c:3367 [inline] hci_init1_sync net/bluetooth/hci_sync.c:3551 [inline] hci_init_sync net/bluetooth/hci_sync.c:4633 [inline] hci_dev_init_sync net/bluetooth/hci_sync.c:4824 [inline] hci_dev_open_sync+0x1351/0x3260 net/bluetooth/hci_sync.c:4904 hci_dev_do_open net/bluetooth/hci_core.c:439 [inline] hci_power_on+0x1a7/0x5e0 net/bluetooth/hci_core.c:945 process_one_work+0x73d/0xcb0 kernel/workqueue.c:2292 worker_thread+0xa5d/0x1260 kernel/workqueue.c:2439 kthread+0x26d/0x300 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Allocated by task 567: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:52 kasan_save_alloc_info+0x1f/0x30 mm/kasan/generic.c:505 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0x9c/0xb0 mm/kasan/common.c:383 kasan_kmalloc include/linux/kasan.h:211 [inline] __do_kmalloc_node mm/slab_common.c:936 [inline] __kmalloc+0xb4/0x1e0 mm/slab_common.c:949 kmalloc include/linux/slab.h:562 [inline] kzalloc include/linux/slab.h:693 [inline] hci_alloc_dev_priv+0x27/0x1c00 net/bluetooth/hci_core.c:2436 hci_alloc_dev include/net/bluetooth/hci_core.h:1470 [inline] hci_uart_register_dev drivers/bluetooth/hci_ldisc.c:636 [inline] hci_uart_set_proto drivers/bluetooth/hci_ldisc.c:712 [inline] hci_uart_tty_ioctl+0x3fb/0xa70 drivers/bluetooth/hci_ldisc.c:765 tty_ioctl+0x903/0xc50 drivers/tty/tty_io.c:2785 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl+0x114/0x190 fs/ioctl.c:856 __x64_sys_ioctl+0x7b/0x90 fs/ioctl.c:856 x64_sys_call+0x98/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:17 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 Freed by task 567: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:52 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:516 ____kasan_slab_free+0x131/0x180 mm/kasan/common.c:236 __kasan_slab_free+0x11/0x20 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+0x218/0x3b0 mm/slub.c:3674 kfree+0x7a/0xf0 mm/slab_common.c:988 hci_release_dev+0x1508/0x1670 net/bluetooth/hci_core.c:2767 bt_host_release+0x83/0xa0 net/bluetooth/hci_sysfs.c:92 device_release+0x95/0x1c0 kobject_cleanup lib/kobject.c:681 [inline] kobject_release lib/kobject.c:712 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x178/0x260 lib/kobject.c:729 put_device+0x1f/0x30 drivers/base/core.c:3797 hci_dev_put include/net/bluetooth/hci_core.h:1430 [inline] hci_dev_cmd+0x2be/0x9b0 net/bluetooth/hci_core.c:795 hci_sock_ioctl+0x415/0x7f0 net/bluetooth/hci_sock.c:1096 sock_do_ioctl+0x152/0x450 net/socket.c:1204 sock_ioctl+0x3d4/0x700 net/socket.c:1321 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl+0x114/0x190 fs/ioctl.c:856 __x64_sys_ioctl+0x7b/0x90 fs/ioctl.c:856 x64_sys_call+0x98/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:17 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 Last potentially related work creation: kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb4/0xc0 mm/kasan/generic.c:486 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:496 insert_work+0x56/0x310 kernel/workqueue.c:1361 __queue_work+0x9b6/0xd70 kernel/workqueue.c:1520 queue_work_on+0x105/0x170 kernel/workqueue.c:1548 queue_work include/linux/workqueue.h:512 [inline] hci_cmd_sync_run net/bluetooth/hci_sync.c:144 [inline] __hci_cmd_sync_sk+0xc58/0xfa0 net/bluetooth/hci_sync.c:166 __hci_cmd_sync_status_sk net/bluetooth/hci_sync.c:257 [inline] __hci_cmd_sync_status net/bluetooth/hci_sync.c:281 [inline] hci_cmd_sync_status+0x52/0x150 net/bluetooth/hci_sync.c:292 hci_dev_cmd+0x771/0x9b0 hci_sock_ioctl+0x415/0x7f0 net/bluetooth/hci_sock.c:1096 sock_do_ioctl+0x152/0x450 net/socket.c:1204 sock_ioctl+0x3d4/0x700 net/socket.c:1321 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl+0x114/0x190 fs/ioctl.c:856 __x64_sys_ioctl+0x7b/0x90 fs/ioctl.c:856 x64_sys_call+0x98/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:17 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 Second to last potentially related work creation: kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb4/0xc0 mm/kasan/generic.c:486 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:496 insert_work+0x56/0x310 kernel/workqueue.c:1361 __queue_work+0x9b6/0xd70 kernel/workqueue.c:1520 queue_work_on+0x105/0x170 kernel/workqueue.c:1548 queue_work include/linux/workqueue.h:512 [inline] hci_cmd_timeout+0x1a4/0x1f0 net/bluetooth/hci_core.c:1469 process_one_work+0x73d/0xcb0 kernel/workqueue.c:2292 worker_thread+0xa5d/0x1260 kernel/workqueue.c:2439 kthread+0x26d/0x300 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 The buggy address belongs to the object at ffff88810cd54000 which belongs to the cache kmalloc-8k of size 8192 The buggy address is located 2272 bytes inside of 8192-byte region [ffff88810cd54000, ffff88810cd56000) The buggy address belongs to the physical page: page:ffffea0004335400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10cd50 head:ffffea0004335400 order:3 compound_mapcount:0 compound_pincount:0 flags: 0x4000000000010200(slab|head|zone=1) raw: 4000000000010200 0000000000000000 dead000000000122 ffff888100042280 raw: 0000000000000000 0000000000020002 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 0x152a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL), pid 169, tgid 169 (syslogd), ts 54054950741, free_ts 53515487478 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x1e2/0x1f0 mm/page_alloc.c:2517 prep_new_page mm/page_alloc.c:2524 [inline] get_page_from_freelist+0x2e1c/0x2ef0 mm/page_alloc.c:4290 __alloc_pages+0x3c2/0x7d0 mm/page_alloc.c:5558 allocate_slab mm/slub.c:1939 [inline] new_slab+0xce/0x4c0 mm/slub.c:1992 ___slab_alloc+0x6f9/0xb80 mm/slub.c:3180 __slab_alloc+0x5d/0xa0 mm/slub.c:3279 slab_alloc_node mm/slub.c:3364 [inline] __kmem_cache_alloc_node+0x1af/0x250 mm/slub.c:3437 kmalloc_trace+0x2a/0xa0 mm/slab_common.c:1026 kmalloc include/linux/slab.h:557 [inline] audit_log_d_path+0xb9/0x170 kernel/audit.c:2151 dump_common_audit_data security/lsm_audit.c:223 [inline] common_lsm_audit+0x1c4/0x1940 security/lsm_audit.c:457 slow_avc_audit+0x26c/0x3c0 security/selinux/avc.c:796 avc_audit security/selinux/include/avc.h:136 [inline] avc_has_perm+0x1f5/0x260 security/selinux/avc.c:1193 inode_has_perm security/selinux/hooks.c:1632 [inline] path_has_perm security/selinux/hooks.c:1665 [inline] selinux_inode_getattr+0x2c7/0x3e0 security/selinux/hooks.c:3160 security_inode_getattr+0xd6/0x130 security/security.c:1361 vfs_getattr+0x2a/0x310 fs/stat.c:158 vfs_statx+0x194/0x4b0 fs/stat.c:233 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1444 [inline] free_pcp_prepare mm/page_alloc.c:1517 [inline] free_unref_page_prepare+0x83d/0x850 mm/page_alloc.c:3369 free_unref_page+0x36/0x3c0 mm/page_alloc.c:3464 free_the_page mm/page_alloc.c:754 [inline] __free_pages+0x61/0xf0 mm/page_alloc.c:5647 __free_slab+0xce/0x1a0 mm/slub.c:2016 free_slab mm/slub.c:2031 [inline] discard_slab mm/slub.c:2037 [inline] __unfreeze_partials+0x165/0x1a0 mm/slub.c:2586 put_cpu_partial+0xa9/0x100 mm/slub.c:2662 __slab_free+0x1c8/0x280 mm/slub.c:3538 do_slab_free mm/slub.c:3615 [inline] ___cache_free+0xc6/0xd0 mm/slub.c:3668 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0xc5/0x140 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x15a/0x180 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x24/0x80 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook+0x53/0x2c0 mm/slab.h:737 slab_alloc_node mm/slub.c:3398 [inline] kmem_cache_alloc_node+0x18a/0x2d0 mm/slub.c:3443 __alloc_skb+0xcc/0x2d0 net/core/skbuff.c:505 alloc_skb include/linux/skbuff.h:1271 [inline] alloc_skb_with_frags+0xa6/0x680 net/core/skbuff.c:6162 sock_alloc_send_pskb+0x915/0xa50 net/core/sock.c:2747 Memory state around the buggy address: ffff88810cd54780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88810cd54800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88810cd54880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88810cd54900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88810cd54980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== Bluetooth: hci0: Opcode 0x1003 failed: -110