================================================================== BUG: KASAN: slab-use-after-free in sco_conn_free net/bluetooth/sco.c:90 [inline] BUG: KASAN: slab-use-after-free in kref_put include/linux/kref.h:65 [inline] BUG: KASAN: slab-use-after-free in sco_conn_put+0x488/0x4c0 net/bluetooth/sco.c:107 Write of size 8 at addr ffff88803242d008 by task syz.1.1000/9056 CPU: 3 UID: 0 PID: 9056 Comm: syz.1.1000 Not tainted 6.13.0-rc3-syzkaller #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xc3/0x620 mm/kasan/report.c:489 kasan_report+0xd9/0x110 mm/kasan/report.c:602 sco_conn_free net/bluetooth/sco.c:90 [inline] kref_put include/linux/kref.h:65 [inline] sco_conn_put+0x488/0x4c0 net/bluetooth/sco.c:107 sco_chan_del+0x9c/0x1b0 net/bluetooth/sco.c:236 __sco_sock_close+0xab/0x210 net/bluetooth/sco.c:511 sco_sock_close net/bluetooth/sco.c:526 [inline] sco_sock_release+0x6f/0x2d0 net/bluetooth/sco.c:1300 __sock_release+0xb0/0x270 net/socket.c:640 sock_close+0x1c/0x30 net/socket.c:1408 __fput+0x3f8/0xb60 fs/file_table.c:450 task_work_run+0x14e/0x250 kernel/task_work.c:239 get_signal+0x1d3/0x26c0 kernel/signal.c:2790 arch_do_signal_or_restart+0x90/0x7e0 arch/x86/kernel/signal.c:337 exit_to_user_mode_loop kernel/entry/common.c:111 [inline] exit_to_user_mode_prepare include/linux/entry-common.h:329 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline] syscall_exit_to_user_mode+0x150/0x2a0 kernel/entry/common.c:218 do_syscall_64+0xda/0x250 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f1edff85d19 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:00007f1edddf6038 EFLAGS: 00000246 ORIG_RAX: 000000000000002a RAX: fffffffffffffffc RBX: 00007f1ee0175fa0 RCX: 00007f1edff85d19 RDX: 0000000000000008 RSI: 0000000020000040 RDI: 0000000000000005 RBP: 00007f1ee0001a20 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f1ee0175fa0 R15: 00007ffc8126e1a8 Allocated by task 9056: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:377 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:394 kmalloc_noprof include/linux/slab.h:901 [inline] kzalloc_noprof include/linux/slab.h:1037 [inline] __hci_conn_add+0x131/0x1ab0 net/bluetooth/hci_conn.c:935 hci_conn_add_unset+0x6d/0x100 net/bluetooth/hci_conn.c:1045 hci_connect_sco+0x3a1/0xe80 net/bluetooth/hci_conn.c:1693 sco_connect net/bluetooth/sco.c:331 [inline] sco_sock_connect+0x305/0xcc0 net/bluetooth/sco.c:648 __sys_connect_file+0x13e/0x1a0 net/socket.c:2055 __sys_connect+0x14f/0x170 net/socket.c:2074 __do_sys_connect net/socket.c:2080 [inline] __se_sys_connect net/socket.c:2077 [inline] __x64_sys_connect+0x72/0xb0 net/socket.c:2077 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 9057: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:582 poison_slab_object mm/kasan/common.c:247 [inline] __kasan_slab_free+0x51/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:233 [inline] slab_free_hook mm/slub.c:2353 [inline] slab_free mm/slub.c:4613 [inline] kfree+0x14f/0x4b0 mm/slub.c:4761 device_release+0xa1/0x240 drivers/base/core.c:2567 kobject_cleanup lib/kobject.c:689 [inline] kobject_release lib/kobject.c:720 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x1e4/0x5a0 lib/kobject.c:737 put_device+0x1f/0x30 drivers/base/core.c:3773 hci_conn_del_sysfs+0x148/0x170 net/bluetooth/hci_sysfs.c:62 hci_conn_cleanup net/bluetooth/hci_conn.c:174 [inline] hci_conn_del+0x54e/0xdb0 net/bluetooth/hci_conn.c:1164 hci_conn_failed+0x2a6/0x3e0 net/bluetooth/hci_conn.c:1267 hci_conn_cleanup_child net/bluetooth/hci_conn.c:1076 [inline] hci_conn_unlink+0x71e/0x9f0 net/bluetooth/hci_conn.c:1103 hci_conn_del+0x61/0xdb0 net/bluetooth/hci_conn.c:1129 hci_conn_failed+0x2a6/0x3e0 net/bluetooth/hci_conn.c:1267 hci_abort_conn_sync+0x91c/0xfe0 net/bluetooth/hci_sync.c:5603 hci_disconnect_all_sync.constprop.0+0x104/0x3c0 net/bluetooth/hci_sync.c:5626 hci_suspend_sync+0x772/0xab0 net/bluetooth/hci_sync.c:6103 hci_suspend_dev+0x30a/0x510 net/bluetooth/hci_core.c:2831 hci_suspend_notifier+0x28d/0x2f0 net/bluetooth/hci_core.c:2411 notifier_call_chain+0xb7/0x410 kernel/notifier.c:85 notifier_call_chain_robust kernel/notifier.c:120 [inline] blocking_notifier_call_chain_robust kernel/notifier.c:345 [inline] blocking_notifier_call_chain_robust+0xc9/0x170 kernel/notifier.c:333 pm_notifier_call_chain_robust+0x27/0x60 kernel/power/main.c:102 snapshot_open+0x189/0x2b0 kernel/power/user.c:77 misc_open+0x35a/0x420 drivers/char/misc.c:165 chrdev_open+0x237/0x6a0 fs/char_dev.c:414 do_dentry_open+0xf59/0x1ea0 fs/open.c:945 vfs_open+0x82/0x3f0 fs/open.c:1075 do_open fs/namei.c:3828 [inline] path_openat+0x1e6a/0x2d60 fs/namei.c:3987 do_filp_open+0x20c/0x470 fs/namei.c:4014 do_sys_openat2+0x17a/0x1e0 fs/open.c:1402 do_sys_open fs/open.c:1417 [inline] __do_sys_openat fs/open.c:1433 [inline] __se_sys_openat fs/open.c:1428 [inline] __x64_sys_openat+0x175/0x210 fs/open.c:1428 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 ffff88803242c000 which belongs to the cache kmalloc-8k of size 8192 The buggy address is located 4104 bytes inside of freed 8192-byte region [ffff88803242c000, ffff88803242e000) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x32428 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff88801b043180 ffffea00013ae600 0000000000000004 raw: 0000000000000000 0000000080020002 00000001f5000000 0000000000000000 head: 00fff00000000040 ffff88801b043180 ffffea00013ae600 0000000000000004 head: 0000000000000000 0000000080020002 00000001f5000000 0000000000000000 head: 00fff00000000003 ffffea0000c90a01 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 0xd28c0(GFP_NOWAIT|__GFP_IO|__GFP_FS|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5648, tgid 5648 (dhcpcd), ts 97285358854, free_ts 97281731655 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1556 prep_new_page mm/page_alloc.c:1564 [inline] get_page_from_freelist+0xfce/0x2f80 mm/page_alloc.c:3474 __alloc_pages_noprof+0x223/0x25b0 mm/page_alloc.c:4751 alloc_pages_mpol_noprof+0x2c9/0x610 mm/mempolicy.c:2269 alloc_slab_page mm/slub.c:2423 [inline] allocate_slab mm/slub.c:2589 [inline] new_slab+0x2c9/0x410 mm/slub.c:2642 ___slab_alloc+0xd7d/0x17a0 mm/slub.c:3830 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3920 __slab_alloc_node mm/slub.c:3995 [inline] slab_alloc_node mm/slub.c:4156 [inline] __do_kmalloc_node mm/slub.c:4297 [inline] __kmalloc_node_track_caller_noprof+0x2f1/0x510 mm/slub.c:4317 kmalloc_reserve+0xef/0x2c0 net/core/skbuff.c:609 __alloc_skb+0x164/0x380 net/core/skbuff.c:678 alloc_skb include/linux/skbuff.h:1323 [inline] netlink_dump+0x2c1/0xd00 net/netlink/af_netlink.c:2283 netlink_recvmsg+0xa0d/0xf30 net/netlink/af_netlink.c:1973 sock_recvmsg_nosec net/socket.c:1033 [inline] sock_recvmsg+0x1f6/0x250 net/socket.c:1055 ____sys_recvmsg+0x219/0x6b0 net/socket.c:2803 ___sys_recvmsg+0x115/0x1a0 net/socket.c:2845 __sys_recvmsg+0x16b/0x220 net/socket.c:2878 page last free pid 5648 tgid 5648 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1127 [inline] free_unref_page+0x661/0x1080 mm/page_alloc.c:2657 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x4e/0x120 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x195/0x1e0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:329 kasan_slab_alloc include/linux/kasan.h:250 [inline] slab_post_alloc_hook mm/slub.c:4119 [inline] slab_alloc_node mm/slub.c:4168 [inline] kmem_cache_alloc_node_noprof+0x223/0x3c0 mm/slub.c:4220 __alloc_skb+0x2b1/0x380 net/core/skbuff.c:668 alloc_skb include/linux/skbuff.h:1323 [inline] alloc_skb_with_frags+0xe4/0x850 net/core/skbuff.c:6612 sock_alloc_send_pskb+0x7f1/0x980 net/core/sock.c:2881 unix_dgram_sendmsg+0x4b8/0x19e0 net/unix/af_unix.c:2027 sock_sendmsg_nosec net/socket.c:711 [inline] __sock_sendmsg net/socket.c:726 [inline] sock_write_iter+0x4fe/0x5b0 net/socket.c:1147 do_iter_readv_writev+0x532/0x7f0 fs/read_write.c:820 vfs_writev+0x363/0xdd0 fs/read_write.c:1050 do_writev+0x297/0x340 fs/read_write.c:1096 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 Memory state around the buggy address: ffff88803242cf00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88803242cf80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88803242d000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88803242d080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88803242d100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================