================================================================== BUG: KASAN: use-after-free in set_powered_sync+0x2f/0x90 net/bluetooth/mgmt.c:1257 Read of size 8 at addr ffff88810b3d6818 by task kworker/u5:1/1434 CPU: 1 PID: 1434 Comm: kworker/u5:1 Not tainted 5.17.0-rc5-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024 Workqueue: hci0 hci_cmd_sync_work Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xf4/0x251 lib/dump_stack.c:106 print_address_description+0x62/0x370 mm/kasan/report.c:255 __kasan_report mm/kasan/report.c:442 [inline] kasan_report+0x16b/0x1c0 mm/kasan/report.c:459 set_powered_sync+0x2f/0x90 net/bluetooth/mgmt.c:1257 hci_cmd_sync_work+0x19c/0x200 net/bluetooth/hci_sync.c:307 process_one_work+0x763/0xd30 kernel/workqueue.c:2307 worker_thread+0x86e/0xeb0 kernel/workqueue.c:2454 kthread+0x210/0x260 kernel/kthread.c:377 ret_from_fork+0x22/0x30 Allocated by task 2753: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:436 [inline] ____kasan_kmalloc+0xdb/0x110 mm/kasan/common.c:515 kasan_kmalloc include/linux/kasan.h:270 [inline] kmem_cache_alloc_trace+0x158/0x2b0 mm/slub.c:3257 kmalloc include/linux/slab.h:581 [inline] kzalloc include/linux/slab.h:714 [inline] mgmt_pending_new+0x5d/0x200 net/bluetooth/mgmt_util.c:269 mgmt_pending_add+0x12/0xe0 net/bluetooth/mgmt_util.c:296 set_powered+0x260/0x3f0 net/bluetooth/mgmt.c:1290 hci_mgmt_cmd+0x820/0xd40 net/bluetooth/hci_sock.c:1611 hci_sock_sendmsg+0x707/0xf60 net/bluetooth/hci_sock.c:1731 sock_sendmsg_nosec net/socket.c:705 [inline] sock_sendmsg net/socket.c:725 [inline] sock_write_iter+0x47d/0x490 net/socket.c:1061 call_write_iter include/linux/fs.h:2074 [inline] new_sync_write fs/read_write.c:503 [inline] vfs_write+0xb05/0xf10 fs/read_write.c:590 ksys_write+0x165/0x250 fs/read_write.c:643 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 2752: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:45 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:370 ____kasan_slab_free+0x11f/0x170 mm/kasan/common.c:366 kasan_slab_free include/linux/kasan.h:236 [inline] slab_free_hook mm/slub.c:1728 [inline] slab_free_freelist_hook+0x12c/0x1a0 mm/slub.c:1754 slab_free mm/slub.c:3509 [inline] kfree+0xdc/0x230 mm/slub.c:4562 settings_rsp+0x284/0x340 net/bluetooth/mgmt.c:1331 mgmt_pending_foreach+0x6d/0xd0 net/bluetooth/mgmt_util.c:259 __mgmt_power_off+0x106/0x3c0 net/bluetooth/mgmt.c:8887 hci_dev_close_sync+0x345/0xd20 net/bluetooth/hci_sync.c:4107 hci_dev_do_close net/bluetooth/hci_core.c:553 [inline] hci_dev_close+0x9d/0x150 net/bluetooth/hci_core.c:577 sock_do_ioctl+0x106/0x390 net/socket.c:1122 sock_ioctl+0x47b/0x5f0 net/socket.c:1239 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:874 [inline] __se_sys_ioctl+0xaa/0xf0 fs/ioctl.c:860 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Last potentially related work creation: kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38 __kasan_record_aux_stack+0xaf/0xc0 mm/kasan/generic.c:348 __call_rcu kernel/rcu/tree.c:3026 [inline] call_rcu+0x19c/0x8d0 kernel/rcu/tree.c:3106 nf_unregister_net_hooks+0x35/0xd0 net/netfilter/core.c:606 ops_pre_exit_list net/core/net_namespace.c:158 [inline] cleanup_net+0x504/0xa90 net/core/net_namespace.c:585 process_one_work+0x763/0xd30 kernel/workqueue.c:2307 worker_thread+0x86e/0xeb0 kernel/workqueue.c:2454 kthread+0x210/0x260 kernel/kthread.c:377 ret_from_fork+0x22/0x30 The buggy address belongs to the object at ffff88810b3d6800 which belongs to the cache kmalloc-96 of size 96 The buggy address is located 24 bytes inside of 96-byte region [ffff88810b3d6800, ffff88810b3d6860) The buggy address belongs to the page: page:ffffea00042cf580 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10b3d6 flags: 0x100000000000200(slab|node=0|zone=2) raw: 0100000000000200 ffffea0005dbe880 dead000000000003 ffff888100041780 raw: 0000000000000000 0000000080200020 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 1, ts 3575937415, free_ts 3574174491 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x1ef/0x210 mm/page_alloc.c:2427 prep_new_page+0x28/0x230 mm/page_alloc.c:2434 get_page_from_freelist+0x3a4a/0x3bf0 mm/page_alloc.c:4165 __alloc_pages+0x277/0x700 mm/page_alloc.c:5389 alloc_page_interleave+0xf/0x130 mm/mempolicy.c:2116 alloc_slab_page+0x39/0x90 mm/slub.c:1799 allocate_slab mm/slub.c:1944 [inline] new_slab+0x70/0x2a0 mm/slub.c:2004 ___slab_alloc+0x5a2/0xab0 mm/slub.c:3018 __slab_alloc mm/slub.c:3105 [inline] slab_alloc_node mm/slub.c:3196 [inline] slab_alloc mm/slub.c:3238 [inline] kmem_cache_alloc_trace+0x1af/0x2b0 mm/slub.c:3255 kmalloc include/linux/slab.h:581 [inline] kzalloc include/linux/slab.h:714 [inline] acpi_button_add+0x7c/0x880 drivers/acpi/button.c:493 acpi_device_probe+0xa4/0x290 drivers/acpi/bus.c:994 really_probe+0x22a/0xa80 drivers/base/dd.c:596 __driver_probe_device+0x1e1/0x350 drivers/base/dd.c:752 driver_probe_device+0x4b/0x3a0 drivers/base/dd.c:782 __driver_attach+0x282/0x580 drivers/base/dd.c:1141 bus_for_each_dev+0x156/0x1b0 drivers/base/bus.c:301 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1352 [inline] free_pcp_prepare mm/page_alloc.c:1404 [inline] free_unref_page_prepare+0xb4a/0xc10 mm/page_alloc.c:3325 free_unref_page+0x95/0x280 mm/page_alloc.c:3404 __vunmap+0x331/0x7b0 mm/vmalloc.c:2635 free_work+0x3d/0x70 mm/vmalloc.c:97 process_one_work+0x763/0xd30 kernel/workqueue.c:2307 worker_thread+0x86e/0xeb0 kernel/workqueue.c:2454 kthread+0x210/0x260 kernel/kthread.c:377 ret_from_fork+0x22/0x30 Memory state around the buggy address: ffff88810b3d6700: 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc ffff88810b3d6780: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc >ffff88810b3d6800: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ^ ffff88810b3d6880: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc ffff88810b3d6900: 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc ==================================================================