vcan0: j1939_tp_rxtimer: 0x00000000cbd2981b: abort rx timeout. Force session deactivation ================================================================== BUG: KASAN: use-after-free in atomic_sub_return include/asm-generic/atomic-instrumented.h:159 [inline] BUG: KASAN: use-after-free in atomic_dec_return include/linux/atomic-fallback.h:455 [inline] BUG: KASAN: use-after-free in j1939_sock_pending_del+0x26/0x80 net/can/j1939/socket.c:73 Write of size 4 at addr ffff8880a4e7b4c0 by task syz-executor.0/18419 CPU: 1 PID: 18419 Comm: syz-executor.0 Not tainted 5.4.0-rc6+ #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+0x172/0x1f0 lib/dump_stack.c:113 print_address_description.constprop.0.cold+0xd4/0x30b mm/kasan/report.c:374 __kasan_report.cold+0x1b/0x41 mm/kasan/report.c:506 kasan_report+0x12/0x20 mm/kasan/common.c:634 check_memory_region_inline mm/kasan/generic.c:185 [inline] check_memory_region+0x134/0x1a0 mm/kasan/generic.c:192 __kasan_check_write+0x14/0x20 mm/kasan/common.c:98 atomic_sub_return include/asm-generic/atomic-instrumented.h:159 [inline] atomic_dec_return include/linux/atomic-fallback.h:455 [inline] j1939_sock_pending_del+0x26/0x80 net/can/j1939/socket.c:73 __j1939_session_drop net/can/j1939/transport.c:257 [inline] j1939_session_destroy net/can/j1939/transport.c:270 [inline] __j1939_session_release net/can/j1939/transport.c:280 [inline] kref_put include/linux/kref.h:65 [inline] j1939_session_put+0x107/0x180 net/can/j1939/transport.c:285 j1939_session_deactivate_locked net/can/j1939/transport.c:1021 [inline] j1939_session_deactivate_locked+0x245/0x2f0 net/can/j1939/transport.c:1009 j1939_session_deactivate+0x3d/0x90 net/can/j1939/transport.c:1032 j1939_session_deactivate_activate_next+0x17/0x50 net/can/j1939/transport.c:1041 j1939_tp_rxtimer+0xc8/0x27b net/can/j1939/transport.c:1150 __run_hrtimer kernel/time/hrtimer.c:1514 [inline] __hrtimer_run_queues+0x364/0xe40 kernel/time/hrtimer.c:1576 hrtimer_run_softirq+0x17e/0x270 kernel/time/hrtimer.c:1593 __do_softirq+0x262/0x98c kernel/softirq.c:292 invoke_softirq kernel/softirq.c:373 [inline] irq_exit+0x19b/0x1e0 kernel/softirq.c:413 exiting_irq arch/x86/include/asm/apic.h:536 [inline] smp_apic_timer_interrupt+0x1a3/0x610 arch/x86/kernel/apic/apic.c:1137 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:830 RIP: 0010:arch_local_irq_restore arch/x86/include/asm/paravirt.h:756 [inline] RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:160 [inline] RIP: 0010:_raw_spin_unlock_irqrestore+0x95/0xe0 kernel/locking/spinlock.c:191 Code: 48 c7 c0 e0 1d f3 88 48 ba 00 00 00 00 00 fc ff df 48 c1 e8 03 80 3c 10 00 75 39 48 83 3d 72 3d a3 01 00 74 24 48 89 df 57 9d <0f> 1f 44 00 00 bf 01 00 00 00 e8 8c 34 ff f9 65 8b 05 7d 1d b2 78 RSP: 0018:ffff888068bcf5e8 EFLAGS: 00000282 ORIG_RAX: ffffffffffffff13 RAX: 1ffffffff11e63bc RBX: 0000000000000282 RCX: 0000000000000006 RDX: dffffc0000000000 RSI: 0000000000000008 RDI: 0000000000000282 RBP: ffff888068bcf5f8 R08: 1ffffffff14efd43 R09: fffffbfff14efd44 R10: fffffbfff14efd43 R11: ffffffff8a77ea1f R12: ffff88821b73b130 R13: ffff888068bcf6d8 R14: ffff888219010ab8 R15: ffff88821b73b130 spin_unlock_irqrestore include/linux/spinlock.h:393 [inline] klist_next+0x1e5/0x420 lib/klist.c:401 class_dev_iter_next+0x8d/0xd0 drivers/base/class.c:310 class_find_device+0x14a/0x220 drivers/base/class.c:414 class_find_device_by_devt include/linux/device.h:686 [inline] tty_get_device drivers/tty/tty_io.c:2959 [inline] alloc_tty_struct+0x694/0x900 drivers/tty/tty_io.c:3006 pty_common_install+0x1b9/0x900 drivers/tty/pty.c:399 pty_unix98_install+0x20/0x30 drivers/tty/pty.c:740 tty_driver_install_tty drivers/tty/tty_io.c:1227 [inline] tty_init_dev drivers/tty/tty_io.c:1340 [inline] tty_init_dev+0xf7/0x460 drivers/tty/tty_io.c:1317 ptmx_open drivers/tty/pty.c:845 [inline] ptmx_open+0x118/0x370 drivers/tty/pty.c:811 chrdev_open+0x245/0x6b0 fs/char_dev.c:414 do_dentry_open+0x4e6/0x1380 fs/open.c:797 vfs_open+0xa0/0xd0 fs/open.c:914 do_last fs/namei.c:3408 [inline] path_openat+0x10e9/0x46d0 fs/namei.c:3525 do_filp_open+0x1a1/0x280 fs/namei.c:3555 do_sys_open+0x3fe/0x5d0 fs/open.c:1097 __do_sys_openat fs/open.c:1124 [inline] __se_sys_openat fs/open.c:1118 [inline] __x64_sys_openat+0x9d/0x100 fs/open.c:1118 do_syscall_64+0xfa/0x760 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x45a219 Code: ad b6 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 7b b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f16bc252c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 000000000045a219 RDX: 0000000000000000 RSI: 0000000020000300 RDI: ffffffffffffff9c RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f16bc2536d4 R13: 00000000004c719c R14: 00000000004dcd48 R15: 00000000ffffffff Allocated by task 18350: save_stack+0x23/0x90 mm/kasan/common.c:69 set_track mm/kasan/common.c:77 [inline] __kasan_kmalloc mm/kasan/common.c:510 [inline] __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:483 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:524 __do_kmalloc mm/slab.c:3655 [inline] __kmalloc+0x163/0x770 mm/slab.c:3664 kmalloc include/linux/slab.h:561 [inline] sk_prot_alloc+0x23a/0x310 net/core/sock.c:1605 sk_alloc+0x39/0xf70 net/core/sock.c:1659 can_create+0x1e7/0x4b0 net/can/af_can.c:157 __sock_create+0x3d8/0x730 net/socket.c:1418 sock_create net/socket.c:1469 [inline] __sys_socket+0x103/0x220 net/socket.c:1511 __do_sys_socket net/socket.c:1520 [inline] __se_sys_socket net/socket.c:1518 [inline] __x64_sys_socket+0x73/0xb0 net/socket.c:1518 do_syscall_64+0xfa/0x760 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 18419: save_stack+0x23/0x90 mm/kasan/common.c:69 set_track mm/kasan/common.c:77 [inline] kasan_set_free_info mm/kasan/common.c:332 [inline] __kasan_slab_free+0x102/0x150 mm/kasan/common.c:471 kasan_slab_free+0xe/0x10 mm/kasan/common.c:480 __cache_free mm/slab.c:3425 [inline] kfree+0x10a/0x2c0 mm/slab.c:3756 sk_prot_free net/core/sock.c:1642 [inline] __sk_destruct+0x4aa/0x680 net/core/sock.c:1726 sk_destruct+0xd5/0x110 net/core/sock.c:1741 __sk_free+0xfb/0x360 net/core/sock.c:1752 sock_wfree+0xed/0x190 net/core/sock.c:1968 skb_release_head_state+0xeb/0x260 net/core/skbuff.c:652 skb_release_all+0x16/0x60 net/core/skbuff.c:663 __kfree_skb net/core/skbuff.c:679 [inline] kfree_skb net/core/skbuff.c:697 [inline] kfree_skb+0x101/0x3c0 net/core/skbuff.c:691 skb_queue_purge+0x19/0x40 net/core/skbuff.c:3078 j1939_session_destroy net/can/j1939/transport.c:269 [inline] __j1939_session_release net/can/j1939/transport.c:280 [inline] kref_put include/linux/kref.h:65 [inline] j1939_session_put+0x97/0x180 net/can/j1939/transport.c:285 j1939_session_deactivate_locked net/can/j1939/transport.c:1021 [inline] j1939_session_deactivate_locked+0x245/0x2f0 net/can/j1939/transport.c:1009 j1939_session_deactivate+0x3d/0x90 net/can/j1939/transport.c:1032 j1939_session_deactivate_activate_next+0x17/0x50 net/can/j1939/transport.c:1041 j1939_tp_rxtimer+0xc8/0x27b net/can/j1939/transport.c:1150 __run_hrtimer kernel/time/hrtimer.c:1514 [inline] __hrtimer_run_queues+0x364/0xe40 kernel/time/hrtimer.c:1576 hrtimer_run_softirq+0x17e/0x270 kernel/time/hrtimer.c:1593 __do_softirq+0x262/0x98c kernel/softirq.c:292 The buggy address belongs to the object at ffff8880a4e7b000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 1216 bytes inside of 2048-byte region [ffff8880a4e7b000, ffff8880a4e7b800) The buggy address belongs to the page: page:ffffea0002939ec0 refcount:1 mapcount:0 mapping:ffff8880aa400e00 index:0x0 flags: 0x1fffc0000000200(slab) raw: 01fffc0000000200 ffffea00025c7248 ffffea0002a5f848 ffff8880aa400e00 raw: 0000000000000000 ffff8880a4e7b000 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8880a4e7b380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880a4e7b400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8880a4e7b480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880a4e7b500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880a4e7b580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================