================================================================== BUG: KASAN: slab-use-after-free in __mutex_waiter_is_first kernel/locking/mutex.c:199 [inline] BUG: KASAN: slab-use-after-free in __mutex_lock_common kernel/locking/mutex.c:694 [inline] BUG: KASAN: slab-use-after-free in __mutex_lock+0x1861/0x1b90 kernel/locking/mutex.c:776 Read of size 8 at addr ffff88805a3c62e8 by task syz.3.4747/23694 CPU: 3 UID: 0 PID: 23694 Comm: syz.3.4747 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+0x156/0x4c9 mm/kasan/report.c:482 kasan_report+0xdf/0x1e0 mm/kasan/report.c:595 __mutex_waiter_is_first kernel/locking/mutex.c:199 [inline] __mutex_lock_common kernel/locking/mutex.c:694 [inline] __mutex_lock+0x1861/0x1b90 kernel/locking/mutex.c:776 l2cap_unregister_user+0x2a/0x1e0 net/bluetooth/l2cap_core.c:1740 hidp_connection_del+0xf3/0x250 net/bluetooth/hidp/core.c:1421 do_hidp_sock_ioctl.isra.0+0x19a/0x520 net/bluetooth/hidp/sock.c:97 sock_do_ioctl+0x118/0x280 net/socket.c:1319 sock_ioctl+0x599/0x6b0 net/socket.c:1440 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+0x18e/0x210 fs/ioctl.c:583 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x10b/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fe74619c819 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:00007fe747103028 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007fe746416090 RCX: 00007fe74619c819 RDX: 0000200000000000 RSI: 00000000400448c9 RDI: 0000000000000009 RBP: 00007fe746232c91 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fe746416128 R14: 00007fe746416090 R15: 00007ffca8fb5a88 Allocated by task 21599: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 poison_kmalloc_redzone mm/kasan/common.c:398 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:415 kmalloc_noprof include/linux/slab.h:950 [inline] kzalloc_noprof include/linux/slab.h:1188 [inline] l2cap_conn_add.part.0+0x60/0xb00 net/bluetooth/l2cap_core.c:6996 l2cap_conn_add net/bluetooth/l2cap_core.c:69 [inline] l2cap_connect_cfm+0x43e/0xf80 net/bluetooth/l2cap_core.c:7373 hci_connect_cfm include/net/bluetooth/hci_core.h:2139 [inline] hci_remote_features_evt+0x4f4/0x9b0 net/bluetooth/hci_event.c:3763 hci_event_func net/bluetooth/hci_event.c:7766 [inline] hci_event_packet+0x8e9/0xcd0 net/bluetooth/hci_event.c:7817 hci_rx_work+0x451/0xfc0 net/bluetooth/hci_core.c:4077 process_one_work+0xa23/0x19a0 kernel/workqueue.c:3288 process_scheduled_works kernel/workqueue.c:3371 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3452 kthread+0x370/0x450 kernel/kthread.c:436 ret_from_fork+0x72b/0xd50 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Freed by task 23681: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 kasan_save_free_info+0x3b/0x70 mm/kasan/generic.c:584 poison_slab_object mm/kasan/common.c:253 [inline] __kasan_slab_free+0x5f/0x80 mm/kasan/common.c:285 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:2685 [inline] slab_free mm/slub.c:6165 [inline] kfree+0x1f6/0x6b0 mm/slub.c:6483 l2cap_conn_free net/bluetooth/l2cap_core.c:1823 [inline] kref_put include/linux/kref.h:65 [inline] l2cap_conn_put net/bluetooth/l2cap_core.c:1835 [inline] l2cap_conn_del+0x57f/0x710 net/bluetooth/l2cap_core.c:1815 l2cap_disconn_cfm net/bluetooth/l2cap_core.c:7435 [inline] l2cap_disconn_cfm+0x9f/0x100 net/bluetooth/l2cap_core.c:7428 hci_disconn_cfm include/net/bluetooth/hci_core.h:2154 [inline] hci_conn_hash_flush+0x10e/0x280 net/bluetooth/hci_conn.c:2650 hci_dev_close_sync+0x5a7/0x1240 net/bluetooth/hci_sync.c:5368 hci_dev_do_close+0x2e/0xb0 net/bluetooth/hci_core.c:502 hci_unregister_dev+0x227/0x670 net/bluetooth/hci_core.c:2716 vhci_release+0x17d/0x230 drivers/bluetooth/hci_vhci.c:690 __fput+0x3ff/0xb50 fs/file_table.c:510 task_work_run+0x150/0x240 kernel/task_work.c:233 exit_task_work include/linux/task_work.h:40 [inline] do_exit+0x8b8/0x2b60 kernel/exit.c:976 do_group_exit+0xd5/0x2a0 kernel/exit.c:1118 __do_sys_exit_group kernel/exit.c:1129 [inline] __se_sys_exit_group kernel/exit.c:1127 [inline] __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1127 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+0x10b/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Last potentially related work creation: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_record_aux_stack+0xa7/0xc0 mm/kasan/generic.c:556 insert_work+0x36/0x230 kernel/workqueue.c:2211 __queue_work+0x3fd/0x1150 kernel/workqueue.c:2370 queue_work_on+0x180/0x1e0 kernel/workqueue.c:2417 queue_work include/linux/workqueue.h:669 [inline] l2cap_conn_ready net/bluetooth/l2cap_core.c:1660 [inline] l2cap_connect_cfm+0x99e/0xf80 net/bluetooth/l2cap_core.c:7414 hci_connect_cfm include/net/bluetooth/hci_core.h:2139 [inline] hci_remote_features_evt+0x4f4/0x9b0 net/bluetooth/hci_event.c:3763 hci_event_func net/bluetooth/hci_event.c:7766 [inline] hci_event_packet+0x8e9/0xcd0 net/bluetooth/hci_event.c:7817 hci_rx_work+0x451/0xfc0 net/bluetooth/hci_core.c:4077 process_one_work+0xa23/0x19a0 kernel/workqueue.c:3288 process_scheduled_works kernel/workqueue.c:3371 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3452 kthread+0x370/0x450 kernel/kthread.c:436 ret_from_fork+0x72b/0xd50 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 The buggy address belongs to the object at ffff88805a3c6000 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 744 bytes inside of freed 1024-byte region [ffff88805a3c6000, ffff88805a3c6400) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5a3c0 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff88801b842dc0 dead000000000100 dead000000000122 raw: 0000000000000000 0000000800100010 00000000f5000000 0000000000000000 head: 00fff00000000040 ffff88801b842dc0 dead000000000100 dead000000000122 head: 0000000000000000 0000000800100010 00000000f5000000 0000000000000000 head: 00fff00000000003 ffffea000168f001 00000000ffffffff 00000000ffffffff head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5936, tgid 5936 (udevd), ts 87746232945, free_ts 0 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x153/0x170 mm/page_alloc.c:1889 prep_new_page mm/page_alloc.c:1897 [inline] get_page_from_freelist+0x111d/0x3140 mm/page_alloc.c:3962 __alloc_frozen_pages_noprof+0x27c/0x2ba0 mm/page_alloc.c:5250 alloc_slab_page mm/slub.c:3292 [inline] allocate_slab mm/slub.c:3481 [inline] new_slab+0xa6/0x6b0 mm/slub.c:3539 refill_objects+0x26b/0x400 mm/slub.c:7175 refill_sheaf mm/slub.c:2812 [inline] __pcs_replace_empty_main+0x1ab/0x660 mm/slub.c:4615 alloc_from_pcs mm/slub.c:4717 [inline] slab_alloc_node mm/slub.c:4851 [inline] __do_kmalloc_node mm/slub.c:5259 [inline] __kvmalloc_node_noprof+0x7da/0xa00 mm/slub.c:6752 bucket_table_alloc.isra.0+0x88/0x460 lib/rhashtable.c:186 rhashtable_init_noprof+0x43b/0x7d0 lib/rhashtable.c:1076 simple_xattrs_init fs/xattr.c:1618 [inline] simple_xattrs_alloc+0x5c/0xd0 fs/xattr.c:1641 class_simple_xattrs_constructor include/linux/xattr.h:165 [inline] shmem_initxattrs+0x7d/0x6c0 mm/shmem.c:4263 security_inode_init_security+0x242/0x370 security/security.c:1370 shmem_mknod+0x2bf/0x470 mm/shmem.c:3894 lookup_open.isra.0+0xc47/0x11b0 fs/namei.c:4511 open_last_lookups fs/namei.c:4611 [inline] path_openat+0x2291/0x31a0 fs/namei.c:4855 do_file_open+0x20e/0x430 fs/namei.c:4887 page_owner free stack trace missing Memory state around the buggy address: ffff88805a3c6180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88805a3c6200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88805a3c6280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88805a3c6300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88805a3c6380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================