================================================================== BUG: KASAN: slab-use-after-free in hci_uart_write_work+0x82d/0x960 drivers/bluetooth/hci_ldisc.c:165 Read of size 4 at addr ffff888043488070 by task kworker/2:2/3249 CPU: 2 UID: 0 PID: 3249 Comm: kworker/2:2 Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Workqueue: events hci_uart_write_work 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+0xcd/0x630 mm/kasan/report.c:482 kasan_report+0xe0/0x110 mm/kasan/report.c:595 hci_uart_write_work+0x82d/0x960 drivers/bluetooth/hci_ldisc.c:165 process_one_work+0x9cf/0x1b70 kernel/workqueue.c:3263 process_scheduled_works kernel/workqueue.c:3346 [inline] worker_thread+0x6c8/0xf10 kernel/workqueue.c:3427 kthread+0x3c5/0x780 kernel/kthread.c:463 ret_from_fork+0x56a/0x730 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Allocated by task 5967: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 unpoison_slab_object mm/kasan/common.c:330 [inline] __kasan_slab_alloc+0x89/0x90 mm/kasan/common.c:356 kasan_slab_alloc include/linux/kasan.h:250 [inline] slab_post_alloc_hook mm/slub.c:4191 [inline] slab_alloc_node mm/slub.c:4240 [inline] kmem_cache_alloc_node_noprof+0x1d5/0x3b0 mm/slub.c:4292 __alloc_skb+0x2b2/0x380 net/core/skbuff.c:659 alloc_skb include/linux/skbuff.h:1336 [inline] bt_skb_alloc include/net/bluetooth/bluetooth.h:509 [inline] hci_cmd_sync_alloc+0x39/0x3a0 net/bluetooth/hci_sync.c:58 hci_cmd_sync_add net/bluetooth/hci_sync.c:99 [inline] __hci_cmd_sync_sk+0x157/0xc90 net/bluetooth/hci_sync.c:168 __hci_cmd_sync_status_sk net/bluetooth/hci_sync.c:263 [inline] __hci_cmd_sync_status net/bluetooth/hci_sync.c:287 [inline] hci_read_local_features_sync+0x2c/0x160 net/bluetooth/hci_sync.c:3701 hci_init_stage_sync net/bluetooth/hci_sync.c:3616 [inline] hci_init1_sync net/bluetooth/hci_sync.c:3748 [inline] hci_init_sync net/bluetooth/hci_sync.c:4860 [inline] hci_dev_init_sync net/bluetooth/hci_sync.c:5052 [inline] hci_dev_open_sync+0x16f9/0x2430 net/bluetooth/hci_sync.c:5130 hci_dev_do_open+0x2a/0x90 net/bluetooth/hci_core.c:430 hci_power_on+0x131/0x610 net/bluetooth/hci_core.c:959 process_one_work+0x9cf/0x1b70 kernel/workqueue.c:3263 process_scheduled_works kernel/workqueue.c:3346 [inline] worker_thread+0x6c8/0xf10 kernel/workqueue.c:3427 kthread+0x3c5/0x780 kernel/kthread.c:463 ret_from_fork+0x56a/0x730 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Freed by task 21391: 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:576 poison_slab_object mm/kasan/common.c:243 [inline] __kasan_slab_free+0x60/0x70 mm/kasan/common.c:275 kasan_slab_free include/linux/kasan.h:233 [inline] slab_free_hook mm/slub.c:2422 [inline] slab_free mm/slub.c:4695 [inline] kmem_cache_free+0x2d1/0x4d0 mm/slub.c:4797 kfree_skbmem+0x1a4/0x1f0 net/core/skbuff.c:1109 __kfree_skb net/core/skbuff.c:1166 [inline] sk_skb_reason_drop+0x136/0x1a0 net/core/skbuff.c:1203 kfree_skb_reason include/linux/skbuff.h:1275 [inline] kfree_skb include/linux/skbuff.h:1284 [inline] hci_uart_flush+0xa7/0x5b0 drivers/bluetooth/hci_ldisc.c:235 hci_uart_close+0x1c/0x80 drivers/bluetooth/hci_ldisc.c:268 hci_uart_tty_close+0xb0/0x2a0 drivers/bluetooth/hci_ldisc.c:545 tty_ldisc_close+0x114/0x1a0 drivers/tty/tty_ldisc.c:455 tty_ldisc_kill+0x8e/0x150 drivers/tty/tty_ldisc.c:613 tty_ldisc_hangup+0x365/0x730 drivers/tty/tty_ldisc.c:729 __tty_hangup.part.0+0x3fe/0x8c0 drivers/tty/tty_io.c:621 __tty_hangup drivers/tty/tty_io.c:688 [inline] tty_vhangup drivers/tty/tty_io.c:691 [inline] tty_vhangup drivers/tty/tty_io.c:688 [inline] tty_ioctl+0x1057/0x1680 drivers/tty/tty_io.c:2732 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:597 [inline] __se_sys_ioctl fs/ioctl.c:583 [inline] __x64_sys_ioctl+0x18b/0x210 fs/ioctl.c:583 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4e0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff888043488000 which belongs to the cache skbuff_head_cache of size 240 The buggy address is located 112 bytes inside of freed 240-byte region [ffff888043488000, ffff8880434880f0) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x43488 head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 ksm flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff88801bb1a8c0 ffffea0001635b00 dead000000000003 raw: 0000000000000000 0000000000190019 00000000f5000000 0000000000000000 head: 00fff00000000040 ffff88801bb1a8c0 ffffea0001635b00 dead000000000003 head: 0000000000000000 0000000000190019 00000000f5000000 0000000000000000 head: 00fff00000000001 ffffea00010d2201 00000000ffffffff 00000000ffffffff head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000002 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 1, migratetype Unmovable, gfp_mask 0x52820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 10921, tgid 10921 (kworker/u32:17), ts 189341103878, free_ts 186970520109 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1c0/0x230 mm/page_alloc.c:1851 prep_new_page mm/page_alloc.c:1859 [inline] get_page_from_freelist+0x132b/0x38e0 mm/page_alloc.c:3858 __alloc_frozen_pages_noprof+0x261/0x23f0 mm/page_alloc.c:5148 alloc_pages_mpol+0x1fb/0x550 mm/mempolicy.c:2416 alloc_slab_page mm/slub.c:2492 [inline] allocate_slab mm/slub.c:2660 [inline] new_slab+0x247/0x330 mm/slub.c:2714 ___slab_alloc+0xcf2/0x1750 mm/slub.c:3901 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3992 __slab_alloc_node mm/slub.c:4067 [inline] slab_alloc_node mm/slub.c:4228 [inline] kmem_cache_alloc_node_noprof+0xf5/0x3b0 mm/slub.c:4292 __alloc_skb+0x2b2/0x380 net/core/skbuff.c:659 alloc_skb include/linux/skbuff.h:1336 [inline] nsim_dev_trap_skb_build drivers/net/netdevsim/dev.c:763 [inline] nsim_dev_trap_report drivers/net/netdevsim/dev.c:820 [inline] nsim_dev_trap_report_work+0x2b1/0xcf0 drivers/net/netdevsim/dev.c:866 process_one_work+0x9cf/0x1b70 kernel/workqueue.c:3263 process_scheduled_works kernel/workqueue.c:3346 [inline] worker_thread+0x6c8/0xf10 kernel/workqueue.c:3427 kthread+0x3c5/0x780 kernel/kthread.c:463 ret_from_fork+0x56a/0x730 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 page last free pid 33 tgid 33 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1395 [inline] __free_frozen_pages+0x7d5/0x10f0 mm/page_alloc.c:2895 rcu_do_batch kernel/rcu/tree.c:2605 [inline] rcu_core+0x79c/0x1530 kernel/rcu/tree.c:2861 handle_softirqs+0x216/0x8e0 kernel/softirq.c:622 run_ksoftirqd kernel/softirq.c:1063 [inline] run_ksoftirqd+0x3a/0x60 kernel/softirq.c:1055 smpboot_thread_fn+0x3f4/0xae0 kernel/smpboot.c:160 kthread+0x3c5/0x780 kernel/kthread.c:463 ret_from_fork+0x56a/0x730 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Memory state around the buggy address: ffff888043487f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888043487f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888043488000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888043488080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc ffff888043488100: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb ==================================================================