================================================================== BUG: KASAN: use-after-free in constant_test_bit arch/x86/include/asm/bitops.h:317 [inline] BUG: KASAN: use-after-free in sock_flag include/net/sock.h:839 [inline] BUG: KASAN: use-after-free in l2cap_sock_kill+0xdb/0x100 net/bluetooth/l2cap_sock.c:1046 Read of size 8 at addr ffff888056112c20 by task syz-executor.2/10792 CPU: 0 PID: 10792 Comm: syz-executor.2 Not tainted 4.19.147-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x22c/0x33e lib/dump_stack.c:118 print_address_description.cold+0x56/0x25c mm/kasan/report.c:256 kasan_report_error.cold+0x66/0xb9 mm/kasan/report.c:354 kasan_report mm/kasan/report.c:412 [inline] __asan_report_load8_noabort+0x88/0x90 mm/kasan/report.c:433 constant_test_bit arch/x86/include/asm/bitops.h:317 [inline] sock_flag include/net/sock.h:839 [inline] l2cap_sock_kill+0xdb/0x100 net/bluetooth/l2cap_sock.c:1046 l2cap_conn_del+0x3db/0x6b0 net/bluetooth/l2cap_core.c:1730 l2cap_disconn_cfm net/bluetooth/l2cap_core.c:7435 [inline] l2cap_disconn_cfm+0x85/0xa0 net/bluetooth/l2cap_core.c:7428 hci_disconn_cfm include/net/bluetooth/hci_core.h:1261 [inline] hci_conn_hash_flush+0x114/0x220 net/bluetooth/hci_conn.c:1495 hci_dev_do_close+0x623/0xe70 net/bluetooth/hci_core.c:1666 hci_rfkill_set_block+0x102/0x130 net/bluetooth/hci_core.c:2100 rfkill_set_block+0x1f9/0x4b0 net/rfkill/core.c:353 rfkill_fop_write+0x287/0x580 net/rfkill/core.c:1249 __vfs_write+0xf7/0x770 fs/read_write.c:485 __kernel_write+0x109/0x370 fs/read_write.c:506 write_pipe_buf+0x153/0x1f0 fs/splice.c:798 splice_from_pipe_feed fs/splice.c:503 [inline] __splice_from_pipe+0x3af/0x820 fs/splice.c:627 splice_from_pipe fs/splice.c:662 [inline] default_file_splice_write+0xd8/0x180 fs/splice.c:810 do_splice_from fs/splice.c:852 [inline] direct_splice_actor+0x115/0x160 fs/splice.c:1025 splice_direct_to_actor+0x33f/0x8d0 fs/splice.c:980 do_splice_direct+0x1a7/0x270 fs/splice.c:1068 do_sendfile+0x550/0xc30 fs/read_write.c:1447 __do_sys_sendfile64 fs/read_write.c:1502 [inline] __se_sys_sendfile64+0xc4/0x160 fs/read_write.c:1494 do_syscall_64+0xf9/0x670 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x45e179 Code: 3d b2 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 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 0f 83 0b b2 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f1a4f1bec78 EFLAGS: 00000246 ORIG_RAX: 0000000000000028 RAX: ffffffffffffffda RBX: 0000000000027a40 RCX: 000000000045e179 RDX: 0000000020000000 RSI: 0000000000000004 RDI: 0000000000000003 RBP: 000000000118cf88 R08: 0000000000000000 R09: 0000000000000000 R10: 7fffffffffffffff R11: 0000000000000246 R12: 000000000118cf4c R13: 00007ffce94966cf R14: 00007f1a4f1bf9c0 R15: 000000000118cf4c Allocated by task 10729: __do_kmalloc mm/slab.c:3727 [inline] __kmalloc+0x15a/0x4f0 mm/slab.c:3736 kmalloc include/linux/slab.h:520 [inline] sk_prot_alloc+0x1e2/0x2d0 net/core/sock.c:1466 sk_alloc+0x36/0x1100 net/core/sock.c:1520 l2cap_sock_alloc.constprop.0+0x31/0x210 net/bluetooth/l2cap_sock.c:1590 l2cap_sock_create+0x110/0x1b0 net/bluetooth/l2cap_sock.c:1636 bt_sock_create+0x1d0/0x470 net/bluetooth/af_bluetooth.c:130 __sock_create+0x495/0x820 net/socket.c:1276 rfcomm_l2sock_create net/bluetooth/rfcomm/core.c:203 [inline] rfcomm_session_create net/bluetooth/rfcomm/core.c:738 [inline] __rfcomm_dlc_open net/bluetooth/rfcomm/core.c:388 [inline] rfcomm_dlc_open+0x6da/0xc50 net/bluetooth/rfcomm/core.c:431 rfcomm_sock_connect+0x317/0x420 net/bluetooth/rfcomm/sock.c:416 __sys_connect+0x265/0x2c0 net/socket.c:1663 __do_sys_connect net/socket.c:1674 [inline] __se_sys_connect net/socket.c:1671 [inline] __x64_sys_connect+0x6f/0xb0 net/socket.c:1671 do_syscall_64+0xf9/0x670 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 3609: __cache_free mm/slab.c:3503 [inline] kfree+0xcc/0x250 mm/slab.c:3822 sk_prot_free net/core/sock.c:1503 [inline] __sk_destruct+0x61d/0x830 net/core/sock.c:1584 sk_destruct net/core/sock.c:1599 [inline] __sk_free+0x165/0x3b0 net/core/sock.c:1610 sk_free+0x3b/0x50 net/core/sock.c:1621 sock_put include/net/sock.h:1711 [inline] l2cap_sock_kill+0xd4/0x100 net/bluetooth/l2cap_sock.c:1055 l2cap_sock_release+0xd9/0x100 net/bluetooth/l2cap_sock.c:1204 __sock_release net/socket.c:579 [inline] sock_release+0x87/0x1d0 net/socket.c:599 rfcomm_session_del+0x15a/0x1f0 net/bluetooth/rfcomm/core.c:684 rfcomm_session_close net/bluetooth/rfcomm/core.c:723 [inline] rfcomm_process_rx net/bluetooth/rfcomm/core.c:1916 [inline] rfcomm_process_sessions net/bluetooth/rfcomm/core.c:2000 [inline] rfcomm_run+0x13c4/0x45d1 net/bluetooth/rfcomm/core.c:2087 kthread+0x33f/0x460 kernel/kthread.c:259 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415 The buggy address belongs to the object at ffff888056112bc0 which belongs to the cache kmalloc-2048 of size 2048 The buggy address is located 96 bytes inside of 2048-byte region [ffff888056112bc0, ffff8880561133c0) The buggy address belongs to the page: page:ffffea0001584480 count:1 mapcount:0 mapping:ffff88812c3f6c40 index:0xffff888056112340 compound_mapcount: 0 flags: 0xfffe0000008100(slab|head) raw: 00fffe0000008100 ffffea0002084988 ffffea0002184488 ffff88812c3f6c40 raw: ffff888056112340 ffff888056112340 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888056112b00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff888056112b80: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb >ffff888056112c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888056112c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888056112d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================