================================================================== BUG: KASAN: slab-use-after-free in mgmt_remove_adv_monitor_sync+0xe2/0xf0 net/bluetooth/mgmt.c:5543 Read of size 8 at addr ffff888059acf898 by task kworker/u33:5/5949 CPU: 2 UID: 0 PID: 5949 Comm: kworker/u33:5 Not tainted 6.13.0-rc3-syzkaller-00062-gc061cf420ded #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:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xc3/0x620 mm/kasan/report.c:489 kasan_report+0xd9/0x110 mm/kasan/report.c:602 mgmt_remove_adv_monitor_sync+0xe2/0xf0 net/bluetooth/mgmt.c:5543 hci_cmd_sync_work+0x1a4/0x410 net/bluetooth/hci_sync.c:332 process_one_work+0x958/0x1b30 kernel/workqueue.c:3229 process_scheduled_works kernel/workqueue.c:3310 [inline] worker_thread+0x6c8/0xf00 kernel/workqueue.c:3391 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 6441: 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:377 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:394 kmalloc_noprof include/linux/slab.h:901 [inline] kzalloc_noprof include/linux/slab.h:1037 [inline] mgmt_pending_new+0x5b/0x290 net/bluetooth/mgmt_util.c:269 mgmt_pending_add+0x36/0x160 net/bluetooth/mgmt_util.c:296 remove_adv_monitor+0x124/0x1b0 net/bluetooth/mgmt.c:5568 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:711 [inline] __sock_sendmsg net/socket.c:726 [inline] sock_write_iter+0x4fe/0x5b0 net/socket.c:1147 new_sync_write fs/read_write.c:586 [inline] vfs_write+0x5ae/0x1150 fs/read_write.c:679 ksys_write+0x207/0x250 fs/read_write.c:731 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e Freed by task 144: 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:582 poison_slab_object mm/kasan/common.c:247 [inline] __kasan_slab_free+0x51/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:233 [inline] slab_free_hook mm/slub.c:2353 [inline] slab_free mm/slub.c:4613 [inline] kfree+0x14f/0x4b0 mm/slub.c:4761 cmd_status_rsp net/bluetooth/mgmt.c:1459 [inline] cmd_complete_rsp+0x16d/0x1e0 net/bluetooth/mgmt.c:1478 mgmt_pending_foreach+0xdf/0x140 net/bluetooth/mgmt_util.c:259 __mgmt_power_off+0x12f/0x2c0 net/bluetooth/mgmt.c:9550 hci_dev_close_sync+0xd37/0x1250 net/bluetooth/hci_sync.c:5208 hci_dev_do_close+0x2e/0x90 net/bluetooth/hci_core.c:482 hci_rfkill_set_block+0x225/0x360 net/bluetooth/hci_core.c:910 rfkill_set_block+0x203/0x560 net/rfkill/core.c:346 rfkill_epo+0x8e/0x1d0 net/rfkill/core.c:466 __rfkill_handle_global_op net/rfkill/input.c:60 [inline] rfkill_op_handler+0x25a/0x270 net/rfkill/input.c:108 process_one_work+0x958/0x1b30 kernel/workqueue.c:3229 process_scheduled_works kernel/workqueue.c:3310 [inline] worker_thread+0x6c8/0xf00 kernel/workqueue.c:3391 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 ffff888059acf880 which belongs to the cache kmalloc-96 of size 96 The buggy address is located 24 bytes inside of freed 96-byte region [ffff888059acf880, ffff888059acf8e0) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888059acf480 pfn:0x59acf flags: 0x4fff00000000000(node=1|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 04fff00000000000 ffff88801ac42280 ffffea00009730c0 dead000000000004 raw: ffff888059acf480 0000000000200018 00000001f5000000 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 0x52cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 144, tgid 144 (kworker/3:2), ts 48284608118, free_ts 48185224230 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1556 prep_new_page mm/page_alloc.c:1564 [inline] get_page_from_freelist+0xfce/0x2f80 mm/page_alloc.c:3474 __alloc_pages_noprof+0x223/0x25b0 mm/page_alloc.c:4751 alloc_pages_mpol_noprof+0x2c9/0x610 mm/mempolicy.c:2269 alloc_slab_page mm/slub.c:2423 [inline] allocate_slab mm/slub.c:2589 [inline] new_slab+0x2c9/0x410 mm/slub.c:2642 ___slab_alloc+0xce2/0x1650 mm/slub.c:3830 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3920 __slab_alloc_node mm/slub.c:3995 [inline] slab_alloc_node mm/slub.c:4156 [inline] __kmalloc_cache_noprof+0xf6/0x420 mm/slub.c:4324 kmalloc_noprof include/linux/slab.h:901 [inline] kzalloc_noprof include/linux/slab.h:1037 [inline] nsim_fib6_rt_create drivers/net/netdevsim/fib.c:547 [inline] nsim_fib6_rt_insert drivers/net/netdevsim/fib.c:752 [inline] nsim_fib6_event drivers/net/netdevsim/fib.c:856 [inline] nsim_fib_event drivers/net/netdevsim/fib.c:889 [inline] nsim_fib_event_work+0x1ac3/0x3190 drivers/net/netdevsim/fib.c:1493 process_one_work+0x958/0x1b30 kernel/workqueue.c:3229 process_scheduled_works kernel/workqueue.c:3310 [inline] worker_thread+0x6c8/0xf00 kernel/workqueue.c:3391 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 page last free pid 5944 tgid 5944 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1127 [inline] free_unref_page+0x661/0x1080 mm/page_alloc.c:2657 __put_partials+0x14c/0x170 mm/slub.c:3157 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x4e/0x120 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x195/0x1e0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:329 kasan_slab_alloc include/linux/kasan.h:250 [inline] slab_post_alloc_hook mm/slub.c:4119 [inline] slab_alloc_node mm/slub.c:4168 [inline] kmem_cache_alloc_node_noprof+0x1ca/0x3b0 mm/slub.c:4220 __alloc_skb+0x2b3/0x380 net/core/skbuff.c:668 alloc_skb include/linux/skbuff.h:1323 [inline] netlink_alloc_large_skb+0x69/0x130 net/netlink/af_netlink.c:1196 netlink_sendmsg+0x689/0xd70 net/netlink/af_netlink.c:1866 sock_sendmsg_nosec net/socket.c:711 [inline] __sock_sendmsg net/socket.c:726 [inline] __sys_sendto+0x488/0x4f0 net/socket.c:2197 __do_compat_sys_socketcall+0x5e2/0x700 net/compat.c:475 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e Memory state around the buggy address: ffff888059acf780: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ffff888059acf800: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc >ffff888059acf880: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ^ ffff888059acf900: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ffff888059acf980: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ==================================================================