Hello, I found a bug titled " KASAN: slab-use-after-free Read in l2cap_chan_timeout " with modified syzkaller in the Linux6.14-rc5. If you fix this issue, please add the following tag to the commit: Reported-by: Jianzhou Zhao <xnxc22xnxc22@xxxxxx>, xingwei lee <xrivendell7@xxxxxxxxx>, Zhizhuo Tang <strforexctzzchange@xxxxxxxxxxx> I use the same kernel as syzbot instance upstream: 7eb172143d5508b4da468ed59ee857c6e5e01da6 kernel config: https://syzkaller.appspot.com/text?tag=KernelConfig&x=da4b04ae798b7ef6 compiler: gcc version 11.4.0 ------------[ cut here ]----------------------------------------- TITLE: KASAN: slab-use-after-free Read in l2cap_chan_timeout ================================================================== ================================================================== BUG: KASAN: slab-use-after-free in __mutex_lock_common kernel/locking/mutex.c:664 [inline] BUG: KASAN: slab-use-after-free in __mutex_lock+0x1dc0/0x2020 kernel/locking/mutex.c:730 Read of size 8 at addr ffff88802a59f338 by task kworker/0:4/9442 CPU: 0 UID: 0 PID: 9442 Comm: kworker/0:4 Not tainted 6.14.0-rc5-dirty #17 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014 Workqueue: events l2cap_chan_timeout Call Trace: <task> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1b0 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:408 [inline] print_report+0xc1/0x630 mm/kasan/report.c:521 kasan_report+0x93/0xc0 mm/kasan/report.c:634 __mutex_lock_common kernel/locking/mutex.c:664 [inline] __mutex_lock+0x1dc0/0x2020 kernel/locking/mutex.c:730 l2cap_chan_timeout+0x6d/0x310 net/bluetooth/l2cap_core.c:417 process_one_work kernel/workqueue.c:3246 [inline] process_scheduled_works+0x61a/0x1af0 kernel/workqueue.c:3330 worker_thread+0x59f/0xcf0 kernel/workqueue.c:3411 kthread+0x427/0x880 kernel/kthread.c:464 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 </task> Allocated by task 12847: kasan_save_stack+0x24/0x50 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 kasan_kmalloc include/linux/kasan.h:260 [inline] __kmalloc_cache_noprof+0x1e2/0x4d0 mm/slub.c:4325 kmalloc_noprof include/linux/slab.h:901 [inline] kzalloc_noprof include/linux/slab.h:1037 [inline] l2cap_conn_add.part.0+0x64/0xab0 net/bluetooth/l2cap_core.c:6825 l2cap_conn_add net/bluetooth/l2cap_core.c:6997 [inline] l2cap_chan_connect+0x1072/0x1d80 net/bluetooth/l2cap_core.c:7016 bt_6lowpan_connect net/bluetooth/6lowpan.c:894 [inline] lowpan_control_write+0x2fa/0x650 net/bluetooth/6lowpan.c:1129 full_proxy_write+0x13e/0x200 fs/debugfs/file.c:398 vfs_write fs/read_write.c:677 [inline] vfs_write+0x2e0/0x1100 fs/read_write.c:659 ksys_write+0x122/0x240 fs/read_write.c:731 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcf/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 12279: kasan_save_stack+0x24/0x50 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 kasan_save_free_info+0x3a/0x60 mm/kasan/generic.c:576 poison_slab_object mm/kasan/common.c:247 [inline] __kasan_slab_free+0x54/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:4609 [inline] kfree+0x14d/0x450 mm/slub.c:4757 kref_put include/linux/kref.h:65 [inline] l2cap_conn_put net/bluetooth/l2cap_core.c:1822 [inline] l2cap_conn_del+0x577/0x720 net/bluetooth/l2cap_core.c:1802 hci_disconn_cfm include/net/bluetooth/hci_core.h:2069 [inline] hci_conn_hash_flush+0x447/0x780 net/bluetooth/hci_conn.c:2698 hci_dev_close_sync+0x63a/0x1160 net/bluetooth/hci_sync.c:5197 hci_dev_do_close+0x31/0xa0 net/bluetooth/hci_core.c:482 hci_unregister_dev+0x213/0x630 net/bluetooth/hci_core.c:2677 vhci_release+0x7a/0xf0 drivers/bluetooth/hci_vhci.c:664 __fput+0x415/0xb60 fs/file_table.c:464 task_work_run+0x170/0x280 kernel/task_work.c:227 exit_task_work include/linux/task_work.h:40 [inline] do_exit+0xa6b/0x3080 kernel/exit.c:938 do_group_exit+0xd3/0x2a0 kernel/exit.c:1087 get_signal+0x261f/0x2790 kernel/signal.c:3036 arch_do_signal_or_restart+0x81/0x8b0 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+0x228/0x2a0 kernel/entry/common.c:218 do_syscall_64+0xdc/0x250 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff88802a59f000 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 824 bytes inside of freed 1024-byte region [ffff88802a59f000, ffff88802a59f400) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2a598 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff88801b041dc0 0000000000000000 dead000000000001 raw: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000 head: 00fff00000000040 ffff88801b041dc0 0000000000000000 dead000000000001 head: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000 head: 00fff00000000003 ffffea0000a96601 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 0x52820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 1872, tgid 1872 (kworker/u9:5), ts 430277951699, free_ts 429930890002 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook mm/page_alloc.c:1551 [inline] prep_new_page+0x1b0/0x1e0 mm/page_alloc.c:1559 get_page_from_freelist+0x19a2/0x3250 mm/page_alloc.c:3477 __alloc_frozen_pages_noprof+0x324/0x6b0 mm/page_alloc.c:4739 alloc_pages_mpol+0x20a/0x550 mm/mempolicy.c:2270 alloc_slab_page mm/slub.c:2423 [inline] allocate_slab mm/slub.c:2587 [inline] new_slab+0x251/0x350 mm/slub.c:2640 ___slab_alloc+0xe40/0x1740 mm/slub.c:3826 __slab_alloc.isra.0+0x56/0xb0 mm/slub.c:3916 __slab_alloc_node mm/slub.c:3991 [inline] slab_alloc_node mm/slub.c:4152 [inline] __do_kmalloc_node mm/slub.c:4293 [inline] __kmalloc_noprof+0x2bc/0x540 mm/slub.c:4306 kmalloc_noprof include/linux/slab.h:905 [inline] kzalloc_noprof include/linux/slab.h:1037 [inline] ieee802_11_parse_elems_full+0xea/0x1880 net/mac80211/parse.c:985 ieee802_11_parse_elems_crc net/mac80211/ieee80211_i.h:2397 [inline] ieee802_11_parse_elems net/mac80211/ieee80211_i.h:2404 [inline] ieee80211_rx_mgmt_probe_beacon net/mac80211/ibss.c:1577 [inline] ieee80211_ibss_rx_queued_mgmt+0xe55/0x3170 net/mac80211/ibss.c:1608 ieee80211_iface_process_skb net/mac80211/iface.c:1611 [inline] ieee80211_iface_work+0xb52/0xe80 net/mac80211/iface.c:1665 cfg80211_wiphy_work+0x444/0x760 net/wireless/core.c:435 process_one_work kernel/workqueue.c:3246 [inline] process_scheduled_works+0x61a/0x1af0 kernel/workqueue.c:3330 worker_thread+0x59f/0xcf0 kernel/workqueue.c:3411 kthread+0x427/0x880 kernel/kthread.c:464 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:148 page last free pid 5215 tgid 5215 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1127 [inline] free_frozen_pages+0x7aa/0x1290 mm/page_alloc.c:2660 __put_partials+0x151/0x170 mm/slub.c:3153 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x50/0x130 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x168/0x1c0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x67/0x90 mm/kasan/common.c:329 kasan_slab_alloc include/linux/kasan.h:250 [inline] slab_post_alloc_hook mm/slub.c:4115 [inline] slab_alloc_node mm/slub.c:4164 [inline] __do_kmalloc_node mm/slub.c:4293 [inline] __kmalloc_noprof+0x1ba/0x540 mm/slub.c:4306 kmalloc_noprof include/linux/slab.h:905 [inline] tomoyo_realpath_from_path+0xc3/0x600 security/tomoyo/realpath.c:251 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x233/0x440 security/tomoyo/file.c:822 security_inode_getattr+0x122/0x2b0 security/security.c:2377 vfs_getattr+0x26/0x70 fs/stat.c:243 vfs_fstat+0x50/0xa0 fs/stat.c:265 __do_sys_newfstat+0x84/0x100 fs/stat.c:542 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcf/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff88802a59f200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88802a59f280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88802a59f300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88802a59f380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88802a59f400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ================================================================== I hope it helps. Best regards Jianzhou Zhao</strforexctzzchange@xxxxxxxxxxx></xrivendell7@xxxxxxxxx></xnxc22xnxc22@xxxxxx>