================================================================== BUG: KASAN: use-after-free in l2cap_sock_setsockopt+0x22c3/0x2330 net/bluetooth/l2cap_sock.c:1003 Read of size 1 at addr ffff888045ddc362 by task syz.4.13285/2106 CPU: 2 UID: 0 PID: 2106 Comm: syz.4.13285 Tainted: G L syzkaller #0 PREEMPT(full) Tainted: [L]=SOFTLOCKUP Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x13d/0x4b0 mm/kasan/report.c:482 kasan_report+0xdf/0x1c0 mm/kasan/report.c:595 l2cap_sock_setsockopt+0x22c3/0x2330 net/bluetooth/l2cap_sock.c:1003 do_sock_setsockopt+0xf3/0x1d0 net/socket.c:2368 __sys_setsockopt+0x195/0x220 net/socket.c:2393 __do_sys_setsockopt net/socket.c:2399 [inline] __se_sys_setsockopt net/socket.c:2396 [inline] __x64_sys_setsockopt+0xbd/0x160 net/socket.c:2396 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f56e5f9df99 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f56e6f04028 EFLAGS: 00000246 ORIG_RAX: 0000000000000036 RAX: ffffffffffffffda RBX: 00007f56e6226090 RCX: 00007f56e5f9df99 RDX: 0000000000000008 RSI: 0000000000000112 RDI: 0000000000000004 RBP: 00007f56e6034ec4 R08: 0000000000000004 R09: 0000000000000000 R10: 00002000000005c0 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f56e6226128 R14: 00007f56e6226090 R15: 00007ffd7041cf08 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff888045ddd040 pfn:0x45ddc flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 ffffea0000502008 ffff88806a641500 0000000000000000 raw: ffff888045ddd040 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 2, migratetype Unmovable, gfp_mask 0x40dc0(GFP_KERNEL|__GFP_ZERO|__GFP_COMP), pid 1863, tgid 1863 (syz-executor), ts 373684308522, free_ts 376381631358 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1859 prep_new_page mm/page_alloc.c:1867 [inline] get_page_from_freelist+0xf48/0x3530 mm/page_alloc.c:3946 __alloc_frozen_pages_noprof+0x299/0x2dc0 mm/page_alloc.c:5304 alloc_pages_mpol+0x1fb/0x540 mm/mempolicy.c:2490 ___kmalloc_large_node+0xe5/0x120 mm/slub.c:5274 __kmalloc_large_node_noprof+0x1c/0x70 mm/slub.c:5305 __do_kmalloc_node mm/slub.c:5322 [inline] __kmalloc_noprof+0x5a1/0x820 mm/slub.c:5359 _kmalloc_noprof include/linux/slab.h:992 [inline] _kzalloc_noprof include/linux/slab.h:1309 [inline] hci_alloc_dev_priv+0x1d/0x28a0 net/bluetooth/hci_core.c:2409 hci_alloc_dev include/net/bluetooth/hci_core.h:1761 [inline] __vhci_create_device+0xf0/0x880 drivers/bluetooth/hci_vhci.c:431 vhci_create_device drivers/bluetooth/hci_vhci.c:489 [inline] vhci_get_user drivers/bluetooth/hci_vhci.c:546 [inline] vhci_write+0x2c4/0x490 drivers/bluetooth/hci_vhci.c:626 new_sync_write fs/read_write.c:595 [inline] vfs_write+0x6ac/0x1050 fs/read_write.c:687 ksys_write+0x12a/0x250 fs/read_write.c:739 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f page last free pid 1863 tgid 1863 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] __free_pages_prepare mm/page_alloc.c:1406 [inline] __free_frozen_pages+0x79f/0x1090 mm/page_alloc.c:2950 hci_release_dev+0x4ef/0x630 net/bluetooth/hci_core.c:2739 bt_host_release+0x6b/0xb0 net/bluetooth/hci_sysfs.c:87 device_release+0xd2/0x270 drivers/base/core.c:2636 kobject_cleanup lib/kobject.c:689 [inline] kobject_release lib/kobject.c:720 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x1f7/0x640 lib/kobject.c:737 put_device+0x1f/0x30 drivers/base/core.c:3880 vhci_release+0x185/0x230 drivers/bluetooth/hci_vhci.c:701 __fput+0x3ff/0xb50 fs/file_table.c:512 task_work_run+0x150/0x240 kernel/task_work.c:233 exit_task_work include/linux/task_work.h:40 [inline] do_exit+0x951/0x2ae0 kernel/exit.c:1009 do_group_exit+0xd5/0x2a0 kernel/exit.c:1152 __do_sys_exit_group kernel/exit.c:1163 [inline] __se_sys_exit_group kernel/exit.c:1161 [inline] __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1161 x64_sys_call+0x102c/0x1530 arch/x86/include/generated/asm/syscalls_64.h:232 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff888045ddc200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888045ddc280: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888045ddc300: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888045ddc380: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888045ddc400: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================