Bluetooth: hci6: command tx timeout ================================================================== BUG: KASAN: use-after-free in hci_cmd_timeout+0x203/0x210 net/bluetooth/hci_core.c:2654 Read of size 2 at addr ffff88806cf57c08 by task kworker/1:3/3749 CPU: 1 PID: 3749 Comm: kworker/1:3 Not tainted 5.16.0-rc7-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: events hci_cmd_timeout Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description.constprop.0.cold+0x8d/0x320 mm/kasan/report.c:247 __kasan_report mm/kasan/report.c:433 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:450 hci_cmd_timeout+0x203/0x210 net/bluetooth/hci_core.c:2654 process_one_work+0x9b2/0x1660 kernel/workqueue.c:2298 worker_thread+0x65d/0x1130 kernel/workqueue.c:2445 kthread+0x405/0x4f0 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Allocated by task 3720: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:434 [inline] ____kasan_kmalloc mm/kasan/common.c:513 [inline] ____kasan_kmalloc mm/kasan/common.c:472 [inline] __kasan_kmalloc+0xa9/0xd0 mm/kasan/common.c:522 kmalloc include/linux/slab.h:590 [inline] kzalloc include/linux/slab.h:724 [inline] kernfs_fop_open+0x2b9/0xd30 fs/kernfs/file.c:628 do_dentry_open+0x4b9/0x1240 fs/open.c:822 do_open fs/namei.c:3426 [inline] path_openat+0x1cad/0x2750 fs/namei.c:3559 do_filp_open+0x1aa/0x400 fs/namei.c:3586 do_sys_openat2+0x16d/0x4d0 fs/open.c:1212 do_sys_open fs/open.c:1228 [inline] __do_sys_openat fs/open.c:1244 [inline] __se_sys_openat fs/open.c:1239 [inline] __x64_sys_openat+0x13f/0x1f0 fs/open.c:1239 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 3703: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:46 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free mm/kasan/common.c:328 [inline] __kasan_slab_free+0xff/0x130 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:1723 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1749 slab_free mm/slub.c:3513 [inline] kfree+0xf6/0x560 mm/slub.c:4561 skb_free_head net/core/skbuff.c:655 [inline] skb_release_data+0x65a/0x790 net/core/skbuff.c:677 skb_release_all net/core/skbuff.c:742 [inline] __kfree_skb net/core/skbuff.c:756 [inline] kfree_skb net/core/skbuff.c:774 [inline] kfree_skb+0x133/0x3f0 net/core/skbuff.c:768 hci_dev_do_open+0xa50/0x1870 net/bluetooth/hci_core.c:1513 hci_power_on+0x133/0x650 net/bluetooth/hci_core.c:2143 process_one_work+0x9b2/0x1660 kernel/workqueue.c:2298 worker_thread+0x65d/0x1130 kernel/workqueue.c:2445 kthread+0x405/0x4f0 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 The buggy address belongs to the object at ffff88806cf57c00 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 8 bytes inside of 512-byte region [ffff88806cf57c00, ffff88806cf57e00) The buggy address belongs to the page: page:ffffea0001b3d500 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x6cf54 head:ffffea0001b3d500 order:2 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffffea0001e89200 dead000000000002 ffff888010c41c80 raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd28c0(GFP_NOWAIT|__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 3697, ts 1610686922392, free_ts 12316497295 prep_new_page mm/page_alloc.c:2418 [inline] get_page_from_freelist+0xa72/0x2f50 mm/page_alloc.c:4149 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5369 alloc_pages+0x1a7/0x300 mm/mempolicy.c:2190 alloc_slab_page mm/slub.c:1793 [inline] allocate_slab mm/slub.c:1930 [inline] new_slab+0x32d/0x4a0 mm/slub.c:1993 ___slab_alloc+0x918/0xfe0 mm/slub.c:3022 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3109 slab_alloc_node mm/slub.c:3200 [inline] __kmalloc_node_track_caller+0x2cb/0x360 mm/slub.c:4956 kmalloc_reserve net/core/skbuff.c:354 [inline] pskb_expand_head+0x15e/0x1060 net/core/skbuff.c:1701 netlink_trim+0x1ea/0x240 net/netlink/af_netlink.c:1301 netlink_broadcast+0x5b/0xd50 net/netlink/af_netlink.c:1497 nlmsg_multicast include/net/netlink.h:1033 [inline] nlmsg_notify+0x8f/0x280 net/netlink/af_netlink.c:2539 rtmsg_fib+0x2e3/0x450 net/ipv4/fib_semantics.c:530 fib_table_insert+0x714/0x1af0 net/ipv4/fib_trie.c:1389 fib_magic+0x455/0x540 net/ipv4/fib_frontend.c:1087 fib_add_ifaddr+0x476/0x500 net/ipv4/fib_frontend.c:1129 fib_netdev_event+0x46f/0x680 net/ipv4/fib_frontend.c:1466 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1338 [inline] free_pcp_prepare+0x374/0x870 mm/page_alloc.c:1389 free_unref_page_prepare mm/page_alloc.c:3309 [inline] free_unref_page+0x19/0x690 mm/page_alloc.c:3388 free_contig_range+0xa8/0xf0 mm/page_alloc.c:9271 destroy_args+0xa8/0x646 mm/debug_vm_pgtable.c:1016 debug_vm_pgtable+0x2961/0x29f3 mm/debug_vm_pgtable.c:1330 do_one_initcall+0x103/0x650 init/main.c:1297 do_initcall_level init/main.c:1370 [inline] do_initcalls init/main.c:1386 [inline] do_basic_setup init/main.c:1405 [inline] kernel_init_freeable+0x6b1/0x73a init/main.c:1610 kernel_init+0x1a/0x1d0 init/main.c:1499 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Memory state around the buggy address: ffff88806cf57b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88806cf57b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88806cf57c00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88806cf57c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88806cf57d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================