Bluetooth: hci5: killing stalled connection 10:aa:aa:aa:aa:aa ================================================================== BUG: KASAN: slab-use-after-free in hci_disconnect+0x1fc/0x220 net/bluetooth/hci_conn.c:249 Read of size 4 at addr ffff88805fe94038 by task kworker/u5:5/5096 CPU: 0 PID: 5096 Comm: kworker/u5:5 Not tainted 6.7.0-rc8-next-20240105-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023 Workqueue: hci5 hci_tx_work Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:377 [inline] print_report+0xc3/0x620 mm/kasan/report.c:488 kasan_report+0xd9/0x110 mm/kasan/report.c:601 hci_disconnect+0x1fc/0x220 net/bluetooth/hci_conn.c:249 hci_link_tx_to net/bluetooth/hci_core.c:3433 [inline] __check_timeout net/bluetooth/hci_core.c:3580 [inline] __check_timeout+0x3fa/0x730 net/bluetooth/hci_core.c:3560 hci_sched_acl_pkt net/bluetooth/hci_core.c:3638 [inline] hci_sched_acl net/bluetooth/hci_core.c:3741 [inline] hci_tx_work+0x1258/0x1e40 net/bluetooth/hci_core.c:3840 process_one_work+0x8a4/0x15f0 kernel/workqueue.c:2633 process_scheduled_works kernel/workqueue.c:2706 [inline] worker_thread+0x8b6/0x1290 kernel/workqueue.c:2787 kthread+0x2c1/0x3a0 kernel/kthread.c:388 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242 Allocated by task 4455: kasan_save_stack+0x33/0x50 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:372 [inline] __kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:389 kmalloc include/linux/slab.h:590 [inline] kzalloc include/linux/slab.h:711 [inline] hci_conn_add+0xb9/0x1610 net/bluetooth/hci_conn.c:973 hci_conn_add_unset+0x6d/0xf0 net/bluetooth/hci_conn.c:1075 hci_conn_request_evt+0x952/0xab0 net/bluetooth/hci_event.c:3336 hci_event_func net/bluetooth/hci_event.c:7682 [inline] hci_event_packet+0x9d3/0x1160 net/bluetooth/hci_event.c:7734 hci_rx_work+0x2c4/0x1610 net/bluetooth/hci_core.c:4107 process_one_work+0x8a4/0x15f0 kernel/workqueue.c:2633 process_scheduled_works kernel/workqueue.c:2706 [inline] worker_thread+0x8b6/0x1290 kernel/workqueue.c:2787 kthread+0x2c1/0x3a0 kernel/kthread.c:388 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242 Freed by task 4455: kasan_save_stack+0x33/0x50 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 kasan_save_free_info+0x3f/0x60 mm/kasan/generic.c:634 poison_slab_object mm/kasan/common.c:241 [inline] __kasan_slab_free+0x121/0x1b0 mm/kasan/common.c:257 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2121 [inline] slab_free mm/slub.c:4299 [inline] kfree+0x129/0x370 mm/slub.c:4409 device_release+0xa1/0x240 drivers/base/core.c:2485 kobject_cleanup lib/kobject.c:682 [inline] kobject_release lib/kobject.c:716 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x1d0/0x440 lib/kobject.c:733 put_device drivers/base/core.c:3733 [inline] device_unregister+0x2f/0xc0 drivers/base/core.c:3856 hci_conn_del_sysfs+0xb4/0x180 net/bluetooth/hci_sysfs.c:86 hci_conn_cleanup net/bluetooth/hci_conn.c:177 [inline] hci_conn_del+0x584/0xe10 net/bluetooth/hci_conn.c:1188 hci_abort_conn_sync+0x758/0xb50 net/bluetooth/hci_sync.c:5356 abort_conn_sync+0x187/0x390 net/bluetooth/hci_conn.c:2988 hci_cmd_sync_work+0x1a4/0x410 net/bluetooth/hci_sync.c:306 process_one_work+0x8a4/0x15f0 kernel/workqueue.c:2633 process_scheduled_works kernel/workqueue.c:2706 [inline] worker_thread+0x8b6/0x1290 kernel/workqueue.c:2787 kthread+0x2c1/0x3a0 kernel/kthread.c:388 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242 The buggy address belongs to the object at ffff88805fe94000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 56 bytes inside of freed 4096-byte region [ffff88805fe94000, ffff88805fe95000) The buggy address belongs to the physical page: page:ffffea00017fa400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5fe90 head:ffffea00017fa400 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000840 ffff888013042140 ffffea0000bc5800 dead000000000002 raw: 0000000000000000 0000000000040004 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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 4455, tgid 4455 (kworker/u5:1), ts 195024493937, free_ts 194816921079 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2d0/0x350 mm/page_alloc.c:1533 prep_new_page mm/page_alloc.c:1540 [inline] get_page_from_freelist+0xa19/0x3740 mm/page_alloc.c:3347 __alloc_pages+0x22e/0x2410 mm/page_alloc.c:4603 __alloc_pages_node include/linux/gfp.h:238 [inline] alloc_pages_node include/linux/gfp.h:261 [inline] alloc_slab_page mm/slub.c:2190 [inline] allocate_slab mm/slub.c:2354 [inline] new_slab+0xcc/0x3a0 mm/slub.c:2407 ___slab_alloc+0x4ab/0x1990 mm/slub.c:3540 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3625 __slab_alloc_node mm/slub.c:3678 [inline] slab_alloc_node mm/slub.c:3850 [inline] kmalloc_trace+0x2ff/0x330 mm/slub.c:4007 kmalloc include/linux/slab.h:590 [inline] kzalloc include/linux/slab.h:711 [inline] hci_conn_add+0xb9/0x1610 net/bluetooth/hci_conn.c:973 hci_conn_add_unset+0x6d/0xf0 net/bluetooth/hci_conn.c:1075 hci_conn_request_evt+0x952/0xab0 net/bluetooth/hci_event.c:3336 hci_event_func net/bluetooth/hci_event.c:7682 [inline] hci_event_packet+0x9d3/0x1160 net/bluetooth/hci_event.c:7734 hci_rx_work+0x2c4/0x1610 net/bluetooth/hci_core.c:4107 process_one_work+0x8a4/0x15f0 kernel/workqueue.c:2633 process_scheduled_works kernel/workqueue.c:2706 [inline] worker_thread+0x8b6/0x1290 kernel/workqueue.c:2787 kthread+0x2c1/0x3a0 kernel/kthread.c:388 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 page last free pid 5089 tgid 5089 stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1140 [inline] free_unref_page_prepare+0x51f/0xb10 mm/page_alloc.c:2382 free_unref_page+0x33/0x3c0 mm/page_alloc.c:2522 __put_partials+0x14c/0x160 mm/slub.c:2922 qlink_free mm/kasan/quarantine.c:160 [inline] qlist_free_all+0x58/0x150 mm/kasan/quarantine.c:176 kasan_quarantine_reduce+0x18e/0x1d0 mm/kasan/quarantine.c:283 __kasan_slab_alloc+0x65/0x90 mm/kasan/common.c:324 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3813 [inline] slab_alloc_node mm/slub.c:3860 [inline] __do_kmalloc_node mm/slub.c:3980 [inline] __kmalloc_node+0x1e9/0x480 mm/slub.c:3988 kmalloc_node include/linux/slab.h:610 [inline] kvmalloc_node+0x99/0x1a0 mm/util.c:634 kvmalloc include/linux/slab.h:728 [inline] seq_buf_alloc fs/seq_file.c:38 [inline] seq_read_iter+0x80b/0x1280 fs/seq_file.c:210 kernfs_fop_read_iter+0x410/0x580 fs/kernfs/file.c:279 call_read_iter include/linux/fs.h:2079 [inline] new_sync_read fs/read_write.c:395 [inline] vfs_read+0x4d1/0x8f0 fs/read_write.c:476 ksys_read+0x12f/0x250 fs/read_write.c:619 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xd0/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x62/0x6a Memory state around the buggy address: ffff88805fe93f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88805fe93f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88805fe94000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88805fe94080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88805fe94100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================