Bluetooth: hci1: command 0x1003 tx timeout ================================================================== BUG: KASAN: use-after-free in hci_cmd_timeout+0x24b/0x250 net/bluetooth/hci_core.c:1486 Read of size 2 at addr ffff88807d7f0808 by task kworker/1:3/3636 CPU: 1 PID: 3636 Comm: kworker/1:3 Not tainted 6.0.0-rc2-next-20220825-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022 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 mm/kasan/report.c:317 [inline] print_report.cold+0x2ba/0x719 mm/kasan/report.c:433 kasan_report+0xb1/0x1e0 mm/kasan/report.c:495 hci_cmd_timeout+0x24b/0x250 net/bluetooth/hci_core.c:1486 process_one_work+0x991/0x1610 kernel/workqueue.c:2289 worker_thread+0x665/0x1080 kernel/workqueue.c:2436 kthread+0x2e4/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 Allocated by task 3619: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:437 [inline] ____kasan_kmalloc mm/kasan/common.c:516 [inline] ____kasan_kmalloc mm/kasan/common.c:475 [inline] __kasan_kmalloc+0xa9/0xd0 mm/kasan/common.c:525 kasan_kmalloc include/linux/kasan.h:234 [inline] __do_kmalloc_node mm/slab_common.c:930 [inline] __kmalloc_node_track_caller+0x55/0xc0 mm/slab_common.c:950 kmalloc_reserve net/core/skbuff.c:358 [inline] __alloc_skb+0xd9/0x2f0 net/core/skbuff.c:430 alloc_skb include/linux/skbuff.h:1258 [inline] bt_skb_alloc include/net/bluetooth/bluetooth.h:469 [inline] hci_cmd_sync_alloc net/bluetooth/hci_sync.c:54 [inline] hci_cmd_sync_add net/bluetooth/hci_sync.c:95 [inline] __hci_cmd_sync_sk+0x568/0xe20 net/bluetooth/hci_sync.c:157 __hci_cmd_sync_status_sk net/bluetooth/hci_sync.c:246 [inline] __hci_cmd_sync_status net/bluetooth/hci_sync.c:271 [inline] hci_read_local_features_sync+0xca/0x1e0 net/bluetooth/hci_sync.c:3160 hci_init_stage_sync net/bluetooth/hci_sync.c:3071 [inline] hci_init1_sync net/bluetooth/hci_sync.c:3254 [inline] hci_init_sync net/bluetooth/hci_sync.c:4329 [inline] hci_dev_init_sync net/bluetooth/hci_sync.c:4517 [inline] hci_dev_open_sync+0x177b/0x2190 net/bluetooth/hci_sync.c:4597 hci_dev_do_open+0x2d/0x70 net/bluetooth/hci_core.c:483 hci_power_on+0xda/0x620 net/bluetooth/hci_core.c:975 process_one_work+0x991/0x1610 kernel/workqueue.c:2289 worker_thread+0x665/0x1080 kernel/workqueue.c:2436 kthread+0x2e4/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 Freed by task 3619: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:45 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 ____kasan_slab_free mm/kasan/common.c:367 [inline] ____kasan_slab_free+0x166/0x1c0 mm/kasan/common.c:329 kasan_slab_free include/linux/kasan.h:200 [inline] slab_free_hook mm/slub.c:1740 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1766 slab_free mm/slub.c:3497 [inline] __kmem_cache_free+0xab/0x3b0 mm/slub.c:3510 skb_free_head+0xac/0x110 net/core/skbuff.c:658 skb_release_data+0x5f1/0x870 net/core/skbuff.c:687 skb_release_all net/core/skbuff.c:752 [inline] __kfree_skb net/core/skbuff.c:766 [inline] kfree_skb_reason+0x14e/0x410 net/core/skbuff.c:789 kfree_skb include/linux/skbuff.h:1207 [inline] hci_dev_open_sync+0xbe2/0x2190 net/bluetooth/hci_sync.c:4631 hci_dev_do_open+0x2d/0x70 net/bluetooth/hci_core.c:483 hci_power_on+0xda/0x620 net/bluetooth/hci_core.c:975 process_one_work+0x991/0x1610 kernel/workqueue.c:2289 worker_thread+0x665/0x1080 kernel/workqueue.c:2436 kthread+0x2e4/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 The buggy address belongs to the object at ffff88807d7f0800 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 8 bytes inside of 512-byte region [ffff88807d7f0800, ffff88807d7f0a00) The buggy address belongs to the physical page: page:ffffea0001f5fc00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7d7f0 head:ffffea0001f5fc00 order:2 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 dead000000000100 dead000000000122 ffff888011841c80 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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 3616, tgid 3616 (syz-executor405), ts 41581672273, free_ts 41580285459 prep_new_page mm/page_alloc.c:2512 [inline] get_page_from_freelist+0x1059/0x2bc0 mm/page_alloc.c:4247 __alloc_pages+0x1c7/0x510 mm/page_alloc.c:5504 alloc_pages+0x1a6/0x270 mm/mempolicy.c:2280 alloc_slab_page mm/slub.c:1810 [inline] allocate_slab+0x27e/0x3d0 mm/slub.c:1955 new_slab mm/slub.c:2015 [inline] ___slab_alloc+0xa3e/0x11d0 mm/slub.c:3017 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3104 slab_alloc_node mm/slub.c:3195 [inline] __kmem_cache_alloc_node+0x18a/0x3d0 mm/slub.c:3268 __do_kmalloc_node mm/slab_common.c:929 [inline] __kmalloc+0x44/0xc0 mm/slab_common.c:943 kmalloc include/linux/slab.h:564 [inline] kzalloc include/linux/slab.h:695 [inline] new_dir fs/proc/proc_sysctl.c:978 [inline] get_subdir fs/proc/proc_sysctl.c:1022 [inline] __register_sysctl_table+0x9eb/0x10a0 fs/proc/proc_sysctl.c:1373 neigh_sysctl_register+0x2c8/0x5e0 net/core/neighbour.c:3852 devinet_sysctl_register+0xb1/0x230 net/ipv4/devinet.c:2623 inetdev_init+0x286/0x580 net/ipv4/devinet.c:279 inetdev_event+0xa85/0x1610 net/ipv4/devinet.c:1534 notifier_call_chain+0xb5/0x200 kernel/notifier.c:87 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:1945 call_netdevice_notifiers_extack net/core/dev.c:1983 [inline] call_netdevice_notifiers net/core/dev.c:1997 [inline] register_netdevice+0x1127/0x1680 net/core/dev.c:10103 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1429 [inline] free_pcp_prepare+0x5e4/0xd20 mm/page_alloc.c:1479 free_unref_page_prepare mm/page_alloc.c:3350 [inline] free_unref_page+0x19/0x480 mm/page_alloc.c:3445 skb_free_head+0xac/0x110 net/core/skbuff.c:658 skb_release_data+0x5f1/0x870 net/core/skbuff.c:687 skb_release_all net/core/skbuff.c:752 [inline] __kfree_skb net/core/skbuff.c:766 [inline] consume_skb net/core/skbuff.c:931 [inline] consume_skb+0xc2/0x160 net/core/skbuff.c:925 netlink_recvmsg+0x598/0xe50 net/netlink/af_netlink.c:1998 sock_recvmsg_nosec net/socket.c:995 [inline] sock_recvmsg net/socket.c:1013 [inline] sock_recvmsg net/socket.c:1009 [inline] ____sys_recvmsg+0x2c7/0x600 net/socket.c:2701 ___sys_recvmsg+0xf2/0x180 net/socket.c:2743 __sys_recvmsg+0xf0/0x1c0 net/socket.c:2773 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+0x63/0xcd Memory state around the buggy address: ffff88807d7f0700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88807d7f0780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88807d7f0800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88807d7f0880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807d7f0900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================