vcan0: j1939_tp_rxtimer: 0x000000001b49973c: rx timeout, send abort ================================================================== 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 ffff888099cd84c0 by task kworker/u4:9/19559 CPU: 1 PID: 19559 Comm: kworker/u4:9 Not tainted 5.4.0-rc7+ #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: bat_events batadv_nc_worker Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x197/0x210 lib/dump_stack.c:118 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_tp_rxtimer+0x26e/0x27b net/can/j1939/transport.c:1177 __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:should_resched arch/x86/include/asm/preempt.h:102 [inline] RIP: 0010:__local_bh_enable_ip+0x18e/0x270 kernel/softirq.c:196 Code: 00 00 00 00 fc ff df 48 c1 e8 03 80 3c 10 00 0f 85 df 00 00 00 48 83 3d 0f ff ac 07 00 0f 84 8f 00 00 00 fb 66 0f 1f 44 00 00 <65> 8b 05 d3 d8 bb 7e 85 c0 74 7f 5b 41 5c 41 5d 5d c3 80 3d be 6f RSP: 0018:ffff88806df67c20 EFLAGS: 00000282 ORIG_RAX: ffffffffffffff13 RAX: 1ffffffff11e6486 RBX: 0000000000000201 RCX: 0000000000000006 RDX: dffffc0000000000 RSI: 0000000000000008 RDI: ffff888099ce0b14 RBP: ffff88806df67c38 R08: 1ffffffff14f014a R09: fffffbfff14f014b R10: fffffbfff14f014a R11: ffffffff8a780a57 R12: ffffffff87339a65 R13: ffff888099ce0280 R14: ffffffff8733a530 R15: 0000000000000058 __raw_spin_unlock_bh include/linux/spinlock_api_smp.h:176 [inline] _raw_spin_unlock_bh+0x31/0x40 kernel/locking/spinlock.c:207 spin_unlock_bh include/linux/spinlock.h:383 [inline] batadv_nc_purge_paths+0x265/0x370 net/batman-adv/network-coding.c:470 batadv_nc_worker+0x2cf/0x760 net/batman-adv/network-coding.c:721 process_one_work+0x9af/0x1740 kernel/workqueue.c:2269 worker_thread+0x98/0xe40 kernel/workqueue.c:2415 kthread+0x361/0x430 kernel/kthread.c:255 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352 Allocated by task 22486: 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 19559: 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_tp_rxtimer+0x26e/0x27b net/can/j1939/transport.c:1177 __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 ffff888099cd8000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 1216 bytes inside of 2048-byte region [ffff888099cd8000, ffff888099cd8800) The buggy address belongs to the page: page:ffffea0002673600 refcount:1 mapcount:0 mapping:ffff8880aa400e00 index:0x0 flags: 0x1fffc0000000200(slab) raw: 01fffc0000000200 ffffea0001e35808 ffffea00016715c8 ffff8880aa400e00 raw: 0000000000000000 ffff888099cd8000 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888099cd8380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888099cd8400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888099cd8480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888099cd8500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888099cd8580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================