================================================================== BUG: KASAN: use-after-free in bcm_can_tx+0x6be/0x800 net/can/bcm.c:303 Read of size 4 at addr ffff8880b034f810 by task ksoftirqd/1/18 CPU: 1 PID: 18 Comm: ksoftirqd/1 Not tainted 4.19.211-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/26/2022 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x1fc/0x2ef lib/dump_stack.c:118 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256 kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354 kasan_report mm/kasan/report.c:412 [inline] __asan_report_load4_noabort+0x88/0x90 mm/kasan/report.c:432 bcm_can_tx+0x6be/0x800 net/can/bcm.c:303 bcm_tx_timeout_tsklet+0x1f0/0x3a0 net/can/bcm.c:414 tasklet_action_common.constprop.0+0x265/0x360 kernel/softirq.c:522 __do_softirq+0x265/0x980 kernel/softirq.c:292 invoke_softirq kernel/softirq.c:372 [inline] irq_exit+0x215/0x260 kernel/softirq.c:412 exiting_irq arch/x86/include/asm/apic.h:536 [inline] smp_apic_timer_interrupt+0x136/0x550 arch/x86/kernel/apic/apic.c:1098 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:894 RIP: 0010:run_ksoftirqd+0x88/0x110 kernel/softirq.c:655 Code: c0 98 82 f1 89 48 ba 00 00 00 00 00 fc ff df 48 c1 e8 03 80 3c 10 00 75 7b 48 83 3d 59 5e b8 08 00 74 4e fb 66 0f 1f 44 00 00 <31> d2 be 8f 02 00 00 48 c7 c7 00 d9 68 88 e9 25 4e 08 00 e8 e0 84 RSP: 0018:ffff8880b5acfe78 EFLAGS: 00000286 ORIG_RAX: ffffffffffffff13 RAX: 1ffffffff13e3053 RBX: dffffc0000000000 RCX: 0000000000000000 RDX: dffffc0000000000 RSI: 0000000000000001 RDI: ffff8880b5abad44 RBP: ffff8880b59d3a00 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: ffffffff89f47780 R13: ffffffff813923c0 R14: ffff8880b5aba4c0 R15: 0000000000000001 smpboot_thread_fn+0x655/0x9e0 kernel/smpboot.c:164 kthread+0x33f/0x460 kernel/kthread.c:259 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415 Allocated by task 9378: kmem_cache_alloc_trace+0x12f/0x380 mm/slab.c:3625 kmalloc include/linux/slab.h:515 [inline] kzalloc include/linux/slab.h:709 [inline] bcm_tx_setup net/can/bcm.c:947 [inline] bcm_sendmsg+0x25d7/0x4150 net/can/bcm.c:1386 sock_sendmsg_nosec net/socket.c:651 [inline] sock_sendmsg+0xc3/0x120 net/socket.c:661 ___sys_sendmsg+0x7bb/0x8e0 net/socket.c:2227 __sys_sendmsg net/socket.c:2265 [inline] __do_sys_sendmsg net/socket.c:2274 [inline] __se_sys_sendmsg net/socket.c:2272 [inline] __x64_sys_sendmsg+0x132/0x220 net/socket.c:2272 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 9378: __cache_free mm/slab.c:3503 [inline] kfree+0xcc/0x210 mm/slab.c:3822 bcm_release+0x260/0x950 net/can/bcm.c:1561 __sock_release+0xcd/0x2a0 net/socket.c:599 sock_close+0x15/0x20 net/socket.c:1214 __fput+0x2ce/0x890 fs/file_table.c:278 task_work_run+0x148/0x1c0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:193 [inline] exit_to_usermode_loop+0x251/0x2a0 arch/x86/entry/common.c:167 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline] syscall_return_slowpath arch/x86/entry/common.c:271 [inline] do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff8880b034f6c0 which belongs to the cache kmalloc-1024 of size 1024 The buggy address is located 336 bytes inside of 1024-byte region [ffff8880b034f6c0, ffff8880b034fac0) The buggy address belongs to the page: page:ffffea0002c0d380 count:1 mapcount:0 mapping:ffff88813bff0ac0 index:0xffff8880b034f240 compound_mapcount: 0 flags: 0xfff00000008100(slab|head) raw: 00fff00000008100 ffffea00024efc08 ffffea000256b608 ffff88813bff0ac0 raw: ffff8880b034f240 ffff8880b034e040 0000000100000006 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8880b034f700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880b034f780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8880b034f800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880b034f880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880b034f900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess), 5 bytes skipped: 0: 48 ba 00 00 00 00 00 movabs $0xdffffc0000000000,%rdx 7: fc ff df a: 48 c1 e8 03 shr $0x3,%rax e: 80 3c 10 00 cmpb $0x0,(%rax,%rdx,1) 12: 75 7b jne 0x8f 14: 48 83 3d 59 5e b8 08 cmpq $0x0,0x8b85e59(%rip) # 0x8b85e75 1b: 00 1c: 74 4e je 0x6c 1e: fb sti 1f: 66 0f 1f 44 00 00 nopw 0x0(%rax,%rax,1) * 25: 31 d2 xor %edx,%edx <-- trapping instruction 27: be 8f 02 00 00 mov $0x28f,%esi 2c: 48 c7 c7 00 d9 68 88 mov $0xffffffff8868d900,%rdi 33: e9 25 4e 08 00 jmpq 0x84e5d 38: e8 .byte 0xe8 39: e0 84 loopne 0xffffffbf