Bluetooth: hci3: Opcode 0x0c1a failed: -4 Bluetooth: hci3: Opcode 0x0406 failed: -4 ================================================================== BUG: KASAN: slab-use-after-free in __raw_spin_lock_bh include/linux/spinlock_api_smp.h:150 [inline] BUG: KASAN: slab-use-after-free in _raw_spin_lock_bh+0x33/0x40 kernel/locking/spinlock.c:182 Read of size 1 at addr ffff888027e405a0 by task syz.1.387/7169 CPU: 3 UID: 0 PID: 7169 Comm: syz.1.387 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/0x1d0 mm/kasan/report.c:595 __kasan_check_byte+0x36/0x50 mm/kasan/common.c:574 kasan_check_byte include/linux/kasan.h:402 [inline] lock_acquire kernel/locking/lockdep.c:5842 [inline] lock_acquire+0x12a/0x370 kernel/locking/lockdep.c:5825 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:150 [inline] _raw_spin_lock_bh+0x33/0x40 kernel/locking/spinlock.c:182 spin_lock_bh include/linux/spinlock.h:348 [inline] bt_accept_unlink+0x64/0x370 net/bluetooth/af_bluetooth.c:265 l2cap_sock_teardown_cb+0x1a3/0x3f0 net/bluetooth/l2cap_sock.c:1682 l2cap_chan_del+0xbd/0x930 net/bluetooth/l2cap_core.c:658 l2cap_conn_del+0x395/0x710 net/bluetooth/l2cap_core.c:1804 l2cap_connect_cfm+0x9bb/0xf80 net/bluetooth/l2cap_core.c:7445 hci_connect_cfm include/net/bluetooth/hci_core.h:2139 [inline] hci_conn_failed+0x188/0x360 net/bluetooth/hci_conn.c:1411 hci_abort_conn_sync+0x7d9/0xb20 net/bluetooth/hci_sync.c:5783 hci_disconnect_all_sync.constprop.0.isra.0+0x155/0x430 net/bluetooth/hci_sync.c:5806 hci_suspend_sync+0x8b7/0xa70 net/bluetooth/hci_sync.c:6282 hci_suspend_dev+0x31d/0x540 net/bluetooth/hci_core.c:2813 hci_suspend_notifier+0x21e/0x330 net/bluetooth/hci_core.c:2384 notifier_call_chain+0x99/0x400 kernel/notifier.c:85 notifier_call_chain_robust kernel/notifier.c:120 [inline] blocking_notifier_call_chain_robust kernel/notifier.c:345 [inline] blocking_notifier_call_chain_robust+0xc8/0x160 kernel/notifier.c:333 pm_notifier_call_chain_robust+0x27/0x60 kernel/power/main.c:172 snapshot_open+0x189/0x2a0 kernel/power/user.c:77 misc_open+0x26d/0x450 drivers/char/misc.c:163 chrdev_open+0x234/0x6a0 fs/char_dev.c:411 do_dentry_open+0x6ab/0x14d0 fs/open.c:947 vfs_open+0x82/0x3f0 fs/open.c:1079 do_open fs/namei.c:4699 [inline] path_openat+0x208c/0x31a0 fs/namei.c:4858 do_file_open+0x20e/0x430 fs/namei.c:4887 do_sys_openat2+0x10d/0x1e0 fs/open.c:1364 do_sys_open fs/open.c:1370 [inline] __do_sys_openat fs/open.c:1386 [inline] __se_sys_openat fs/open.c:1381 [inline] __x64_sys_openat+0x12d/0x210 fs/open.c:1381 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:0x7f70b919ce59 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:00007f70b9fd8028 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007f70b9415fa0 RCX: 00007f70b919ce59 RDX: 0000000000000400 RSI: 0000200000000200 RDI: ffffffffffffff9c RBP: 00007f70b9232d6f R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f70b9416038 R14: 00007f70b9415fa0 R15: 00007ffc978b7728 Allocated by task 7036: 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 kasan_kmalloc include/linux/kasan.h:263 [inline] __do_kmalloc_node mm/slub.c:5296 [inline] __kmalloc_noprof+0x301/0x850 mm/slub.c:5308 kmalloc_noprof include/linux/slab.h:954 [inline] sk_prot_alloc+0x10b/0x2a0 net/core/sock.c:2247 sk_alloc+0x36/0xe80 net/core/sock.c:2303 __netlink_create+0x5e/0x2c0 net/netlink/af_netlink.c:626 netlink_create+0x29b/0x610 net/netlink/af_netlink.c:684 __sock_create+0x339/0x860 net/socket.c:1664 sock_create net/socket.c:1722 [inline] __sys_socket_create net/socket.c:1759 [inline] __sys_socket+0x14d/0x260 net/socket.c:1806 __do_sys_socket net/socket.c:1820 [inline] __se_sys_socket net/socket.c:1818 [inline] __x64_sys_socket+0x72/0xb0 net/socket.c:1818 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 Freed by task 7047: 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:2689 [inline] slab_free mm/slub.c:6251 [inline] kfree+0x223/0x6c0 mm/slub.c:6566 sk_prot_free net/core/sock.c:2286 [inline] __sk_destruct+0x88c/0xab0 net/core/sock.c:2386 sk_destruct+0xc8/0xf0 net/core/sock.c:2414 __sk_free+0xf4/0x3e0 net/core/sock.c:2425 sk_free+0x61/0x90 net/core/sock.c:2436 deferred_put_nlk_sk+0xbe/0x110 net/netlink/af_netlink.c:714 rcu_do_batch kernel/rcu/tree.c:2617 [inline] rcu_core+0x5a2/0x10d0 kernel/rcu/tree.c:2869 handle_softirqs+0x1ea/0xa00 kernel/softirq.c:622 __do_softirq kernel/softirq.c:656 [inline] invoke_softirq kernel/softirq.c:496 [inline] __irq_exit_rcu+0x162/0x210 kernel/softirq.c:735 irq_exit_rcu+0x9/0x30 kernel/softirq.c:752 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1061 [inline] sysvec_apic_timer_interrupt+0xa3/0xc0 arch/x86/kernel/apic/apic.c:1061 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:697 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 __call_rcu_common.constprop.0+0xa5/0x9b0 kernel/rcu/tree.c:3131 netlink_release+0xb38/0x2030 net/netlink/af_netlink.c:796 __sock_release+0xb3/0x260 net/socket.c:722 sock_close+0x1c/0x30 net/socket.c:1514 __fput+0x3ff/0xb50 fs/file_table.c:510 task_work_run+0x150/0x240 kernel/task_work.c:233 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] __exit_to_user_mode_loop kernel/entry/common.c:67 [inline] exit_to_user_mode_loop+0x157/0x670 kernel/entry/common.c:98 __exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline] syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:230 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:318 [inline] do_syscall_64+0x666/0x870 arch/x86/entry/syscall_64.c:100 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff888027e40000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 1440 bytes inside of freed 2048-byte region [ffff888027e40000, ffff888027e40800) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff888027e42000 pfn:0x27e40 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000240(workingset|head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000240 ffff88801b842f00 ffffea0000b24410 ffffea00009d8410 raw: ffff888027e42000 0000000800080003 00000000f5000000 0000000000000000 head: 00fff00000000240 ffff88801b842f00 ffffea0000b24410 ffffea00009d8410 head: ffff888027e42000 0000000800080003 00000000f5000000 0000000000000000 head: 00fff00000000003 fffffffffffffe01 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 5718, tgid 5718 (syz-executor), ts 48171925212, free_ts 33310833252 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1853 prep_new_page mm/page_alloc.c:1861 [inline] get_page_from_freelist+0x11a6/0x3410 mm/page_alloc.c:3941 __alloc_frozen_pages_noprof+0x27c/0x2bc0 mm/page_alloc.c:5221 alloc_slab_page mm/slub.c:3278 [inline] allocate_slab mm/slub.c:3467 [inline] new_slab+0xa6/0x6c0 mm/slub.c:3525 refill_objects+0x277/0x420 mm/slub.c:7272 refill_sheaf mm/slub.c:2816 [inline] __pcs_replace_empty_main+0x375/0x650 mm/slub.c:4652 alloc_from_pcs mm/slub.c:4750 [inline] slab_alloc_node mm/slub.c:4884 [inline] __do_kmalloc_node mm/slub.c:5295 [inline] __kmalloc_node_noprof+0x69a/0x850 mm/slub.c:5302 kmalloc_node_noprof include/linux/slab.h:1081 [inline] qdisc_alloc+0xbb/0xb30 net/sched/sch_generic.c:976 qdisc_create_dflt+0x97/0x4b0 net/sched/sch_generic.c:1031 attach_one_default_qdisc net/sched/sch_generic.c:1197 [inline] netdev_for_each_tx_queue include/linux/netdevice.h:2706 [inline] attach_default_qdiscs net/sched/sch_generic.c:1215 [inline] dev_activate+0x64f/0xce0 net/sched/sch_generic.c:1274 __dev_open+0x490/0x8f0 net/core/dev.c:1711 __dev_change_flags+0x596/0x850 net/core/dev.c:9758 netif_change_flags+0x8d/0x160 net/core/dev.c:9821 do_setlink.isra.0+0x1ac4/0x3e60 net/core/rtnetlink.c:3181 rtnl_changelink net/core/rtnetlink.c:3800 [inline] __rtnl_newlink net/core/rtnetlink.c:3973 [inline] rtnl_newlink+0x11c2/0x2380 net/core/rtnetlink.c:4110 rtnetlink_rcv_msg+0x95e/0xe90 net/core/rtnetlink.c:6997 page last free pid 5583 tgid 5583 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] __free_pages_prepare mm/page_alloc.c:1397 [inline] __free_frozen_pages+0x794/0x10a0 mm/page_alloc.c:2938 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x47/0xf0 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x1a0/0x1f0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:350 kasan_slab_alloc include/linux/kasan.h:253 [inline] slab_post_alloc_hook mm/slub.c:4570 [inline] slab_alloc_node mm/slub.c:4899 [inline] __do_kmalloc_node mm/slub.c:5295 [inline] __kmalloc_noprof+0x2b9/0x850 mm/slub.c:5308 kmalloc_noprof include/linux/slab.h:954 [inline] tomoyo_realpath_from_path+0xb6/0x690 security/tomoyo/realpath.c:251 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x276/0x460 security/tomoyo/file.c:827 security_inode_getattr+0x116/0x280 security/security.c:1895 vfs_getattr fs/stat.c:259 [inline] vfs_fstat+0x4b/0xe0 fs/stat.c:281 __do_sys_newfstat+0x8b/0x110 fs/stat.c:551 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: ffff888027e40480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888027e40500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888027e40580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888027e40600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888027e40680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================