Bluetooth: hci0: Opcode 0x0c03 failed: -110 ================================================================== BUG: KASAN: slab-use-after-free in set_powered_sync+0xc1/0xd0 net/bluetooth/mgmt.c:1353 Read of size 8 at addr ffff88804ca77d18 by task kworker/u33:2/5342 CPU: 2 UID: 0 PID: 5342 Comm: kworker/u33:2 Not tainted 6.11.0-rc6-syzkaller-00026-g88fac17500f4 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Workqueue: hci0 hci_cmd_sync_work Call Trace: __dump_stack lib/dump_stack.c:93 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:119 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 set_powered_sync+0xc1/0xd0 net/bluetooth/mgmt.c:1353 hci_cmd_sync_work+0x1a4/0x410 net/bluetooth/hci_sync.c:328 process_one_work+0x9c5/0x1b40 kernel/workqueue.c:3231 process_scheduled_works kernel/workqueue.c:3312 [inline] worker_thread+0x6c8/0xed0 kernel/workqueue.c:3389 kthread+0x2c1/0x3a0 kernel/kthread.c:389 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Allocated by task 5714: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:370 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:387 kmalloc_noprof include/linux/slab.h:681 [inline] kzalloc_noprof include/linux/slab.h:807 [inline] mgmt_pending_new+0x5b/0x290 net/bluetooth/mgmt_util.c:269 mgmt_pending_add+0x36/0x160 net/bluetooth/mgmt_util.c:296 set_powered+0x28c/0x5c0 net/bluetooth/mgmt.c:1394 hci_mgmt_cmd net/bluetooth/hci_sock.c:1712 [inline] hci_sock_sendmsg+0x1528/0x25e0 net/bluetooth/hci_sock.c:1832 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg net/socket.c:745 [inline] sock_write_iter+0x50a/0x5c0 net/socket.c:1160 new_sync_write fs/read_write.c:497 [inline] vfs_write+0x6b6/0x1140 fs/read_write.c:590 ksys_write+0x1f8/0x260 fs/read_write.c:643 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 5342: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:579 poison_slab_object+0xf7/0x160 mm/kasan/common.c:240 __kasan_slab_free+0x32/0x50 mm/kasan/common.c:256 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2252 [inline] slab_free mm/slub.c:4473 [inline] kfree+0x12a/0x3b0 mm/slub.c:4594 settings_rsp+0x257/0x400 net/bluetooth/mgmt.c:1443 mgmt_pending_foreach+0xdf/0x140 net/bluetooth/mgmt_util.c:259 __mgmt_power_off+0xcd/0x2c0 net/bluetooth/mgmt.c:9448 hci_dev_close_sync+0xc33/0x1110 net/bluetooth/hci_sync.c:5153 hci_dev_do_close+0x2e/0x90 net/bluetooth/hci_core.c:483 hci_error_reset+0xbf/0x320 net/bluetooth/hci_core.c:1016 process_one_work+0x9c5/0x1b40 kernel/workqueue.c:3231 process_scheduled_works kernel/workqueue.c:3312 [inline] worker_thread+0x6c8/0xed0 kernel/workqueue.c:3389 kthread+0x2c1/0x3a0 kernel/kthread.c:389 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 The buggy address belongs to the object at ffff88804ca77d00 which belongs to the cache kmalloc-96 of size 96 The buggy address is located 24 bytes inside of freed 96-byte region [ffff88804ca77d00, ffff88804ca77d60) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x4ca77 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: 0xfdffffff(slab) raw: 00fff00000000000 ffff88801ac42280 ffffea00009f5180 dead000000000004 raw: 0000000000000000 0000000000200020 00000001fdffffff 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 0x152820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL), pid 74, tgid 74 (kworker/u32:4), ts 62194410025, free_ts 62062605101 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1493 prep_new_page mm/page_alloc.c:1501 [inline] get_page_from_freelist+0x1351/0x2e50 mm/page_alloc.c:3439 __alloc_pages_noprof+0x22b/0x2460 mm/page_alloc.c:4695 __alloc_pages_node_noprof include/linux/gfp.h:269 [inline] alloc_pages_node_noprof include/linux/gfp.h:296 [inline] alloc_slab_page+0x4e/0xf0 mm/slub.c:2321 allocate_slab mm/slub.c:2484 [inline] new_slab+0x84/0x260 mm/slub.c:2537 ___slab_alloc+0xdac/0x1870 mm/slub.c:3723 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3813 __slab_alloc_node mm/slub.c:3866 [inline] slab_alloc_node mm/slub.c:4025 [inline] __kmalloc_cache_noprof+0x2b4/0x300 mm/slub.c:4184 kmalloc_noprof include/linux/slab.h:681 [inline] kzalloc_noprof include/linux/slab.h:807 [inline] nsim_fib_event_schedule_work drivers/net/netdevsim/fib.c:990 [inline] nsim_fib_event_nb+0x1b6/0xec0 drivers/net/netdevsim/fib.c:1043 notifier_call_chain+0xb9/0x410 kernel/notifier.c:93 atomic_notifier_call_chain+0x71/0x1c0 kernel/notifier.c:231 call_fib_notifiers+0x33/0x70 net/core/fib_notifier.c:35 call_fib6_entry_notifiers net/ipv6/ip6_fib.c:404 [inline] fib6_add_rt2node net/ipv6/ip6_fib.c:1238 [inline] fib6_add+0x25ec/0x4b50 net/ipv6/ip6_fib.c:1495 __ip6_ins_rt net/ipv6/route.c:1314 [inline] ip6_ins_rt+0xb6/0x110 net/ipv6/route.c:1324 __ipv6_ifa_notify+0xafc/0xe20 net/ipv6/addrconf.c:6268 ipv6_ifa_notify net/ipv6/addrconf.c:6307 [inline] addrconf_dad_completed+0x19d/0x1060 net/ipv6/addrconf.c:4320 page last free pid 5244 tgid 5244 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1094 [inline] free_unref_page+0x64a/0xe40 mm/page_alloc.c:2612 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x4e/0x140 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x192/0x1e0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:322 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3988 [inline] slab_alloc_node mm/slub.c:4037 [inline] kmem_cache_alloc_node_noprof+0x153/0x310 mm/slub.c:4080 __alloc_skb+0x2b1/0x380 net/core/skbuff.c:664 alloc_skb include/linux/skbuff.h:1320 [inline] alloc_skb_with_frags+0xe4/0x710 net/core/skbuff.c:6526 sock_alloc_send_pskb+0x7f1/0x980 net/core/sock.c:2815 sock_alloc_send_skb include/net/sock.h:1778 [inline] mld_newpack.isra.0+0x1ed/0x790 net/ipv6/mcast.c:1746 add_grhead+0x299/0x340 net/ipv6/mcast.c:1849 add_grec+0x111e/0x1670 net/ipv6/mcast.c:1987 mld_send_initial_cr.part.0+0xe2/0x260 net/ipv6/mcast.c:2233 mld_send_initial_cr net/ipv6/mcast.c:2224 [inline] mld_dad_work+0x51/0x2d0 net/ipv6/mcast.c:2259 process_one_work+0x9c5/0x1b40 kernel/workqueue.c:3231 process_scheduled_works kernel/workqueue.c:3312 [inline] worker_thread+0x6c8/0xed0 kernel/workqueue.c:3389 kthread+0x2c1/0x3a0 kernel/kthread.c:389 Memory state around the buggy address: ffff88804ca77c00: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc ffff88804ca77c80: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc >ffff88804ca77d00: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ^ ffff88804ca77d80: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc ffff88804ca77e00: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc ==================================================================