====================================================== WARNING: possible circular locking dependency detected 6.12.0-rc4-syzkaller-00161-gae90f6a6170d #0 Not tainted ------------------------------------------------------ syz.3.96/6244 is trying to acquire lock: ffff88807abf0078 (&hdev->lock){+.+.}-{3:3}, at: mgmt_remove_adv_monitor_complete+0x9e/0x2e0 net/bluetooth/mgmt.c:5454 but task is already holding lock: ffff88807abf0690 (&hdev->cmd_sync_work_lock){+.+.}-{3:3}, at: hci_cmd_sync_dequeue+0x50/0x1f0 net/bluetooth/hci_sync.c:883 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&hdev->cmd_sync_work_lock){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x175/0x9c0 kernel/locking/mutex.c:752 hci_cmd_sync_lookup_entry net/bluetooth/hci_sync.c:834 [inline] hci_cmd_sync_queue_once net/bluetooth/hci_sync.c:778 [inline] hci_update_passive_scan+0x206/0x380 net/bluetooth/hci_sync.c:3203 le_conn_complete_evt+0x1ca/0x1d80 net/bluetooth/hci_event.c:5773 hci_le_conn_complete_evt+0x23c/0x370 net/bluetooth/hci_event.c:5784 hci_le_meta_evt+0x2e5/0x5d0 net/bluetooth/hci_event.c:7132 hci_event_func net/bluetooth/hci_event.c:7440 [inline] hci_event_packet+0x669/0x1180 net/bluetooth/hci_event.c:7495 hci_rx_work+0x2c6/0x16c0 net/bluetooth/hci_core.c:4031 process_one_work+0x9c8/0x1ba0 kernel/workqueue.c:3229 process_scheduled_works kernel/workqueue.c:3310 [inline] worker_thread+0x6c8/0xf00 kernel/workqueue.c:3391 kthread+0x2c4/0x3a0 kernel/kthread.c:389 ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 -> #0 (&hdev->lock){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3161 [inline] check_prevs_add kernel/locking/lockdep.c:3280 [inline] validate_chain kernel/locking/lockdep.c:3904 [inline] __lock_acquire+0x250b/0x3ce0 kernel/locking/lockdep.c:5202 lock_acquire.part.0+0x11b/0x380 kernel/locking/lockdep.c:5825 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x175/0x9c0 kernel/locking/mutex.c:752 mgmt_remove_adv_monitor_complete+0x9e/0x2e0 net/bluetooth/mgmt.c:5454 _hci_cmd_sync_cancel_entry.constprop.0+0x6f/0x1d0 net/bluetooth/hci_sync.c:641 hci_cmd_sync_dequeue+0x178/0x1f0 net/bluetooth/hci_sync.c:886 cmd_complete_rsp+0x46/0x1e0 net/bluetooth/mgmt.c:1461 mgmt_pending_foreach+0xe2/0x140 net/bluetooth/mgmt_util.c:259 mgmt_index_removed+0x145/0x300 net/bluetooth/mgmt.c:9407 hci_sock_bind+0xc49/0x16f0 net/bluetooth/hci_sock.c:1307 __sys_bind_socket net/socket.c:1843 [inline] __sys_bind_socket net/socket.c:1835 [inline] __sys_bind+0x1ee/0x220 net/socket.c:1867 __do_sys_bind net/socket.c:1875 [inline] __se_sys_bind net/socket.c:1873 [inline] __x64_sys_bind+0x72/0xb0 net/socket.c:1873 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 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&hdev->cmd_sync_work_lock); lock(&hdev->lock); lock(&hdev->cmd_sync_work_lock); lock(&hdev->lock); *** DEADLOCK *** 2 locks held by syz.3.96/6244: #0: ffff88805a706258 (sk_lock-AF_BLUETOOTH-BTPROTO_HCI){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1611 [inline] #0: ffff88805a706258 (sk_lock-AF_BLUETOOTH-BTPROTO_HCI){+.+.}-{0:0}, at: hci_sock_bind+0x111/0x16f0 net/bluetooth/hci_sock.c:1202 #1: ffff88807abf0690 (&hdev->cmd_sync_work_lock){+.+.}-{3:3}, at: hci_cmd_sync_dequeue+0x50/0x1f0 net/bluetooth/hci_sync.c:883 stack backtrace: CPU: 0 UID: 0 PID: 6244 Comm: syz.3.96 Not tainted 6.12.0-rc4-syzkaller-00161-gae90f6a6170d #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_circular_bug+0x41c/0x610 kernel/locking/lockdep.c:2074 check_noncircular+0x31a/0x400 kernel/locking/lockdep.c:2206 check_prev_add kernel/locking/lockdep.c:3161 [inline] check_prevs_add kernel/locking/lockdep.c:3280 [inline] validate_chain kernel/locking/lockdep.c:3904 [inline] __lock_acquire+0x250b/0x3ce0 kernel/locking/lockdep.c:5202 lock_acquire.part.0+0x11b/0x380 kernel/locking/lockdep.c:5825 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x175/0x9c0 kernel/locking/mutex.c:752 mgmt_remove_adv_monitor_complete+0x9e/0x2e0 net/bluetooth/mgmt.c:5454 _hci_cmd_sync_cancel_entry.constprop.0+0x6f/0x1d0 net/bluetooth/hci_sync.c:641 hci_cmd_sync_dequeue+0x178/0x1f0 net/bluetooth/hci_sync.c:886 cmd_complete_rsp+0x46/0x1e0 net/bluetooth/mgmt.c:1461 mgmt_pending_foreach+0xe2/0x140 net/bluetooth/mgmt_util.c:259 mgmt_index_removed+0x145/0x300 net/bluetooth/mgmt.c:9407 hci_sock_bind+0xc49/0x16f0 net/bluetooth/hci_sock.c:1307 __sys_bind_socket net/socket.c:1843 [inline] __sys_bind_socket net/socket.c:1835 [inline] __sys_bind+0x1ee/0x220 net/socket.c:1867 __do_sys_bind net/socket.c:1875 [inline] __se_sys_bind net/socket.c:1873 [inline] __x64_sys_bind+0x72/0xb0 net/socket.c:1873 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 RIP: 0033:0x7ff061f7e719 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ff062d6a038 EFLAGS: 00000246 ORIG_RAX: 0000000000000031 RAX: ffffffffffffffda RBX: 00007ff062135f80 RCX: 00007ff061f7e719 RDX: 0000000000000006 RSI: 0000000020000040 RDI: 0000000000000004 RBP: 00007ff061ff12be R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007ff062135f80 R15: 00007ffeecd43be8 ================================================================== BUG: KASAN: slab-use-after-free in cmd_complete_rsp+0x1b3/0x1e0 net/bluetooth/mgmt.c:1463 Read of size 8 at addr ffff88807d6085c0 by task syz.3.96/6244 CPU: 0 UID: 0 PID: 6244 Comm: syz.3.96 Not tainted 6.12.0-rc4-syzkaller-00161-gae90f6a6170d #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 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:377 [inline] print_report+0xc3/0x620 mm/kasan/report.c:488 kasan_report+0xd9/0x110 mm/kasan/report.c:601 cmd_complete_rsp+0x1b3/0x1e0 net/bluetooth/mgmt.c:1463 mgmt_pending_foreach+0xe2/0x140 net/bluetooth/mgmt_util.c:259 mgmt_index_removed+0x145/0x300 net/bluetooth/mgmt.c:9407 hci_sock_bind+0xc49/0x16f0 net/bluetooth/hci_sock.c:1307 __sys_bind_socket net/socket.c:1843 [inline] __sys_bind_socket net/socket.c:1835 [inline] __sys_bind+0x1ee/0x220 net/socket.c:1867 __do_sys_bind net/socket.c:1875 [inline] __se_sys_bind net/socket.c:1873 [inline] __x64_sys_bind+0x72/0xb0 net/socket.c:1873 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 RIP: 0033:0x7ff061f7e719 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ff062d6a038 EFLAGS: 00000246 ORIG_RAX: 0000000000000031 RAX: ffffffffffffffda RBX: 00007ff062135f80 RCX: 00007ff061f7e719 RDX: 0000000000000006 RSI: 0000000020000040 RDI: 0000000000000004 RBP: 00007ff061ff12be R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007ff062135f80 R15: 00007ffeecd43be8 Allocated by task 6241: 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:878 [inline] kzalloc_noprof include/linux/slab.h:1014 [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:5498 hci_mgmt_cmd net/bluetooth/hci_sock.c:1712 [inline] hci_sock_sendmsg+0x152b/0x25e0 net/bluetooth/hci_sock.c:1832 sock_sendmsg_nosec net/socket.c:729 [inline] __sock_sendmsg net/socket.c:744 [inline] sock_write_iter+0x501/0x5b0 net/socket.c:1165 new_sync_write fs/read_write.c:590 [inline] vfs_write+0x6b8/0x1140 fs/read_write.c:683 ksys_write+0x1fa/0x260 fs/read_write.c:736 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 6244: 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 mm/kasan/common.c:247 [inline] __kasan_slab_free+0x51/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:2342 [inline] slab_free mm/slub.c:4579 [inline] kfree+0x14f/0x4b0 mm/slub.c:4727 mgmt_remove_adv_monitor_complete+0x1b7/0x2e0 net/bluetooth/mgmt.c:5463 _hci_cmd_sync_cancel_entry.constprop.0+0x6f/0x1d0 net/bluetooth/hci_sync.c:641 hci_cmd_sync_dequeue+0x178/0x1f0 net/bluetooth/hci_sync.c:886 cmd_complete_rsp+0x46/0x1e0 net/bluetooth/mgmt.c:1461 mgmt_pending_foreach+0xe2/0x140 net/bluetooth/mgmt_util.c:259 mgmt_index_removed+0x145/0x300 net/bluetooth/mgmt.c:9407 hci_sock_bind+0xc49/0x16f0 net/bluetooth/hci_sock.c:1307 __sys_bind_socket net/socket.c:1843 [inline] __sys_bind_socket net/socket.c:1835 [inline] __sys_bind+0x1ee/0x220 net/socket.c:1867 __do_sys_bind net/socket.c:1875 [inline] __se_sys_bind net/socket.c:1873 [inline] __x64_sys_bind+0x72/0xb0 net/socket.c:1873 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 The buggy address belongs to the object at ffff88807d608580 which belongs to the cache kmalloc-96 of size 96 The buggy address is located 64 bytes inside of freed 96-byte region [ffff88807d608580, ffff88807d6085e0) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7d608 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000000 ffff88801b041280 ffffea0000bda2c0 dead000000000002 raw: 0000000000000000 0000000000200020 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 0x52820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 1858, tgid 1858 (kworker/u8:6), ts 99313441398, free_ts 99312586007 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1537 prep_new_page mm/page_alloc.c:1545 [inline] get_page_from_freelist+0x101e/0x3070 mm/page_alloc.c:3457 __alloc_pages_noprof+0x223/0x25a0 mm/page_alloc.c:4733 alloc_pages_mpol_noprof+0x2c9/0x610 mm/mempolicy.c:2265 alloc_slab_page mm/slub.c:2412 [inline] allocate_slab mm/slub.c:2578 [inline] new_slab+0x2ba/0x3f0 mm/slub.c:2631 ___slab_alloc+0xdac/0x1880 mm/slub.c:3818 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3908 __slab_alloc_node mm/slub.c:3961 [inline] slab_alloc_node mm/slub.c:4122 [inline] __kmalloc_cache_noprof+0x2b4/0x300 mm/slub.c:4290 kmalloc_noprof include/linux/slab.h:878 [inline] dst_cow_metrics_generic+0x4c/0x1e0 net/core/dst.c:185 dst_metrics_write_ptr include/net/dst.h:133 [inline] dst_metric_set include/net/dst.h:194 [inline] icmp6_dst_alloc+0x373/0x490 net/ipv6/route.c:3288 mld_sendpack+0x5a9/0x11d0 net/ipv6/mcast.c:1808 mld_send_initial_cr.part.0+0x1a1/0x260 net/ipv6/mcast.c:2237 mld_send_initial_cr include/linux/refcount.h:192 [inline] ipv6_mc_dad_complete+0x22c/0x2b0 net/ipv6/mcast.c:2245 addrconf_dad_completed+0xd40/0x1060 net/ipv6/addrconf.c:4342 addrconf_dad_work+0x7fb/0x14d0 net/ipv6/addrconf.c:4270 process_one_work+0x9c8/0x1ba0 kernel/workqueue.c:3229 page last free pid 53 tgid 53 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1108 [inline] free_unref_page+0x5f4/0xdc0 mm/page_alloc.c:2638 rcu_do_batch kernel/rcu/tree.c:2567 [inline] rcu_core+0x7a0/0x14d0 kernel/rcu/tree.c:2823 handle_softirqs+0x216/0x8f0 kernel/softirq.c:554 __do_softirq kernel/softirq.c:588 [inline] invoke_softirq kernel/softirq.c:428 [inline] __irq_exit_rcu kernel/softirq.c:637 [inline] irq_exit_rcu+0xbb/0x120 kernel/softirq.c:649 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1049 [inline] sysvec_apic_timer_interrupt+0xa4/0xc0 arch/x86/kernel/apic/apic.c:1049 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702 Memory state around the buggy address: ffff88807d608480: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc ffff88807d608500: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc >ffff88807d608580: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ^ ffff88807d608600: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ffff88807d608680: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc ================================================================== ================================================================== BUG: KASAN: slab-use-after-free in cmd_status_rsp net/bluetooth/mgmt.c:1450 [inline] BUG: KASAN: slab-use-after-free in cmd_complete_rsp+0x199/0x1e0 net/bluetooth/mgmt.c:1470 Read of size 2 at addr ffff88807d608590 by task syz.3.96/6244 CPU: 0 UID: 0 PID: 6244 Comm: syz.3.96 Tainted: G B 6.12.0-rc4-syzkaller-00161-gae90f6a6170d #0 Tainted: [B]=BAD_PAGE Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 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:377 [inline] print_report+0xc3/0x620 mm/kasan/report.c:488 kasan_report+0xd9/0x110 mm/kasan/report.c:601 cmd_status_rsp net/bluetooth/mgmt.c:1450 [inline] cmd_complete_rsp+0x199/0x1e0 net/bluetooth/mgmt.c:1470 mgmt_pending_foreach+0xe2/0x140 net/bluetooth/mgmt_util.c:259 mgmt_index_removed+0x145/0x300 net/bluetooth/mgmt.c:9407 hci_sock_bind+0xc49/0x16f0 net/bluetooth/hci_sock.c:1307 __sys_bind_socket net/socket.c:1843 [inline] __sys_bind_socket net/socket.c:1835 [inline] __sys_bind+0x1ee/0x220 net/socket.c:1867 __do_sys_bind net/socket.c:1875 [inline] __se_sys_bind net/socket.c:1873 [inline] __x64_sys_bind+0x72/0xb0 net/socket.c:1873 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 RIP: 0033:0x7ff061f7e719 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ff062d6a038 EFLAGS: 00000246 ORIG_RAX: 0000000000000031 RAX: ffffffffffffffda RBX: 00007ff062135f80 RCX: 00007ff061f7e719 RDX: 0000000000000006 RSI: 0000000020000040 RDI: 0000000000000004 RBP: 00007ff061ff12be R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007ff062135f80 R15: 00007ffeecd43be8 Allocated by task 6241: 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:878 [inline] kzalloc_noprof include/linux/slab.h:1014 [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:5498 hci_mgmt_cmd net/bluetooth/hci_sock.c:1712 [inline] hci_sock_sendmsg+0x152b/0x25e0 net/bluetooth/hci_sock.c:1832 sock_sendmsg_nosec net/socket.c:729 [inline] __sock_sendmsg net/socket.c:744 [inline] sock_write_iter+0x501/0x5b0 net/socket.c:1165 new_sync_write fs/read_write.c:590 [inline] vfs_write+0x6b8/0x1140 fs/read_write.c:683 ksys_write+0x1fa/0x260 fs/read_write.c:736 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 6244: 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 mm/kasan/common.c:247 [inline] __kasan_slab_free+0x51/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:2342 [inline] slab_free mm/slub.c:4579 [inline] kfree+0x14f/0x4b0 mm/slub.c:4727 mgmt_remove_adv_monitor_complete+0x1b7/0x2e0 net/bluetooth/mgmt.c:5463 _hci_cmd_sync_cancel_entry.constprop.0+0x6f/0x1d0 net/bluetooth/hci_sync.c:641 hci_cmd_sync_dequeue+0x178/0x1f0 net/bluetooth/hci_sync.c:886 cmd_complete_rsp+0x46/0x1e0 net/bluetooth/mgmt.c:1461 mgmt_pending_foreach+0xe2/0x140 net/bluetooth/mgmt_util.c:259 mgmt_index_removed+0x145/0x300 net/bluetooth/mgmt.c:9407 hci_sock_bind+0xc49/0x16f0 net/bluetooth/hci_sock.c:1307 __sys_bind_socket net/socket.c:1843 [inline] __sys_bind_socket net/socket.c:1835 [inline] __sys_bind+0x1ee/0x220 net/socket.c:1867 __do_sys_bind net/socket.c:1875 [inline] __se_sys_bind net/socket.c:1873 [inline] __x64_sys_bind+0x72/0xb0 net/socket.c:1873 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 The buggy address belongs to the object at ffff88807d608580 which belongs to the cache kmalloc-96 of size 96 The buggy address is located 16 bytes inside of freed 96-byte region [ffff88807d608580, ffff88807d6085e0) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7d608 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000000 ffff88801b041280 ffffea0000bda2c0 dead000000000002 raw: 0000000000000000 0000000000200020 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 0x52820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 1858, tgid 1858 (kworker/u8:6), ts 99313441398, free_ts 99312586007 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1537 prep_new_page mm/page_alloc.c:1545 [inline] get_page_from_freelist+0x101e/0x3070 mm/page_alloc.c:3457 __alloc_pages_noprof+0x223/0x25a0 mm/page_alloc.c:4733 alloc_pages_mpol_noprof+0x2c9/0x610 mm/mempolicy.c:2265 alloc_slab_page mm/slub.c:2412 [inline] allocate_slab mm/slub.c:2578 [inline] new_slab+0x2ba/0x3f0 mm/slub.c:2631 ___slab_alloc+0xdac/0x1880 mm/slub.c:3818 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3908 __slab_alloc_node mm/slub.c:3961 [inline] slab_alloc_node mm/slub.c:4122 [inline] __kmalloc_cache_noprof+0x2b4/0x300 mm/slub.c:4290 kmalloc_noprof include/linux/slab.h:878 [inline] dst_cow_metrics_generic+0x4c/0x1e0 net/core/dst.c:185 dst_metrics_write_ptr include/net/dst.h:133 [inline] dst_metric_set include/net/dst.h:194 [inline] icmp6_dst_alloc+0x373/0x490 net/ipv6/route.c:3288 mld_sendpack+0x5a9/0x11d0 net/ipv6/mcast.c:1808 mld_send_initial_cr.part.0+0x1a1/0x260 net/ipv6/mcast.c:2237 mld_send_initial_cr include/linux/refcount.h:192 [inline] ipv6_mc_dad_complete+0x22c/0x2b0 net/ipv6/mcast.c:2245 addrconf_dad_completed+0xd40/0x1060 net/ipv6/addrconf.c:4342 addrconf_dad_work+0x7fb/0x14d0 net/ipv6/addrconf.c:4270 process_one_work+0x9c8/0x1ba0 kernel/workqueue.c:3229 page last free pid 53 tgid 53 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1108 [inline] free_unref_page+0x5f4/0xdc0 mm/page_alloc.c:2638 rcu_do_batch kernel/rcu/tree.c:2567 [inline] rcu_core+0x7a0/0x14d0 kernel/rcu/tree.c:2823 handle_softirqs+0x216/0x8f0 kernel/softirq.c:554 __do_softirq kernel/softirq.c:588 [inline] invoke_softirq kernel/softirq.c:428 [inline] __irq_exit_rcu kernel/softirq.c:637 [inline] irq_exit_rcu+0xbb/0x120 kernel/softirq.c:649 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1049 [inline] sysvec_apic_timer_interrupt+0xa4/0xc0 arch/x86/kernel/apic/apic.c:1049 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702 Memory state around the buggy address: ffff88807d608480: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc ffff88807d608500: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc >ffff88807d608580: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ^ ffff88807d608600: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ffff88807d608680: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ================================================================== ================================================================== BUG: KASAN: slab-use-after-free in cmd_status_rsp net/bluetooth/mgmt.c:1450 [inline] BUG: KASAN: slab-use-after-free in cmd_complete_rsp+0x1a9/0x1e0 net/bluetooth/mgmt.c:1470 Read of size 4 at addr ffff88807d608594 by task syz.3.96/6244 CPU: 0 UID: 0 PID: 6244 Comm: syz.3.96 Tainted: G B 6.12.0-rc4-syzkaller-00161-gae90f6a6170d #0 Tainted: [B]=BAD_PAGE Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 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:377 [inline] print_report+0xc3/0x620 mm/kasan/report.c:488 kasan_report+0xd9/0x110 mm/kasan/report.c:601 cmd_status_rsp net/bluetooth/mgmt.c:1450 [inline] cmd_complete_rsp+0x1a9/0x1e0 net/bluetooth/mgmt.c:1470 mgmt_pending_foreach+0xe2/0x140 net/bluetooth/mgmt_util.c:259 mgmt_index_removed+0x145/0x300 net/bluetooth/mgmt.c:9407 hci_sock_bind+0xc49/0x16f0 net/bluetooth/hci_sock.c:1307 __sys_bind_socket net/socket.c:1843 [inline] __sys_bind_socket net/socket.c:1835 [inline] __sys_bind+0x1ee/0x220 net/socket.c:1867 __do_sys_bind net/socket.c:1875 [inline] __se_sys_bind net/socket.c:1873 [inline] __x64_sys_bind+0x72/0xb0 net/socket.c:1873 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 RIP: 0033:0x7ff061f7e719 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ff062d6a038 EFLAGS: 00000246 ORIG_RAX: 0000000000000031 RAX: ffffffffffffffda RBX: 00007ff062135f80 RCX: 00007ff061f7e719 RDX: 0000000000000006 RSI: 0000000020000040 RDI: 0000000000000004 RBP: 00007ff061ff12be R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007ff062135f80 R15: 00007ffeecd43be8 Allocated by task 6241: 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:878 [inline] kzalloc_noprof include/linux/slab.h:1014 [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:5498 hci_mgmt_cmd net/bluetooth/hci_sock.c:1712 [inline] hci_sock_sendmsg+0x152b/0x25e0 net/bluetooth/hci_sock.c:1832 sock_sendmsg_nosec net/socket.c:729 [inline] __sock_sendmsg net/socket.c:744 [inline] sock_write_iter+0x501/0x5b0 net/socket.c:1165 new_sync_write fs/read_write.c:590 [inline] vfs_write+0x6b8/0x1140 fs/read_write.c:683 ksys_write+0x1fa/0x260 fs/read_write.c:736 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 6244: 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 mm/kasan/common.c:247 [inline] __kasan_slab_free+0x51/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:2342 [inline] slab_free mm/slub.c:4579 [inline] kfree+0x14f/0x4b0 mm/slub.c:4727 mgmt_remove_adv_monitor_complete+0x1b7/0x2e0 net/bluetooth/mgmt.c:5463 _hci_cmd_sync_cancel_entry.constprop.0+0x6f/0x1d0 net/bluetooth/hci_sync.c:641 hci_cmd_sync_dequeue+0x178/0x1f0 net/bluetooth/hci_sync.c:886 cmd_complete_rsp+0x46/0x1e0 net/bluetooth/mgmt.c:1461 mgmt_pending_foreach+0xe2/0x140 net/bluetooth/mgmt_util.c:259 mgmt_index_removed+0x145/0x300 net/bluetooth/mgmt.c:9407 hci_sock_bind+0xc49/0x16f0 net/bluetooth/hci_sock.c:1307 __sys_bind_socket net/socket.c:1843 [inline] __sys_bind_socket net/socket.c:1835 [inline] __sys_bind+0x1ee/0x220 net/socket.c:1867 __do_sys_bind net/socket.c:1875 [inline] __se_sys_bind net/socket.c:1873 [inline] __x64_sys_bind+0x72/0xb0 net/socket.c:1873 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 The buggy address belongs to the object at ffff88807d608580 which belongs to the cache kmalloc-96 of size 96 The buggy address is located 20 bytes inside of freed 96-byte region [ffff88807d608580, ffff88807d6085e0) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7d608 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000000 ffff88801b041280 ffffea0000bda2c0 dead000000000002 raw: 0000000000000000 0000000000200020 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 0x52820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 1858, tgid 1858 (kworker/u8:6), ts 99313441398, free_ts 99312586007 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1537 prep_new_page mm/page_alloc.c:1545 [inline] get_page_from_freelist+0x101e/0x3070 mm/page_alloc.c:3457 __alloc_pages_noprof+0x223/0x25a0 mm/page_alloc.c:4733 alloc_pages_mpol_noprof+0x2c9/0x610 mm/mempolicy.c:2265 alloc_slab_page mm/slub.c:2412 [inline] allocate_slab mm/slub.c:2578 [inline] new_slab+0x2ba/0x3f0 mm/slub.c:2631 ___slab_alloc+0xdac/0x1880 mm/slub.c:3818 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3908 __slab_alloc_node mm/slub.c:3961 [inline] slab_alloc_node mm/slub.c:4122 [inline] __kmalloc_cache_noprof+0x2b4/0x300 mm/slub.c:4290 kmalloc_noprof include/linux/slab.h:878 [inline] dst_cow_metrics_generic+0x4c/0x1e0 net/core/dst.c:185 dst_metrics_write_ptr include/net/dst.h:133 [inline] dst_metric_set include/net/dst.h:194 [inline] icmp6_dst_alloc+0x373/0x490 net/ipv6/route.c:3288 mld_sendpack+0x5a9/0x11d0 net/ipv6/mcast.c:1808 mld_send_initial_cr.part.0+0x1a1/0x260 net/ipv6/mcast.c:2237 mld_send_initial_cr include/linux/refcount.h:192 [inline] ipv6_mc_dad_complete+0x22c/0x2b0 net/ipv6/mcast.c:2245 addrconf_dad_completed+0xd40/0x1060 net/ipv6/addrconf.c:4342 addrconf_dad_work+0x7fb/0x14d0 net/ipv6/addrconf.c:4270 process_one_work+0x9c8/0x1ba0 kernel/workqueue.c:3229 page last free pid 53 tgid 53 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1108 [inline] free_unref_page+0x5f4/0xdc0 mm/page_alloc.c:2638 rcu_do_batch kernel/rcu/tree.c:2567 [inline] rcu_core+0x7a0/0x14d0 kernel/rcu/tree.c:2823 handle_softirqs+0x216/0x8f0 kernel/softirq.c:554 __do_softirq kernel/softirq.c:588 [inline] invoke_softirq kernel/softirq.c:428 [inline] __irq_exit_rcu kernel/softirq.c:637 [inline] irq_exit_rcu+0xbb/0x120 kernel/softirq.c:649 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1049 [inline] sysvec_apic_timer_interrupt+0xa4/0xc0 arch/x86/kernel/apic/apic.c:1049 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702 Memory state around the buggy address: ffff88807d608480: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc ffff88807d608500: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc >ffff88807d608580: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ^ ffff88807d608600: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ffff88807d608680: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ================================================================== ================================================================== BUG: KASAN: slab-use-after-free in cmd_status_rsp net/bluetooth/mgmt.c:1450 [inline] BUG: KASAN: slab-use-after-free in cmd_complete_rsp+0x1ce/0x1e0 net/bluetooth/mgmt.c:1470 Read of size 8 at addr ffff88807d6085a8 by task syz.3.96/6244 CPU: 0 UID: 0 PID: 6244 Comm: syz.3.96 Tainted: G B 6.12.0-rc4-syzkaller-00161-gae90f6a6170d #0 Tainted: [B]=BAD_PAGE Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 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:377 [inline] print_report+0xc3/0x620 mm/kasan/report.c:488 kasan_report+0xd9/0x110 mm/kasan/report.c:601 cmd_status_rsp net/bluetooth/mgmt.c:1450 [inline] cmd_complete_rsp+0x1ce/0x1e0 net/bluetooth/mgmt.c:1470 mgmt_pending_foreach+0xe2/0x140 net/bluetooth/mgmt_util.c:259 mgmt_index_removed+0x145/0x300 net/bluetooth/mgmt.c:9407 hci_sock_bind+0xc49/0x16f0 net/bluetooth/hci_sock.c:1307 __sys_bind_socket net/socket.c:1843 [inline] __sys_bind_socket net/socket.c:1835 [inline] __sys_bind+0x1ee/0x220 net/socket.c:1867 __do_sys_bind net/socket.c:1875 [inline] __se_sys_bind net/socket.c:1873 [inline] __x64_sys_bind+0x72/0xb0 net/socket.c:1873 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 RIP: 0033:0x7ff061f7e719 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ff062d6a038 EFLAGS: 00000246 ORIG_RAX: 0000000000000031 RAX: ffffffffffffffda RBX: 00007ff062135f80 RCX: 00007ff061f7e719 RDX: 0000000000000006 RSI: 0000000020000040 RDI: 0000000000000004 RBP: 00007ff061ff12be R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007ff062135f80 R15: 00007ffeecd43be8 Allocated by task 6241: 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:878 [inline] kzalloc_noprof include/linux/slab.h:1014 [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:5498 hci_mgmt_cmd net/bluetooth/hci_sock.c:1712 [inline] hci_sock_sendmsg+0x152b/0x25e0 net/bluetooth/hci_sock.c:1832 sock_sendmsg_nosec net/socket.c:729 [inline] __sock_sendmsg net/socket.c:744 [inline] sock_write_iter+0x501/0x5b0 net/socket.c:1165 new_sync_write fs/read_write.c:590 [inline] vfs_write+0x6b8/0x1140 fs/read_write.c:683 ksys_write+0x1fa/0x260 fs/read_write.c:736 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 6244: 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 mm/kasan/common.c:247 [inline] __kasan_slab_free+0x51/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:2342 [inline] slab_free mm/slub.c:4579 [inline] kfree+0x14f/0x4b0 mm/slub.c:4727 mgmt_remove_adv_monitor_complete+0x1b7/0x2e0 net/bluetooth/mgmt.c:5463 _hci_cmd_sync_cancel_entry.constprop.0+0x6f/0x1d0 net/bluetooth/hci_sync.c:641 hci_cmd_sync_dequeue+0x178/0x1f0 net/bluetooth/hci_sync.c:886 cmd_complete_rsp+0x46/0x1e0 net/bluetooth/mgmt.c:1461 mgmt_pending_foreach+0xe2/0x140 net/bluetooth/mgmt_util.c:259 mgmt_index_removed+0x145/0x300 net/bluetooth/mgmt.c:9407 hci_sock_bind+0xc49/0x16f0 net/bluetooth/hci_sock.c:1307 __sys_bind_socket net/socket.c:1843 [inline] __sys_bind_socket net/socket.c:1835 [inline] __sys_bind+0x1ee/0x220 net/socket.c:1867 __do_sys_bind net/socket.c:1875 [inline] __se_sys_bind net/socket.c:1873 [inline] __x64_sys_bind+0x72/0xb0 net/socket.c:1873 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 The buggy address belongs to the object at ffff88807d608580 which belongs to the cache kmalloc-96 of size 96 The buggy address is located 40 bytes inside of freed 96-byte region [ffff88807d608580, ffff88807d6085e0) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7d608 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000000 ffff88801b041280 ffffea0000bda2c0 dead000000000002 raw: 0000000000000000 0000000000200020 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 0x52820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 1858, tgid 1858 (kworker/u8:6), ts 99313441398, free_ts 99312586007 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1537 prep_new_page mm/page_alloc.c:1545 [inline] get_page_from_freelist+0x101e/0x3070 mm/page_alloc.c:3457 __alloc_pages_noprof+0x223/0x25a0 mm/page_alloc.c:4733 alloc_pages_mpol_noprof+0x2c9/0x610 mm/mempolicy.c:2265 alloc_slab_page mm/slub.c:2412 [inline] allocate_slab mm/slub.c:2578 [inline] new_slab+0x2ba/0x3f0 mm/slub.c:2631 ___slab_alloc+0xdac/0x1880 mm/slub.c:3818 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3908 __slab_alloc_node mm/slub.c:3961 [inline] slab_alloc_node mm/slub.c:4122 [inline] __kmalloc_cache_noprof+0x2b4/0x300 mm/slub.c:4290 kmalloc_noprof include/linux/slab.h:878 [inline] dst_cow_metrics_generic+0x4c/0x1e0 net/core/dst.c:185 dst_metrics_write_ptr include/net/dst.h:133 [inline] dst_metric_set include/net/dst.h:194 [inline] icmp6_dst_alloc+0x373/0x490 net/ipv6/route.c:3288 mld_sendpack+0x5a9/0x11d0 net/ipv6/mcast.c:1808 mld_send_initial_cr.part.0+0x1a1/0x260 net/ipv6/mcast.c:2237 mld_send_initial_cr include/linux/refcount.h:192 [inline] ipv6_mc_dad_complete+0x22c/0x2b0 net/ipv6/mcast.c:2245 addrconf_dad_completed+0xd40/0x1060 net/ipv6/addrconf.c:4342 addrconf_dad_work+0x7fb/0x14d0 net/ipv6/addrconf.c:4270 process_one_work+0x9c8/0x1ba0 kernel/workqueue.c:3229 page last free pid 53 tgid 53 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1108 [inline] free_unref_page+0x5f4/0xdc0 mm/page_alloc.c:2638 rcu_do_batch kernel/rcu/tree.c:2567 [inline] rcu_core+0x7a0/0x14d0 kernel/rcu/tree.c:2823 handle_softirqs+0x216/0x8f0 kernel/softirq.c:554 __do_softirq kernel/softirq.c:588 [inline] invoke_softirq kernel/softirq.c:428 [inline] __irq_exit_rcu kernel/softirq.c:637 [inline] irq_exit_rcu+0xbb/0x120 kernel/softirq.c:649 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1049 [inline] sysvec_apic_timer_interrupt+0xa4/0xc0 arch/x86/kernel/apic/apic.c:1049 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702 Memory state around the buggy address: ffff88807d608480: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc ffff88807d608500: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc >ffff88807d608580: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ^ ffff88807d608600: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ffff88807d608680: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ================================================================== ================================================================== BUG: KASAN: slab-use-after-free in hci_sock_get_cookie+0x42/0x50 net/bluetooth/hci_sock.c:96 Read of size 4 at addr ffff88805b57c5b8 by task syz.3.96/6244 CPU: 0 UID: 0 PID: 6244 Comm: syz.3.96 Tainted: G B 6.12.0-rc4-syzkaller-00161-gae90f6a6170d #0 Tainted: [B]=BAD_PAGE Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 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:377 [inline] print_report+0xc3/0x620 mm/kasan/report.c:488 kasan_report+0xd9/0x110 mm/kasan/report.c:601 hci_sock_get_cookie+0x42/0x50 net/bluetooth/hci_sock.c:96 mgmt_cmd_status+0x229/0x520 net/bluetooth/mgmt_util.c:149 cmd_status_rsp net/bluetooth/mgmt.c:1450 [inline] cmd_complete_rsp+0x165/0x1e0 net/bluetooth/mgmt.c:1470 mgmt_pending_foreach+0xe2/0x140 net/bluetooth/mgmt_util.c:259 mgmt_index_removed+0x145/0x300 net/bluetooth/mgmt.c:9407 hci_sock_bind+0xc49/0x16f0 net/bluetooth/hci_sock.c:1307 __sys_bind_socket net/socket.c:1843 [inline] __sys_bind_socket net/socket.c:1835 [inline] __sys_bind+0x1ee/0x220 net/socket.c:1867 __do_sys_bind net/socket.c:1875 [inline] __se_sys_bind net/socket.c:1873 [inline] __x64_sys_bind+0x72/0xb0 net/socket.c:1873 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 RIP: 0033:0x7ff061f7e719 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ff062d6a038 EFLAGS: 00000246 ORIG_RAX: 0000000000000031 RAX: ffffffffffffffda RBX: 00007ff062135f80 RCX: 00007ff061f7e719 RDX: 0000000000000006 RSI: 0000000020000040 RDI: 0000000000000004 RBP: 00007ff061ff12be R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007ff062135f80 R15: 00007ffeecd43be8 Allocated by task 6241: 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 kasan_kmalloc include/linux/kasan.h:257 [inline] __do_kmalloc_node mm/slub.c:4264 [inline] __kmalloc_noprof+0x1e8/0x400 mm/slub.c:4276 kmalloc_noprof include/linux/slab.h:882 [inline] sk_prot_alloc+0x1a8/0x2a0 net/core/sock.c:2164 sk_alloc+0x36/0xb90 net/core/sock.c:2217 bt_sock_alloc+0x3b/0x3a0 net/bluetooth/af_bluetooth.c:148 hci_sock_create+0xbc/0x1a0 net/bluetooth/hci_sock.c:2202 bt_sock_create+0x185/0x350 net/bluetooth/af_bluetooth.c:132 __sock_create+0x331/0x840 net/socket.c:1576 sock_create net/socket.c:1632 [inline] __sys_socket_create net/socket.c:1669 [inline] __sys_socket+0x14f/0x260 net/socket.c:1716 __do_sys_socket net/socket.c:1730 [inline] __se_sys_socket net/socket.c:1728 [inline] __x64_sys_socket+0x72/0xb0 net/socket.c:1728 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 6244: 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 mm/kasan/common.c:247 [inline] __kasan_slab_free+0x51/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:2342 [inline] slab_free mm/slub.c:4579 [inline] kfree+0x14f/0x4b0 mm/slub.c:4727 sk_prot_free net/core/sock.c:2200 [inline] __sk_destruct+0x5eb/0x720 net/core/sock.c:2292 sk_destruct+0xc2/0xf0 net/core/sock.c:2307 __sk_free+0xf4/0x3e0 net/core/sock.c:2318 sk_free+0x6a/0x90 net/core/sock.c:2329 sock_put include/net/sock.h:1888 [inline] mgmt_pending_free+0xc0/0xf0 net/bluetooth/mgmt_util.c:307 mgmt_remove_adv_monitor_complete+0x1b7/0x2e0 net/bluetooth/mgmt.c:5463 _hci_cmd_sync_cancel_entry.constprop.0+0x6f/0x1d0 net/bluetooth/hci_sync.c:641 hci_cmd_sync_dequeue+0x178/0x1f0 net/bluetooth/hci_sync.c:886 cmd_complete_rsp+0x46/0x1e0 net/bluetooth/mgmt.c:1461 mgmt_pending_foreach+0xe2/0x140 net/bluetooth/mgmt_util.c:259 mgmt_index_removed+0x145/0x300 net/bluetooth/mgmt.c:9407 hci_sock_bind+0xc49/0x16f0 net/bluetooth/hci_sock.c:1307 __sys_bind_socket net/socket.c:1843 [inline] __sys_bind_socket net/socket.c:1835 [inline] __sys_bind+0x1ee/0x220 net/socket.c:1867 __do_sys_bind net/socket.c:1875 [inline] __se_sys_bind net/socket.c:1873 [inline] __x64_sys_bind+0x72/0xb0 net/socket.c:1873 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 The buggy address belongs to the object at ffff88805b57c000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 1464 bytes inside of freed 2048-byte region [ffff88805b57c000, ffff88805b57c800) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5b578 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff88801b042000 0000000000000000 0000000000000001 raw: 0000000000000000 0000000000080008 00000001f5000000 0000000000000000 head: 00fff00000000040 ffff88801b042000 0000000000000000 0000000000000001 head: 0000000000000000 0000000000080008 00000001f5000000 0000000000000000 head: 00fff00000000003 ffffea00016d5e01 ffffffffffffffff 0000000000000000 head: 0000000000000008 0000000000000000 00000000ffffffff 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 5847, tgid 5847 (syz-executor), ts 92321174332, free_ts 31348293274 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1537 prep_new_page mm/page_alloc.c:1545 [inline] get_page_from_freelist+0x101e/0x3070 mm/page_alloc.c:3457 __alloc_pages_noprof+0x223/0x25a0 mm/page_alloc.c:4733 alloc_pages_mpol_noprof+0x2c9/0x610 mm/mempolicy.c:2265 alloc_slab_page mm/slub.c:2412 [inline] allocate_slab mm/slub.c:2578 [inline] new_slab+0x2ba/0x3f0 mm/slub.c:2631 ___slab_alloc+0xdac/0x1880 mm/slub.c:3818 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3908 __slab_alloc_node mm/slub.c:3961 [inline] slab_alloc_node mm/slub.c:4122 [inline] __kmalloc_cache_noprof+0x2b4/0x300 mm/slub.c:4290 kmalloc_noprof include/linux/slab.h:878 [inline] rtnl_newlink+0x49/0xa0 net/core/rtnetlink.c:3768 rtnetlink_rcv_msg+0x3ca/0xea0 net/core/rtnetlink.c:6675 netlink_rcv_skb+0x16e/0x440 net/netlink/af_netlink.c:2551 netlink_unicast_kernel net/netlink/af_netlink.c:1331 [inline] netlink_unicast+0x53f/0x7f0 net/netlink/af_netlink.c:1357 netlink_sendmsg+0x8b8/0xd70 net/netlink/af_netlink.c:1901 sock_sendmsg_nosec net/socket.c:729 [inline] __sock_sendmsg net/socket.c:744 [inline] __sys_sendto+0x47c/0x4d0 net/socket.c:2214 __do_sys_sendto net/socket.c:2226 [inline] __se_sys_sendto net/socket.c:2222 [inline] __x64_sys_sendto+0xe0/0x1c0 net/socket.c:2222 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 page last free pid 1 tgid 1 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1108 [inline] free_unref_page+0x5f4/0xdc0 mm/page_alloc.c:2638 free_contig_range+0x135/0x3f0 mm/page_alloc.c:6748 destroy_args+0xa27/0xe00 mm/debug_vm_pgtable.c:1017 debug_vm_pgtable+0x168e/0x31a0 mm/debug_vm_pgtable.c:1397 do_one_initcall+0x12b/0x700 init/main.c:1269 do_initcall_level init/main.c:1331 [inline] do_initcalls init/main.c:1347 [inline] do_basic_setup init/main.c:1366 [inline] kernel_init_freeable+0x5c7/0x900 init/main.c:1580 kernel_init+0x1c/0x2b0 init/main.c:1469 ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Memory state around the buggy address: ffff88805b57c480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88805b57c500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88805b57c580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88805b57c600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88805b57c680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ================================================================== BUG: KASAN: slab-use-after-free in sk_filter_trim_cap+0x9bd/0xac0 net/core/filter.c:156 Read of size 8 at addr ffff88805b57c178 by task syz.3.96/6244 CPU: 0 UID: 0 PID: 6244 Comm: syz.3.96 Tainted: G B 6.12.0-rc4-syzkaller-00161-gae90f6a6170d #0 Tainted: [B]=BAD_PAGE Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 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:377 [inline] print_report+0xc3/0x620 mm/kasan/report.c:488 kasan_report+0xd9/0x110 mm/kasan/report.c:601 sk_filter_trim_cap+0x9bd/0xac0 net/core/filter.c:156 sk_filter include/linux/filter.h:1062 [inline] sock_queue_rcv_skb_reason+0x30/0xe0 net/core/sock.c:522 sock_queue_rcv_skb include/net/sock.h:2380 [inline] mgmt_cmd_status+0x304/0x520 net/bluetooth/mgmt_util.c:156 cmd_status_rsp net/bluetooth/mgmt.c:1450 [inline] cmd_complete_rsp+0x165/0x1e0 net/bluetooth/mgmt.c:1470 mgmt_pending_foreach+0xe2/0x140 net/bluetooth/mgmt_util.c:259 mgmt_index_removed+0x145/0x300 net/bluetooth/mgmt.c:9407 hci_sock_bind+0xc49/0x16f0 net/bluetooth/hci_sock.c:1307 __sys_bind_socket net/socket.c:1843 [inline] __sys_bind_socket net/socket.c:1835 [inline] __sys_bind+0x1ee/0x220 net/socket.c:1867 __do_sys_bind net/socket.c:1875 [inline] __se_sys_bind net/socket.c:1873 [inline] __x64_sys_bind+0x72/0xb0 net/socket.c:1873 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 RIP: 0033:0x7ff061f7e719 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ff062d6a038 EFLAGS: 00000246 ORIG_RAX: 0000000000000031 RAX: ffffffffffffffda RBX: 00007ff062135f80 RCX: 00007ff061f7e719 RDX: 0000000000000006 RSI: 0000000020000040 RDI: 0000000000000004 RBP: 00007ff061ff12be R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007ff062135f80 R15: 00007ffeecd43be8 Allocated by task 6241: 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 kasan_kmalloc include/linux/kasan.h:257 [inline] __do_kmalloc_node mm/slub.c:4264 [inline] __kmalloc_noprof+0x1e8/0x400 mm/slub.c:4276 kmalloc_noprof include/linux/slab.h:882 [inline] sk_prot_alloc+0x1a8/0x2a0 net/core/sock.c:2164 sk_alloc+0x36/0xb90 net/core/sock.c:2217 bt_sock_alloc+0x3b/0x3a0 net/bluetooth/af_bluetooth.c:148 hci_sock_create+0xbc/0x1a0 net/bluetooth/hci_sock.c:2202 bt_sock_create+0x185/0x350 net/bluetooth/af_bluetooth.c:132 __sock_create+0x331/0x840 net/socket.c:1576 sock_create net/socket.c:1632 [inline] __sys_socket_create net/socket.c:1669 [inline] __sys_socket+0x14f/0x260 net/socket.c:1716 __do_sys_socket net/socket.c:1730 [inline] __se_sys_socket net/socket.c:1728 [inline] __x64_sys_socket+0x72/0xb0 net/socket.c:1728 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 6244: 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 mm/kasan/common.c:247 [inline] __kasan_slab_free+0x51/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:2342 [inline] slab_free mm/slub.c:4579 [inline] kfree+0x14f/0x4b0 mm/slub.c:4727 sk_prot_free net/core/sock.c:2200 [inline] __sk_destruct+0x5eb/0x720 net/core/sock.c:2292 sk_destruct+0xc2/0xf0 net/core/sock.c:2307 __sk_free+0xf4/0x3e0 net/core/sock.c:2318 sk_free+0x6a/0x90 net/core/sock.c:2329 sock_put include/net/sock.h:1888 [inline] mgmt_pending_free+0xc0/0xf0 net/bluetooth/mgmt_util.c:307 mgmt_remove_adv_monitor_complete+0x1b7/0x2e0 net/bluetooth/mgmt.c:5463 _hci_cmd_sync_cancel_entry.constprop.0+0x6f/0x1d0 net/bluetooth/hci_sync.c:641 hci_cmd_sync_dequeue+0x178/0x1f0 net/bluetooth/hci_sync.c:886 cmd_complete_rsp+0x46/0x1e0 net/bluetooth/mgmt.c:1461 mgmt_pending_foreach+0xe2/0x140 net/bluetooth/mgmt_util.c:259 mgmt_index_removed+0x145/0x300 net/bluetooth/mgmt.c:9407 hci_sock_bind+0xc49/0x16f0 net/bluetooth/hci_sock.c:1307 __sys_bind_socket net/socket.c:1843 [inline] __sys_bind_socket net/socket.c:1835 [inline] __sys_bind+0x1ee/0x220 net/socket.c:1867 __do_sys_bind net/socket.c:1875 [inline] __se_sys_bind net/socket.c:1873 [inline] __x64_sys_bind+0x72/0xb0 net/socket.c:1873 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 The buggy address belongs to the object at ffff88805b57c000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 376 bytes inside of freed 2048-byte region [ffff88805b57c000, ffff88805b57c800) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5b578 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff88801b042000 0000000000000000 0000000000000001 raw: 0000000000000000 0000000000080008 00000001f5000000 0000000000000000 head: 00fff00000000040 ffff88801b042000 0000000000000000 0000000000000001 head: 0000000000000000 0000000000080008 00000001f5000000 0000000000000000 head: 00fff00000000003 ffffea00016d5e01 ffffffffffffffff 0000000000000000 head: 0000000000000008 0000000000000000 00000000ffffffff 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 5847, tgid 5847 (syz-executor), ts 92321174332, free_ts 31348293274 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1537 prep_new_page mm/page_alloc.c:1545 [inline] get_page_from_freelist+0x101e/0x3070 mm/page_alloc.c:3457 __alloc_pages_noprof+0x223/0x25a0 mm/page_alloc.c:4733 alloc_pages_mpol_noprof+0x2c9/0x610 mm/mempolicy.c:2265 alloc_slab_page mm/slub.c:2412 [inline] allocate_slab mm/slub.c:2578 [inline] new_slab+0x2ba/0x3f0 mm/slub.c:2631 ___slab_alloc+0xdac/0x1880 mm/slub.c:3818 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3908 __slab_alloc_node mm/slub.c:3961 [inline] slab_alloc_node mm/slub.c:4122 [inline] __kmalloc_cache_noprof+0x2b4/0x300 mm/slub.c:4290 kmalloc_noprof include/linux/slab.h:878 [inline] rtnl_newlink+0x49/0xa0 net/core/rtnetlink.c:3768 rtnetlink_rcv_msg+0x3ca/0xea0 net/core/rtnetlink.c:6675 netlink_rcv_skb+0x16e/0x440 net/netlink/af_netlink.c:2551 netlink_unicast_kernel net/netlink/af_netlink.c:1331 [inline] netlink_unicast+0x53f/0x7f0 net/netlink/af_netlink.c:1357 netlink_sendmsg+0x8b8/0xd70 net/netlink/af_netlink.c:1901 sock_sendmsg_nosec net/socket.c:729 [inline] __sock_sendmsg net/socket.c:744 [inline] __sys_sendto+0x47c/0x4d0 net/socket.c:2214 __do_sys_sendto net/socket.c:2226 [inline] __se_sys_sendto net/socket.c:2222 [inline] __x64_sys_sendto+0xe0/0x1c0 net/socket.c:2222 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 page last free pid 1 tgid 1 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1108 [inline] free_unref_page+0x5f4/0xdc0 mm/page_alloc.c:2638 free_contig_range+0x135/0x3f0 mm/page_alloc.c:6748 destroy_args+0xa27/0xe00 mm/debug_vm_pgtable.c:1017 debug_vm_pgtable+0x168e/0x31a0 mm/debug_vm_pgtable.c:1397 do_one_initcall+0x12b/0x700 init/main.c:1269 do_initcall_level init/main.c:1331 [inline] do_initcalls init/main.c:1347 [inline] do_basic_setup init/main.c:1366 [inline] kernel_init_freeable+0x5c7/0x900 init/main.c:1580 kernel_init+0x1c/0x2b0 init/main.c:1469 ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Memory state around the buggy address: ffff88805b57c000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88805b57c080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88805b57c100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88805b57c180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88805b57c200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ================================================================== BUG: KASAN: slab-use-after-free in instrument_atomic_read include/linux/instrumented.h:68 [inline] BUG: KASAN: slab-use-after-free in atomic_read include/linux/atomic/atomic-instrumented.h:32 [inline] BUG: KASAN: slab-use-after-free in __sock_queue_rcv_skb+0x3c/0xa80 net/core/sock.c:486 Read of size 4 at addr ffff88805b57c140 by task syz.3.96/6244 CPU: 1 UID: 0 PID: 6244 Comm: syz.3.96 Tainted: G B 6.12.0-rc4-syzkaller-00161-gae90f6a6170d #0 Tainted: [B]=BAD_PAGE Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 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:377 [inline] print_report+0xc3/0x620 mm/kasan/report.c:488 kasan_report+0xd9/0x110 mm/kasan/report.c:601 check_region_inline mm/kasan/generic.c:183 [inline] kasan_check_range+0xef/0x1a0 mm/kasan/generic.c:189 instrument_atomic_read include/linux/instrumented.h:68 [inline] atomic_read include/linux/atomic/atomic-instrumented.h:32 [inline] __sock_queue_rcv_skb+0x3c/0xa80 net/core/sock.c:486 sock_queue_rcv_skb_reason+0xa2/0xe0 net/core/sock.c:527 sock_queue_rcv_skb include/net/sock.h:2380 [inline] mgmt_cmd_status+0x304/0x520 net/bluetooth/mgmt_util.c:156 cmd_status_rsp net/bluetooth/mgmt.c:1450 [inline] cmd_complete_rsp+0x165/0x1e0 net/bluetooth/mgmt.c:1470 mgmt_pending_foreach+0xe2/0x140 net/bluetooth/mgmt_util.c:259 mgmt_index_removed+0x145/0x300 net/bluetooth/mgmt.c:9407 hci_sock_bind+0xc49/0x16f0 net/bluetooth/hci_sock.c:1307 __sys_bind_socket net/socket.c:1843 [inline] __sys_bind_socket net/socket.c:1835 [inline] __sys_bind+0x1ee/0x220 net/socket.c:1867 __do_sys_bind net/socket.c:1875 [inline] __se_sys_bind net/socket.c:1873 [inline] __x64_sys_bind+0x72/0xb0 net/socket.c:1873 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 RIP: 0033:0x7ff061f7e719 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ff062d6a038 EFLAGS: 00000246 ORIG_RAX: 0000000000000031 RAX: ffffffffffffffda RBX: 00007ff062135f80 RCX: 00007ff061f7e719 RDX: 0000000000000006 RSI: 0000000020000040 RDI: 0000000000000004 RBP: 00007ff061ff12be R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007ff062135f80 R15: 00007ffeecd43be8 Allocated by task 6241: 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 kasan_kmalloc include/linux/kasan.h:257 [inline] __do_kmalloc_node mm/slub.c:4264 [inline] __kmalloc_noprof+0x1e8/0x400 mm/slub.c:4276 kmalloc_noprof include/linux/slab.h:882 [inline] sk_prot_alloc+0x1a8/0x2a0 net/core/sock.c:2164 sk_alloc+0x36/0xb90 net/core/sock.c:2217 bt_sock_alloc+0x3b/0x3a0 net/bluetooth/af_bluetooth.c:148 hci_sock_create+0xbc/0x1a0 net/bluetooth/hci_sock.c:2202 bt_sock_create+0x185/0x350 net/bluetooth/af_bluetooth.c:132 __sock_create+0x331/0x840 net/socket.c:1576 sock_create net/socket.c:1632 [inline] __sys_socket_create net/socket.c:1669 [inline] __sys_socket+0x14f/0x260 net/socket.c:1716 __do_sys_socket net/socket.c:1730 [inline] __se_sys_socket net/socket.c:1728 [inline] __x64_sys_socket+0x72/0xb0 net/socket.c:1728 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 6244: 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 mm/kasan/common.c:247 [inline] __kasan_slab_free+0x51/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:2342 [inline] slab_free mm/slub.c:4579 [inline] kfree+0x14f/0x4b0 mm/slub.c:4727 sk_prot_free net/core/sock.c:2200 [inline] __sk_destruct+0x5eb/0x720 net/core/sock.c:2292 sk_destruct+0xc2/0xf0 net/core/sock.c:2307 __sk_free+0xf4/0x3e0 net/core/sock.c:2318 sk_free+0x6a/0x90 net/core/sock.c:2329 sock_put include/net/sock.h:1888 [inline] mgmt_pending_free+0xc0/0xf0 net/bluetooth/mgmt_util.c:307 mgmt_remove_adv_monitor_complete+0x1b7/0x2e0 net/bluetooth/mgmt.c:5463 _hci_cmd_sync_cancel_entry.constprop.0+0x6f/0x1d0 net/bluetooth/hci_sync.c:641 hci_cmd_sync_dequeue+0x178/0x1f0 net/bluetooth/hci_sync.c:886 cmd_complete_rsp+0x46/0x1e0 net/bluetooth/mgmt.c:1461 mgmt_pending_foreach+0xe2/0x140 net/bluetooth/mgmt_util.c:259 mgmt_index_removed+0x145/0x300 net/bluetooth/mgmt.c:9407 hci_sock_bind+0xc49/0x16f0 net/bluetooth/hci_sock.c:1307 __sys_bind_socket net/socket.c:1843 [inline] __sys_bind_socket net/socket.c:1835 [inline] __sys_bind+0x1ee/0x220 net/socket.c:1867 __do_sys_bind net/socket.c:1875 [inline] __se_sys_bind net/socket.c:1873 [inline] __x64_sys_bind+0x72/0xb0 net/socket.c:1873 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 The buggy address belongs to the object at ffff88805b57c000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 320 bytes inside of freed 2048-byte region [ffff88805b57c000, ffff88805b57c800) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5b578 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff88801b042000 0000000000000000 0000000000000001 raw: 0000000000000000 0000000000080008 00000001f5000000 0000000000000000 head: 00fff00000000040 ffff88801b042000 0000000000000000 0000000000000001 head: 0000000000000000 0000000000080008 00000001f5000000 0000000000000000 head: 00fff00000000003 ffffea00016d5e01 ffffffffffffffff 0000000000000000 head: 0000000000000008 0000000000000000 00000000ffffffff 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 5847, tgid 5847 (syz-executor), ts 92321174332, free_ts 31348293274 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1537 prep_new_page mm/page_alloc.c:1545 [inline] get_page_from_freelist+0x101e/0x3070 mm/page_alloc.c:3457 __alloc_pages_noprof+0x223/0x25a0 mm/page_alloc.c:4733 alloc_pages_mpol_noprof+0x2c9/0x610 mm/mempolicy.c:2265 alloc_slab_page mm/slub.c:2412 [inline] allocate_slab mm/slub.c:2578 [inline] new_slab+0x2ba/0x3f0 mm/slub.c:2631 ___slab_alloc+0xdac/0x1880 mm/slub.c:3818 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3908 __slab_alloc_node mm/slub.c:3961 [inline] slab_alloc_node mm/slub.c:4122 [inline] __kmalloc_cache_noprof+0x2b4/0x300 mm/slub.c:4290 kmalloc_noprof include/linux/slab.h:878 [inline] rtnl_newlink+0x49/0xa0 net/core/rtnetlink.c:3768 rtnetlink_rcv_msg+0x3ca/0xea0 net/core/rtnetlink.c:6675 netlink_rcv_skb+0x16e/0x440 net/netlink/af_netlink.c:2551 netlink_unicast_kernel net/netlink/af_netlink.c:1331 [inline] netlink_unicast+0x53f/0x7f0 net/netlink/af_netlink.c:1357 netlink_sendmsg+0x8b8/0xd70 net/netlink/af_netlink.c:1901 sock_sendmsg_nosec net/socket.c:729 [inline] __sock_sendmsg net/socket.c:744 [inline] __sys_sendto+0x47c/0x4d0 net/socket.c:2214 __do_sys_sendto net/socket.c:2226 [inline] __se_sys_sendto net/socket.c:2222 [inline] __x64_sys_sendto+0xe0/0x1c0 net/socket.c:2222 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 page last free pid 1 tgid 1 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1108 [inline] free_unref_page+0x5f4/0xdc0 mm/page_alloc.c:2638 free_contig_range+0x135/0x3f0 mm/page_alloc.c:6748 destroy_args+0xa27/0xe00 mm/debug_vm_pgtable.c:1017 debug_vm_pgtable+0x168e/0x31a0 mm/debug_vm_pgtable.c:1397 do_one_initcall+0x12b/0x700 init/main.c:1269 do_initcall_level init/main.c:1331 [inline] do_initcalls init/main.c:1347 [inline] do_basic_setup init/main.c:1366 [inline] kernel_init_freeable+0x5c7/0x900 init/main.c:1580 kernel_init+0x1c/0x2b0 init/main.c:1469 ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Memory state around the buggy address: ffff88805b57c000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88805b57c080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88805b57c100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88805b57c180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88805b57c200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ================================================================== BUG: KASAN: slab-use-after-free in arch_atomic_read arch/x86/include/asm/atomic.h:23 [inline] BUG: KASAN: slab-use-after-free in raw_atomic_read include/linux/atomic/atomic-arch-fallback.h:457 [inline] BUG: KASAN: slab-use-after-free in atomic_read include/linux/atomic/atomic-instrumented.h:33 [inline] BUG: KASAN: slab-use-after-free in __sock_queue_rcv_skb+0x730/0xa80 net/core/sock.c:486 Read of size 4 at addr ffff88805b57c140 by task syz.3.96/6244 CPU: 0 UID: 0 PID: 6244 Comm: syz.3.96 Tainted: G B 6.12.0-rc4-syzkaller-00161-gae90f6a6170d #0 Tainted: [B]=BAD_PAGE Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 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:377 [inline] print_report+0xc3/0x620 mm/kasan/report.c:488 kasan_report+0xd9/0x110 mm/kasan/report.c:601 arch_atomic_read arch/x86/include/asm/atomic.h:23 [inline] raw_atomic_read include/linux/atomic/atomic-arch-fallback.h:457 [inline] atomic_read include/linux/atomic/atomic-instrumented.h:33 [inline] __sock_queue_rcv_skb+0x730/0xa80 net/core/sock.c:486 sock_queue_rcv_skb_reason+0xa2/0xe0 net/core/sock.c:527 sock_queue_rcv_skb include/net/sock.h:2380 [inline] mgmt_cmd_status+0x304/0x520 net/bluetooth/mgmt_util.c:156 cmd_status_rsp net/bluetooth/mgmt.c:1450 [inline] cmd_complete_rsp+0x165/0x1e0 net/bluetooth/mgmt.c:1470 mgmt_pending_foreach+0xe2/0x140 net/bluetooth/mgmt_util.c:259 mgmt_index_removed+0x145/0x300 net/bluetooth/mgmt.c:9407 hci_sock_bind+0xc49/0x16f0 net/bluetooth/hci_sock.c:1307 __sys_bind_socket net/socket.c:1843 [inline] __sys_bind_socket net/socket.c:1835 [inline] __sys_bind+0x1ee/0x220 net/socket.c:1867 __do_sys_bind net/socket.c:1875 [inline] __se_sys_bind net/socket.c:1873 [inline] __x64_sys_bind+0x72/0xb0 net/socket.c:1873 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 RIP: 0033:0x7ff061f7e719 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ff062d6a038 EFLAGS: 00000246 ORIG_RAX: 0000000000000031 RAX: ffffffffffffffda RBX: 00007ff062135f80 RCX: 00007ff061f7e719 RDX: 0000000000000006 RSI: 0000000020000040 RDI: 0000000000000004 RBP: 00007ff061ff12be R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007ff062135f80 R15: 00007ffeecd43be8 Allocated by task 6241: 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 kasan_kmalloc include/linux/kasan.h:257 [inline] __do_kmalloc_node mm/slub.c:4264 [inline] __kmalloc_noprof+0x1e8/0x400 mm/slub.c:4276 kmalloc_noprof include/linux/slab.h:882 [inline] sk_prot_alloc+0x1a8/0x2a0 net/core/sock.c:2164 sk_alloc+0x36/0xb90 net/core/sock.c:2217 bt_sock_alloc+0x3b/0x3a0 net/bluetooth/af_bluetooth.c:148 hci_sock_create+0xbc/0x1a0 net/bluetooth/hci_sock.c:2202 bt_sock_create+0x185/0x350 net/bluetooth/af_bluetooth.c:132 __sock_create+0x331/0x840 net/socket.c:1576 sock_create net/socket.c:1632 [inline] __sys_socket_create net/socket.c:1669 [inline] __sys_socket+0x14f/0x260 net/socket.c:1716 __do_sys_socket net/socket.c:1730 [inline] __se_sys_socket net/socket.c:1728 [inline] __x64_sys_socket+0x72/0xb0 net/socket.c:1728 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 6244: 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 mm/kasan/common.c:247 [inline] __kasan_slab_free+0x51/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:2342 [inline] slab_free mm/slub.c:4579 [inline] kfree+0x14f/0x4b0 mm/slub.c:4727 sk_prot_free net/core/sock.c:2200 [inline] __sk_destruct+0x5eb/0x720 net/core/sock.c:2292 sk_destruct+0xc2/0xf0 net/core/sock.c:2307 __sk_free+0xf4/0x3e0 net/core/sock.c:2318 sk_free+0x6a/0x90 net/core/sock.c:2329 sock_put include/net/sock.h:1888 [inline] mgmt_pending_free+0xc0/0xf0 net/bluetooth/mgmt_util.c:307 mgmt_remove_adv_monitor_complete+0x1b7/0x2e0 net/bluetooth/mgmt.c:5463 _hci_cmd_sync_cancel_entry.constprop.0+0x6f/0x1d0 net/bluetooth/hci_sync.c:641 hci_cmd_sync_dequeue+0x178/0x1f0 net/bluetooth/hci_sync.c:886 cmd_complete_rsp+0x46/0x1e0 net/bluetooth/mgmt.c:1461 mgmt_pending_foreach+0xe2/0x140 net/bluetooth/mgmt_util.c:259 mgmt_index_removed+0x145/0x300 net/bluetooth/mgmt.c:9407 hci_sock_bind+0xc49/0x16f0 net/bluetooth/hci_sock.c:1307 __sys_bind_socket net/socket.c:1843 [inline] __sys_bind_socket net/socket.c:1835 [inline] __sys_bind+0x1ee/0x220 net/socket.c:1867 __do_sys_bind net/socket.c:1875 [inline] __se_sys_bind net/socket.c:1873 [inline] __x64_sys_bind+0x72/0xb0 net/socket.c:1873 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 The buggy address belongs to the object at ffff88805b57c000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 320 bytes inside of freed 2048-byte region [ffff88805b57c000, ffff88805b57c800) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5b578 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff88801b042000 0000000000000000 0000000000000001 raw: 0000000000000000 0000000000080008 00000001f5000000 0000000000000000 head: 00fff00000000040 ffff88801b042000 0000000000000000 0000000000000001 head: 0000000000000000 0000000000080008 00000001f5000000 0000000000000000 head: 00fff00000000003 ffffea00016d5e01 ffffffffffffffff 0000000000000000 head: 0000000000000008 0000000000000000 00000000ffffffff 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 5847, tgid 5847 (syz-executor), ts 92321174332, free_ts 31348293274 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1537 prep_new_page mm/page_alloc.c:1545 [inline] get_page_from_freelist+0x101e/0x3070 mm/page_alloc.c:3457 __alloc_pages_noprof+0x223/0x25a0 mm/page_alloc.c:4733 alloc_pages_mpol_noprof+0x2c9/0x610 mm/mempolicy.c:2265 alloc_slab_page mm/slub.c:2412 [inline] allocate_slab mm/slub.c:2578 [inline] new_slab+0x2ba/0x3f0 mm/slub.c:2631 ___slab_alloc+0xdac/0x1880 mm/slub.c:3818 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3908 __slab_alloc_node mm/slub.c:3961 [inline] slab_alloc_node mm/slub.c:4122 [inline] __kmalloc_cache_noprof+0x2b4/0x300 mm/slub.c:4290 kmalloc_noprof include/linux/slab.h:878 [inline] rtnl_newlink+0x49/0xa0 net/core/rtnetlink.c:3768 rtnetlink_rcv_msg+0x3ca/0xea0 net/core/rtnetlink.c:6675 netlink_rcv_skb+0x16e/0x440 net/netlink/af_netlink.c:2551 netlink_unicast_kernel net/netlink/af_netlink.c:1331 [inline] netlink_unicast+0x53f/0x7f0 net/netlink/af_netlink.c:1357 netlink_sendmsg+0x8b8/0xd70 net/netlink/af_netlink.c:1901 sock_sendmsg_nosec net/socket.c:729 [inline] __sock_sendmsg net/socket.c:744 [inline] __sys_sendto+0x47c/0x4d0 net/socket.c:2214 __do_sys_sendto net/socket.c:2226 [inline] __se_sys_sendto net/socket.c:2222 [inline] __x64_sys_sendto+0xe0/0x1c0 net/socket.c:2222 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 page last free pid 1 tgid 1 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1108 [inline] free_unref_page+0x5f4/0xdc0 mm/page_alloc.c:2638 free_contig_range+0x135/0x3f0 mm/page_alloc.c:6748 destroy_args+0xa27/0xe00 mm/debug_vm_pgtable.c:1017 debug_vm_pgtable+0x168e/0x31a0 mm/debug_vm_pgtable.c:1397 do_one_initcall+0x12b/0x700 init/main.c:1269 do_initcall_level init/main.c:1331 [inline] do_initcalls init/main.c:1347 [inline] do_basic_setup init/main.c:1366 [inline] kernel_init_freeable+0x5c7/0x900 init/main.c:1580 kernel_init+0x1c/0x2b0 init/main.c:1469 ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Memory state around the buggy address: ffff88805b57c000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88805b57c080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88805b57c100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88805b57c180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88805b57c200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ================================================================== BUG: KASAN: slab-use-after-free in __sock_queue_rcv_skb+0x73a/0xa80 net/core/sock.c:486 Read of size 4 at addr ffff88805b57c174 by task syz.3.96/6244 CPU: 0 UID: 0 PID: 6244 Comm: syz.3.96 Tainted: G B 6.12.0-rc4-syzkaller-00161-gae90f6a6170d #0 Tainted: [B]=BAD_PAGE Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 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:377 [inline] print_report+0xc3/0x620 mm/kasan/report.c:488 kasan_report+0xd9/0x110 mm/kasan/report.c:601 __sock_queue_rcv_skb+0x73a/0xa80 net/core/sock.c:486 sock_queue_rcv_skb_reason+0xa2/0xe0 net/core/sock.c:527 sock_queue_rcv_skb include/net/sock.h:2380 [inline] mgmt_cmd_status+0x304/0x520 net/bluetooth/mgmt_util.c:156 cmd_status_rsp net/bluetooth/mgmt.c:1450 [inline] cmd_complete_rsp+0x165/0x1e0 net/bluetooth/mgmt.c:1470 mgmt_pending_foreach+0xe2/0x140 net/bluetooth/mgmt_util.c:259 mgmt_index_removed+0x145/0x300 net/bluetooth/mgmt.c:9407 hci_sock_bind+0xc49/0x16f0 net/bluetooth/hci_sock.c:1307 __sys_bind_socket net/socket.c:1843 [inline] __sys_bind_socket net/socket.c:1835 [inline] __sys_bind+0x1ee/0x220 net/socket.c:1867 __do_sys_bind net/socket.c:1875 [inline] __se_sys_bind net/socket.c:1873 [inline] __x64_sys_bind+0x72/0xb0 net/socket.c:1873 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 RIP: 0033:0x7ff061f7e719 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ff062d6a038 EFLAGS: 00000246 ORIG_RAX: 0000000000000031 RAX: ffffffffffffffda RBX: 00007ff062135f80 RCX: 00007ff061f7e719 RDX: 0000000000000006 RSI: 0000000020000040 RDI: 0000000000000004 RBP: 00007ff061ff12be R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007ff062135f80 R15: 00007ffeecd43be8 Allocated by task 6241: 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 kasan_kmalloc include/linux/kasan.h:257 [inline] __do_kmalloc_node mm/slub.c:4264 [inline] __kmalloc_noprof+0x1e8/0x400 mm/slub.c:4276 kmalloc_noprof include/linux/slab.h:882 [inline] sk_prot_alloc+0x1a8/0x2a0 net/core/sock.c:2164 sk_alloc+0x36/0xb90 net/core/sock.c:2217 bt_sock_alloc+0x3b/0x3a0 net/bluetooth/af_bluetooth.c:148 hci_sock_create+0xbc/0x1a0 net/bluetooth/hci_sock.c:2202 bt_sock_create+0x185/0x350 net/bluetooth/af_bluetooth.c:132 __sock_create+0x331/0x840 net/socket.c:1576 sock_create net/socket.c:1632 [inline] __sys_socket_create net/socket.c:1669 [inline] __sys_socket+0x14f/0x260 net/socket.c:1716 __do_sys_socket net/socket.c:1730 [inline] __se_sys_socket net/socket.c:1728 [inline] __x64_sys_socket+0x72/0xb0 net/socket.c:1728 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 6244: 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 mm/kasan/common.c:247 [inline] __kasan_slab_free+0x51/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:2342 [inline] slab_free mm/slub.c:4579 [inline] kfree+0x14f/0x4b0 mm/slub.c:4727 sk_prot_free net/core/sock.c:2200 [inline] __sk_destruct+0x5eb/0x720 net/core/sock.c:2292 sk_destruct+0xc2/0xf0 net/core/sock.c:2307 __sk_free+0xf4/0x3e0 net/core/sock.c:2318 sk_free+0x6a/0x90 net/core/sock.c:2329 sock_put include/net/sock.h:1888 [inline] mgmt_pending_free+0xc0/0xf0 net/bluetooth/mgmt_util.c:307 mgmt_remove_adv_monitor_complete+0x1b7/0x2e0 net/bluetooth/mgmt.c:5463 _hci_cmd_sync_cancel_entry.constprop.0+0x6f/0x1d0 net/bluetooth/hci_sync.c:641 hci_cmd_sync_dequeue+0x178/0x1f0 net/bluetooth/hci_sync.c:886 cmd_complete_rsp+0x46/0x1e0 net/bluetooth/mgmt.c:1461 mgmt_pending_foreach+0xe2/0x140 net/bluetooth/mgmt_util.c:259 mgmt_index_removed+0x145/0x300 net/bluetooth/mgmt.c:9407 hci_sock_bind+0xc49/0x16f0 net/bluetooth/hci_sock.c:1307 __sys_bind_socket net/socket.c:1843 [inline] __sys_bind_socket net/socket.c:1835 [inline] __sys_bind+0x1ee/0x220 net/socket.c:1867 __do_sys_bind net/socket.c:1875 [inline] __se_sys_bind net/socket.c:1873 [inline] __x64_sys_bind+0x72/0xb0 net/socket.c:1873 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 The buggy address belongs to the object at ffff88805b57c000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 372 bytes inside of freed 2048-byte region [ffff88805b57c000, ffff88805b57c800) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5b578 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff88801b042000 0000000000000000 0000000000000001 raw: 0000000000000000 0000000000080008 00000001f5000000 0000000000000000 head: 00fff00000000040 ffff88801b042000 0000000000000000 0000000000000001 head: 0000000000000000 0000000000080008 00000001f5000000 0000000000000000 head: 00fff00000000003 ffffea00016d5e01 ffffffffffffffff 0000000000000000 head: 0000000000000008 0000000000000000 00000000ffffffff 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 5847, tgid 5847 (syz-executor), ts 92321174332, free_ts 31348293274 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1537 prep_new_page mm/page_alloc.c:1545 [inline] get_page_from_freelist+0x101e/0x3070 mm/page_alloc.c:3457 __alloc_pages_noprof+0x223/0x25a0 mm/page_alloc.c:4733 alloc_pages_mpol_noprof+0x2c9/0x610 mm/mempolicy.c:2265 alloc_slab_page mm/slub.c:2412 [inline] allocate_slab mm/slub.c:2578 [inline] new_slab+0x2ba/0x3f0 mm/slub.c:2631 ___slab_alloc+0xdac/0x1880 mm/slub.c:3818 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3908 __slab_alloc_node mm/slub.c:3961 [inline] slab_alloc_node mm/slub.c:4122 [inline] __kmalloc_cache_noprof+0x2b4/0x300 mm/slub.c:4290 kmalloc_noprof include/linux/slab.h:878 [inline] rtnl_newlink+0x49/0xa0 net/core/rtnetlink.c:3768 rtnetlink_rcv_msg+0x3ca/0xea0 net/core/rtnetlink.c:6675 netlink_rcv_skb+0x16e/0x440 net/netlink/af_netlink.c:2551 netlink_unicast_kernel net/netlink/af_netlink.c:1331 [inline] netlink_unicast+0x53f/0x7f0 net/netlink/af_netlink.c:1357 netlink_sendmsg+0x8b8/0xd70 net/netlink/af_netlink.c:1901 sock_sendmsg_nosec net/socket.c:729 [inline] __sock_sendmsg net/socket.c:744 [inline] __sys_sendto+0x47c/0x4d0 net/socket.c:2214 __do_sys_sendto net/socket.c:2226 [inline] __se_sys_sendto net/socket.c:2222 [inline] __x64_sys_sendto+0xe0/0x1c0 net/socket.c:2222 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 page last free pid 1 tgid 1 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1108 [inline] free_unref_page+0x5f4/0xdc0 mm/page_alloc.c:2638 free_contig_range+0x135/0x3f0 mm/page_alloc.c:6748 destroy_args+0xa27/0xe00 mm/debug_vm_pgtable.c:1017 debug_vm_pgtable+0x168e/0x31a0 mm/debug_vm_pgtable.c:1397 do_one_initcall+0x12b/0x700 init/main.c:1269 do_initcall_level init/main.c:1331 [inline] do_initcalls init/main.c:1347 [inline] do_basic_setup init/main.c:1366 [inline] kernel_init_freeable+0x5c7/0x900 init/main.c:1580 kernel_init+0x1c/0x2b0 init/main.c:1469 ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Memory state around the buggy address: ffff88805b57c000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88805b57c080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88805b57c100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88805b57c180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88805b57c200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ================================================================== BUG: KASAN: slab-use-after-free in sk_has_account include/net/sock.h:1510 [inline] BUG: KASAN: slab-use-after-free in sk_rmem_schedule include/net/sock.h:1528 [inline] BUG: KASAN: slab-use-after-free in __sock_queue_rcv_skb+0x9ec/0xa80 net/core/sock.c:492 Read of size 8 at addr ffff88805b57c028 by task syz.3.96/6244 CPU: 0 UID: 0 PID: 6244 Comm: syz.3.96 Tainted: G B 6.12.0-rc4-syzkaller-00161-gae90f6a6170d #0 Tainted: [B]=BAD_PAGE Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 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:377 [inline] print_report+0xc3/0x620 mm/kasan/report.c:488 kasan_report+0xd9/0x110 mm/kasan/report.c:601 sk_has_account include/net/sock.h:1510 [inline] sk_rmem_schedule include/net/sock.h:1528 [inline] __sock_queue_rcv_skb+0x9ec/0xa80 net/core/sock.c:492 sock_queue_rcv_skb_reason+0xa2/0xe0 net/core/sock.c:527 sock_queue_rcv_skb include/net/sock.h:2380 [inline] mgmt_cmd_status+0x304/0x520 net/bluetooth/mgmt_util.c:156 cmd_status_rsp net/bluetooth/mgmt.c:1450 [inline] cmd_complete_rsp+0x165/0x1e0 net/bluetooth/mgmt.c:1470 mgmt_pending_foreach+0xe2/0x140 net/bluetooth/mgmt_util.c:259 mgmt_index_removed+0x145/0x300 net/bluetooth/mgmt.c:9407 hci_sock_bind+0xc49/0x16f0 net/bluetooth/hci_sock.c:1307 __sys_bind_socket net/socket.c:1843 [inline] __sys_bind_socket net/socket.c:1835 [inline] __sys_bind+0x1ee/0x220 net/socket.c:1867 __do_sys_bind net/socket.c:1875 [inline] __se_sys_bind net/socket.c:1873 [inline] __x64_sys_bind+0x72/0xb0 net/socket.c:1873 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 RIP: 0033:0x7ff061f7e719 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ff062d6a038 EFLAGS: 00000246 ORIG_RAX: 0000000000000031 RAX: ffffffffffffffda RBX: 00007ff062135f80 RCX: 00007ff061f7e719 RDX: 0000000000000006 RSI: 0000000020000040 RDI: 0000000000000004 RBP: 00007ff061ff12be R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007ff062135f80 R15: 00007ffeecd43be8 Allocated by task 6241: 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 kasan_kmalloc include/linux/kasan.h:257 [inline] __do_kmalloc_node mm/slub.c:4264 [inline] __kmalloc_noprof+0x1e8/0x400 mm/slub.c:4276 kmalloc_noprof include/linux/slab.h:882 [inline] sk_prot_alloc+0x1a8/0x2a0 net/core/sock.c:2164 sk_alloc+0x36/0xb90 net/core/sock.c:2217 bt_sock_alloc+0x3b/0x3a0 net/bluetooth/af_bluetooth.c:148 hci_sock_create+0xbc/0x1a0 net/bluetooth/hci_sock.c:2202 bt_sock_create+0x185/0x350 net/bluetooth/af_bluetooth.c:132 __sock_create+0x331/0x840 net/socket.c:1576 sock_create net/socket.c:1632 [inline] __sys_socket_create net/socket.c:1669 [inline] __sys_socket+0x14f/0x260 net/socket.c:1716 __do_sys_socket net/socket.c:1730 [inline] __se_sys_socket net/socket.c:1728 [inline] __x64_sys_socket+0x72/0xb0 net/socket.c:1728 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 6244: 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 mm/kasan/common.c:247 [inline] __kasan_slab_free+0x51/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:2342 [inline] slab_free mm/slub.c:4579 [inline] kfree+0x14f/0x4b0 mm/slub.c:4727 sk_prot_free net/core/sock.c:2200 [inline] __sk_destruct+0x5eb/0x720 net/core/sock.c:2292 sk_destruct+0xc2/0xf0 net/core/sock.c:2307 __sk_free+0xf4/0x3e0 net/core/sock.c:2318 sk_free+0x6a/0x90 net/core/sock.c:2329 sock_put include/net/sock.h:1888 [inline] mgmt_pending_free+0xc0/0xf0 net/bluetooth/mgmt_util.c:307 mgmt_remove_adv_monitor_complete+0x1b7/0x2e0 net/bluetooth/mgmt.c:5463 _hci_cmd_sync_cancel_entry.constprop.0+0x6f/0x1d0 net/bluetooth/hci_sync.c:641 hci_cmd_sync_dequeue+0x178/0x1f0 net/bluetooth/hci_sync.c:886 cmd_complete_rsp+0x46/0x1e0 net/bluetooth/mgmt.c:1461 mgmt_pending_foreach+0xe2/0x140 net/bluetooth/mgmt_util.c:259 mgmt_index_removed+0x145/0x300 net/bluetooth/mgmt.c:9407 hci_sock_bind+0xc49/0x16f0 net/bluetooth/hci_sock.c:1307 __sys_bind_socket net/socket.c:1843 [inline] __sys_bind_socket net/socket.c:1835 [inline] __sys_bind+0x1ee/0x220 net/socket.c:1867 __do_sys_bind net/socket.c:1875 [inline] __se_sys_bind net/socket.c:1873 [inline] __x64_sys_bind+0x72/0xb0 net/socket.c:1873 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 The buggy address belongs to the object at ffff88805b57c000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 40 bytes inside of freed 2048-byte region [ffff88805b57c000, ffff88805b57c800) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5b578 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff88801b042000 0000000000000000 0000000000000001 raw: 0000000000000000 0000000000080008 00000001f5000000 0000000000000000 head: 00fff00000000040 ffff88801b042000 0000000000000000 0000000000000001 head: 0000000000000000 0000000000080008 00000001f5000000 0000000000000000 head: 00fff00000000003 ffffea00016d5e01 ffffffffffffffff 0000000000000000 head: 0000000000000008 0000000000000000 00000000ffffffff 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 5847, tgid 5847 (syz-executor), ts 92321174332, free_ts 31348293274 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1537 prep_new_page mm/page_alloc.c:1545 [inline] get_page_from_freelist+0x101e/0x3070 mm/page_alloc.c:3457 __alloc_pages_noprof+0x223/0x25a0 mm/page_alloc.c:4733 alloc_pages_mpol_noprof+0x2c9/0x610 mm/mempolicy.c:2265 alloc_slab_page mm/slub.c:2412 [inline] allocate_slab mm/slub.c:2578 [inline] new_slab+0x2ba/0x3f0 mm/slub.c:2631 ___slab_alloc+0xdac/0x1880 mm/slub.c:3818 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3908 __slab_alloc_node mm/slub.c:3961 [inline] slab_alloc_node mm/slub.c:4122 [inline] __kmalloc_cache_noprof+0x2b4/0x300 mm/slub.c:4290 kmalloc_noprof include/linux/slab.h:878 [inline] rtnl_newlink+0x49/0xa0 net/core/rtnetlink.c:3768 rtnetlink_rcv_msg+0x3ca/0xea0 net/core/rtnetlink.c:6675 netlink_rcv_skb+0x16e/0x440 net/netlink/af_netlink.c:2551 netlink_unicast_kernel net/netlink/af_netlink.c:1331 [inline] netlink_unicast+0x53f/0x7f0 net/netlink/af_netlink.c:1357 netlink_sendmsg+0x8b8/0xd70 net/netlink/af_netlink.c:1901 sock_sendmsg_nosec net/socket.c:729 [inline] __sock_sendmsg net/socket.c:744 [inline] __sys_sendto+0x47c/0x4d0 net/socket.c:2214 __do_sys_sendto net/socket.c:2226 [inline] __se_sys_sendto net/socket.c:2222 [inline] __x64_sys_sendto+0xe0/0x1c0 net/socket.c:2222 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 page last free pid 1 tgid 1 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1108 [inline] free_unref_page+0x5f4/0xdc0 mm/page_alloc.c:2638 free_contig_range+0x135/0x3f0 mm/page_alloc.c:6748 destroy_args+0xa27/0xe00 mm/debug_vm_pgtable.c:1017 debug_vm_pgtable+0x168e/0x31a0 mm/debug_vm_pgtable.c:1397 do_one_initcall+0x12b/0x700 init/main.c:1269 do_initcall_level init/main.c:1331 [inline] do_initcalls init/main.c:1347 [inline] do_basic_setup init/main.c:1366 [inline] kernel_init_freeable+0x5c7/0x900 init/main.c:1580 kernel_init+0x1c/0x2b0 init/main.c:1469 ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Memory state around the buggy address: ffff88805b57bf00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88805b57bf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88805b57c000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88805b57c080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88805b57c100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ================================================================== BUG: KASAN: slab-use-after-free in instrument_atomic_read_write include/linux/instrumented.h:96 [inline] BUG: KASAN: slab-use-after-free in atomic_add include/linux/atomic/atomic-instrumented.h:104 [inline] BUG: KASAN: slab-use-after-free in skb_set_owner_r include/net/sock.h:2325 [inline] BUG: KASAN: slab-use-after-free in __sock_queue_rcv_skb+0x295/0xa80 net/core/sock.c:498 Write of size 4 at addr ffff88805b57c140 by task syz.3.96/6244 CPU: 1 UID: 0 PID: 6244 Comm: syz.3.96 Tainted: G B 6.12.0-rc4-syzkaller-00161-gae90f6a6170d #0 Tainted: [B]=BAD_PAGE Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 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:377 [inline] print_report+0xc3/0x620 mm/kasan/report.c:488 kasan_report+0xd9/0x110 mm/kasan/report.c:601 check_region_inline mm/kasan/generic.c:183 [inline] kasan_check_range+0xef/0x1a0 mm/kasan/generic.c:189 instrument_atomic_read_write include/linux/instrumented.h:96 [inline] atomic_add include/linux/atomic/atomic-instrumented.h:104 [inline] skb_set_owner_r include/net/sock.h:2325 [inline] __sock_queue_rcv_skb+0x295/0xa80 net/core/sock.c:498 sock_queue_rcv_skb_reason+0xa2/0xe0 net/core/sock.c:527 sock_queue_rcv_skb include/net/sock.h:2380 [inline] mgmt_cmd_status+0x304/0x520 net/bluetooth/mgmt_util.c:156 cmd_status_rsp net/bluetooth/mgmt.c:1450 [inline] cmd_complete_rsp+0x165/0x1e0 net/bluetooth/mgmt.c:1470 mgmt_pending_foreach+0xe2/0x140 net/bluetooth/mgmt_util.c:259 mgmt_index_removed+0x145/0x300 net/bluetooth/mgmt.c:9407 hci_sock_bind+0xc49/0x16f0 net/bluetooth/hci_sock.c:1307 __sys_bind_socket net/socket.c:1843 [inline] __sys_bind_socket net/socket.c:1835 [inline] __sys_bind+0x1ee/0x220 net/socket.c:1867 __do_sys_bind net/socket.c:1875 [inline] __se_sys_bind net/socket.c:1873 [inline] __x64_sys_bind+0x72/0xb0 net/socket.c:1873 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 RIP: 0033:0x7ff061f7e719 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ff062d6a038 EFLAGS: 00000246 ORIG_RAX: 0000000000000031 RAX: ffffffffffffffda RBX: 00007ff062135f80 RCX: 00007ff061f7e719 RDX: 0000000000000006 RSI: 0000000020000040 RDI: 0000000000000004 RBP: 00007ff061ff12be R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007ff062135f80 R15: 00007ffeecd43be8 Allocated by task 6241: 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 kasan_kmalloc include/linux/kasan.h:257 [inline] __do_kmalloc_node mm/slub.c:4264 [inline] __kmalloc_noprof+0x1e8/0x400 mm/slub.c:4276 kmalloc_noprof include/linux/slab.h:882 [inline] sk_prot_alloc+0x1a8/0x2a0 net/core/sock.c:2164 sk_alloc+0x36/0xb90 net/core/sock.c:2217 bt_sock_alloc+0x3b/0x3a0 net/bluetooth/af_bluetooth.c:148 hci_sock_create+0xbc/0x1a0 net/bluetooth/hci_sock.c:2202 bt_sock_create+0x185/0x350 net/bluetooth/af_bluetooth.c:132 __sock_create+0x331/0x840 net/socket.c:1576 sock_create net/socket.c:1632 [inline] __sys_socket_create net/socket.c:1669 [inline] __sys_socket+0x14f/0x260 net/socket.c:1716 __do_sys_socket net/socket.c:1730 [inline] __se_sys_socket net/socket.c:1728 [inline] __x64_sys_socket+0x72/0xb0 net/socket.c:1728 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 6244: 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 mm/kasan/common.c:247 [inline] __kasan_slab_free+0x51/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:2342 [inline] slab_free mm/slub.c:4579 [inline] kfree+0x14f/0x4b0 mm/slub.c:4727 sk_prot_free net/core/sock.c:2200 [inline] __sk_destruct+0x5eb/0x720 net/core/sock.c:2292 sk_destruct+0xc2/0xf0 net/core/sock.c:2307 __sk_free+0xf4/0x3e0 net/core/sock.c:2318 sk_free+0x6a/0x90 net/core/sock.c:2329 sock_put include/net/sock.h:1888 [inline] mgmt_pending_free+0xc0/0xf0 net/bluetooth/mgmt_util.c:307 mgmt_remove_adv_monitor_complete+0x1b7/0x2e0 net/bluetooth/mgmt.c:5463 _hci_cmd_sync_cancel_entry.constprop.0+0x6f/0x1d0 net/bluetooth/hci_sync.c:641 hci_cmd_sync_dequeue+0x178/0x1f0 net/bluetooth/hci_sync.c:886 cmd_complete_rsp+0x46/0x1e0 net/bluetooth/mgmt.c:1461 mgmt_pending_foreach+0xe2/0x140 net/bluetooth/mgmt_util.c:259 mgmt_index_removed+0x145/0x300 net/bluetooth/mgmt.c:9407 hci_sock_bind+0xc49/0x16f0 net/bluetooth/hci_sock.c:1307 __sys_bind_socket net/socket.c:1843 [inline] __sys_bind_socket net/socket.c:1835 [inline] __sys_bind+0x1ee/0x220 net/socket.c:1867 __do_sys_bind net/socket.c:1875 [inline] __se_sys_bind net/socket.c:1873 [inline] __x64_sys_bind+0x72/0xb0 net/socket.c:1873 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 The buggy address belongs to the object at ffff88805b57c000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 320 bytes inside of freed 2048-byte region [ffff88805b57c000, ffff88805b57c800) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5b578 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff88801b042000 0000000000000000 0000000000000001 raw: 0000000000000000 0000000000080008 00000001f5000000 0000000000000000 head: 00fff00000000040 ffff88801b042000 0000000000000000 0000000000000001 head: 0000000000000000 0000000000080008 00000001f5000000 0000000000000000 head: 00fff00000000003 ffffea00016d5e01 ffffffffffffffff 0000000000000000 head: 0000000000000008 0000000000000000 00000000ffffffff 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 5847, tgid 5847 (syz-executor), ts 92321174332, free_ts 31348293274 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1537 prep_new_page mm/page_alloc.c:1545 [inline] get_page_from_freelist+0x101e/0x3070 mm/page_alloc.c:3457 __alloc_pages_noprof+0x223/0x25a0 mm/page_alloc.c:4733 alloc_pages_mpol_noprof+0x2c9/0x610 mm/mempolicy.c:2265 alloc_slab_page mm/slub.c:2412 [inline] allocate_slab mm/slub.c:2578 [inline] new_slab+0x2ba/0x3f0 mm/slub.c:2631 ___slab_alloc+0xdac/0x1880 mm/slub.c:3818 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3908 __slab_alloc_node mm/slub.c:3961 [inline] slab_alloc_node mm/slub.c:4122 [inline] __kmalloc_cache_noprof+0x2b4/0x300 mm/slub.c:4290 kmalloc_noprof include/linux/slab.h:878 [inline] rtnl_newlink+0x49/0xa0 net/core/rtnetlink.c:3768 rtnetlink_rcv_msg+0x3ca/0xea0 net/core/rtnetlink.c:6675 netlink_rcv_skb+0x16e/0x440 net/netlink/af_netlink.c:2551 netlink_unicast_kernel net/netlink/af_netlink.c:1331 [inline] netlink_unicast+0x53f/0x7f0 net/netlink/af_netlink.c:1357 netlink_sendmsg+0x8b8/0xd70 net/netlink/af_netlink.c:1901 sock_sendmsg_nosec net/socket.c:729 [inline] __sock_sendmsg net/socket.c:744 [inline] __sys_sendto+0x47c/0x4d0 net/socket.c:2214 __do_sys_sendto net/socket.c:2226 [inline] __se_sys_sendto net/socket.c:2222 [inline] __x64_sys_sendto+0xe0/0x1c0 net/socket.c:2222 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 page last free pid 1 tgid 1 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1108 [inline] free_unref_page+0x5f4/0xdc0 mm/page_alloc.c:2638 free_contig_range+0x135/0x3f0 mm/page_alloc.c:6748 destroy_args+0xa27/0xe00 mm/debug_vm_pgtable.c:1017 debug_vm_pgtable+0x168e/0x31a0 mm/debug_vm_pgtable.c:1397 do_one_initcall+0x12b/0x700 init/main.c:1269 do_initcall_level init/main.c:1331 [inline] do_initcalls init/main.c:1347 [inline] do_basic_setup init/main.c:1366 [inline] kernel_init_freeable+0x5c7/0x900 init/main.c:1580 kernel_init+0x1c/0x2b0 init/main.c:1469 ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Memory state around the buggy address: ffff88805b57c000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88805b57c080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88805b57c100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88805b57c180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88805b57c200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================