================================================================== BUG: KASAN: use-after-free in hci_cmd_timeout+0x24f/0x260 net/bluetooth/hci_core.c:1495 Read of size 2 at addr ffff88803ca6e008 by task kworker/u5:0/13358 CPU: 0 PID: 13358 Comm: kworker/u5:0 Not tainted 6.1.0-rc7-syzkaller-00101-g01f856ae6d0c #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Workqueue: hci13 hci_cmd_timeout Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:284 [inline] print_report+0x15e/0x45d mm/kasan/report.c:395 kasan_report+0xbf/0x1f0 mm/kasan/report.c:495 hci_cmd_timeout+0x24f/0x260 net/bluetooth/hci_core.c:1495 process_one_work+0x9bf/0x1710 kernel/workqueue.c:2289 worker_thread+0x669/0x1090 kernel/workqueue.c:2436 kthread+0x2e8/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 Allocated by task 3672: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:371 [inline] ____kasan_kmalloc mm/kasan/common.c:330 [inline] __kasan_kmalloc+0xa5/0xb0 mm/kasan/common.c:380 kasan_kmalloc include/linux/kasan.h:211 [inline] __do_kmalloc_node mm/slab_common.c:955 [inline] __kmalloc_node_track_caller+0x5b/0xc0 mm/slab_common.c:975 kmalloc_reserve net/core/skbuff.c:437 [inline] __alloc_skb+0xdd/0x300 net/core/skbuff.c:509 alloc_skb include/linux/skbuff.h:1267 [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+0x56c/0xe30 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+0xc6/0x1e0 net/bluetooth/hci_sync.c:3227 hci_init_stage_sync net/bluetooth/hci_sync.c:3138 [inline] hci_init1_sync net/bluetooth/hci_sync.c:3321 [inline] hci_init_sync net/bluetooth/hci_sync.c:4396 [inline] hci_dev_init_sync net/bluetooth/hci_sync.c:4584 [inline] hci_dev_open_sync+0x1789/0x21a0 net/bluetooth/hci_sync.c:4664 hci_dev_do_open+0x2d/0x70 net/bluetooth/hci_core.c:483 hci_power_on+0xde/0x620 net/bluetooth/hci_core.c:984 process_one_work+0x9bf/0x1710 kernel/workqueue.c:2289 worker_thread+0x669/0x1090 kernel/workqueue.c:2436 kthread+0x2e8/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 Freed by task 3672: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2e/0x40 mm/kasan/generic.c:511 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x160/0x1c0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:177 [inline] slab_free_hook mm/slub.c:1724 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1750 slab_free mm/slub.c:3661 [inline] __kmem_cache_free+0xaf/0x3b0 mm/slub.c:3674 skb_free_head+0xac/0x110 net/core/skbuff.c:760 skb_release_data+0x5f1/0x870 net/core/skbuff.c:789 skb_release_all net/core/skbuff.c:854 [inline] __kfree_skb net/core/skbuff.c:868 [inline] kfree_skb_reason+0x18a/0x4b0 net/core/skbuff.c:891 kfree_skb include/linux/skbuff.h:1216 [inline] hci_dev_open_sync+0xbf0/0x21a0 net/bluetooth/hci_sync.c:4699 hci_dev_do_open+0x2d/0x70 net/bluetooth/hci_core.c:483 hci_power_on+0xde/0x620 net/bluetooth/hci_core.c:984 process_one_work+0x9bf/0x1710 kernel/workqueue.c:2289 worker_thread+0x669/0x1090 kernel/workqueue.c:2436 kthread+0x2e8/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 Last potentially related work creation: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:481 insert_work+0x48/0x350 kernel/workqueue.c:1358 __queue_work+0x693/0x13b0 kernel/workqueue.c:1517 call_timer_fn+0x1da/0x7c0 kernel/time/timer.c:1474 expire_timers kernel/time/timer.c:1514 [inline] __run_timers.part.0+0x4a3/0xaf0 kernel/time/timer.c:1790 __run_timers kernel/time/timer.c:1768 [inline] run_timer_softirq+0xb7/0x1d0 kernel/time/timer.c:1803 __do_softirq+0x1fb/0xadc kernel/softirq.c:571 The buggy address belongs to the object at ffff88803ca6e000 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 8 bytes inside of 512-byte region [ffff88803ca6e000, ffff88803ca6e200) The buggy address belongs to the physical page: page:ffffea0000f29b00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x3ca6c head:ffffea0000f29b00 order:2 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffffea0000b05300 dead000000000002 ffff888012041c80 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 0x1f2a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_MEMALLOC|__GFP_HARDWALL), pid 6308, tgid 6308 (kworker/u4:17), ts 557847797446, free_ts 549359982164 prep_new_page mm/page_alloc.c:2539 [inline] get_page_from_freelist+0x10b5/0x2d50 mm/page_alloc.c:4291 __alloc_pages+0x1cb/0x5b0 mm/page_alloc.c:5558 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2285 alloc_slab_page mm/slub.c:1794 [inline] allocate_slab+0x213/0x300 mm/slub.c:1939 new_slab mm/slub.c:1992 [inline] ___slab_alloc+0xa91/0x1400 mm/slub.c:3180 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3279 slab_alloc_node mm/slub.c:3364 [inline] __kmem_cache_alloc_node+0x199/0x3e0 mm/slub.c:3437 __do_kmalloc_node mm/slab_common.c:954 [inline] __kmalloc_node_track_caller+0x4b/0xc0 mm/slab_common.c:975 kmalloc_reserve net/core/skbuff.c:437 [inline] __alloc_skb+0xdd/0x300 net/core/skbuff.c:509 __netdev_alloc_skb+0x74/0x410 net/core/skbuff.c:575 netdev_alloc_skb include/linux/skbuff.h:3155 [inline] dev_alloc_skb include/linux/skbuff.h:3168 [inline] __ieee80211_beacon_get+0xb82/0x1a80 net/mac80211/tx.c:5242 ieee80211_beacon_get_tim+0x99/0x4e0 net/mac80211/tx.c:5324 ieee80211_beacon_get include/net/mac80211.h:5247 [inline] mac80211_hwsim_beacon_tx+0x1d4/0xab0 drivers/net/wireless/mac80211_hwsim.c:2086 __iterate_interfaces+0x2c8/0x550 net/mac80211/util.c:796 ieee80211_iterate_active_interfaces_atomic+0x74/0x180 net/mac80211/util.c:832 mac80211_hwsim_beacon+0x101/0x200 drivers/net/wireless/mac80211_hwsim.c:2142 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1459 [inline] free_pcp_prepare+0x65c/0xd90 mm/page_alloc.c:1509 free_unref_page_prepare mm/page_alloc.c:3387 [inline] free_unref_page+0x1d/0x4d0 mm/page_alloc.c:3483 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x184/0x210 mm/kasan/quarantine.c:294 ____kasan_kmalloc mm/kasan/common.c:337 [inline] __kasan_kmalloc+0x89/0xb0 mm/kasan/common.c:380 kasan_kmalloc include/linux/kasan.h:211 [inline] __do_kmalloc_node mm/slab_common.c:955 [inline] __kmalloc_node_track_caller+0x5b/0xc0 mm/slab_common.c:975 kmalloc_reserve net/core/skbuff.c:437 [inline] __alloc_skb+0xdd/0x300 net/core/skbuff.c:509 alloc_skb_fclone include/linux/skbuff.h:1317 [inline] tcp_stream_alloc_skb+0x3c/0x580 net/ipv4/tcp.c:862 tcp_sendmsg_locked+0xc4f/0x2960 net/ipv4/tcp.c:1325 tcp_sendmsg+0x2f/0x50 net/ipv4/tcp.c:1483 inet_sendmsg+0x9d/0xe0 net/ipv4/af_inet.c:827 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg+0xd3/0x120 net/socket.c:734 sock_write_iter+0x295/0x3d0 net/socket.c:1108 call_write_iter include/linux/fs.h:2199 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x9ed/0xdd0 fs/read_write.c:584 ksys_write+0x1ec/0x250 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 Memory state around the buggy address: ffff88803ca6df00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88803ca6df80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88803ca6e000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88803ca6e080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88803ca6e100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================