================================================================== BUG: KASAN: use-after-free in tipc_sub_unsubscribe+0x22d/0x305 net/tipc/subscr.c:167 Read of size 4 at addr ffff88019cb4a718 by task syz-executor1/26168 CPU: 0 PID: 26168 Comm: syz-executor1 Not tainted 4.16.0+ #4 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+0x1b9/0x294 lib/dump_stack.c:113 print_address_description+0x6c/0x20b mm/kasan/report.c:256 kasan_report_error mm/kasan/report.c:354 [inline] kasan_report.cold.7+0x242/0x2fe mm/kasan/report.c:412 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:432 tipc_sub_unsubscribe+0x22d/0x305 net/tipc/subscr.c:167 tipc_conn_delete_sub+0x333/0x530 net/tipc/topsrv.c:245 tipc_topsrv_kern_unsubscr+0x280/0x3f0 net/tipc/topsrv.c:598 tipc_group_delete+0x2dd/0x3f0 net/tipc/group.c:231 tipc_sk_leave+0x10e/0x210 net/tipc/socket.c:2800 tipc_release+0x146/0x1290 net/tipc/socket.c:576 sock_release+0x96/0x1b0 net/socket.c:594 sock_close+0x16/0x20 net/socket.c:1149 __fput+0x34d/0x890 fs/file_table.c:209 ____fput+0x15/0x20 fs/file_table.c:243 task_work_run+0x1e4/0x290 kernel/task_work.c:113 exit_task_work include/linux/task_work.h:22 [inline] do_exit+0x1aee/0x2730 kernel/exit.c:865 do_group_exit+0x16f/0x430 kernel/exit.c:968 get_signal+0x886/0x1960 kernel/signal.c:2469 do_signal+0x98/0x2040 arch/x86/kernel/signal.c:810 exit_to_usermode_loop+0x28a/0x310 arch/x86/entry/common.c:162 prepare_exit_to_usermode arch/x86/entry/common.c:196 [inline] syscall_return_slowpath arch/x86/entry/common.c:265 [inline] do_syscall_64+0x792/0x9d0 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 RIP: 0033:0x455329 RSP: 002b:00007fdf987ccc68 EFLAGS: 00000246 ORIG_RAX: 0000000000000036 RAX: 0000000000000000 RBX: 00007fdf987cd6d4 RCX: 0000000000455329 RDX: 0000000000000087 RSI: 000000000000010f RDI: 0000000000000015 RBP: 000000000072bea0 R08: 0000000000000127 R09: 0000000000000000 R10: 0000000020000180 R11: 0000000000000246 R12: 0000000000000014 R13: 00000000000005f4 R14: 00000000006fbf80 R15: 0000000000000003 Allocated by task 26168: save_stack+0x43/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] kasan_kmalloc+0xc4/0xe0 mm/kasan/kasan.c:553 kmem_cache_alloc_trace+0x152/0x780 mm/slab.c:3620 kmalloc include/linux/slab.h:512 [inline] tipc_sub_subscribe+0x25a/0x6b0 net/tipc/subscr.c:143 tipc_conn_rcv_sub.isra.5+0x42c/0x7e0 net/tipc/topsrv.c:381 tipc_topsrv_kern_subscr+0x72e/0xad0 net/tipc/topsrv.c:582 tipc_group_create+0x72e/0xa50 net/tipc/group.c:194 tipc_sk_join net/tipc/socket.c:2766 [inline] tipc_setsockopt+0x2c9/0xd70 net/tipc/socket.c:2881 __sys_setsockopt+0x1bd/0x390 net/socket.c:1903 SYSC_setsockopt net/socket.c:1914 [inline] SyS_setsockopt+0x34/0x50 net/socket.c:1911 do_syscall_64+0x29e/0x9d0 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x42/0xb7 Freed by task 26168: save_stack+0x43/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] __kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:521 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528 __cache_free mm/slab.c:3498 [inline] kfree+0xd9/0x260 mm/slab.c:3813 tipc_sub_kref_release net/tipc/subscr.c:117 [inline] kref_put include/linux/kref.h:70 [inline] tipc_sub_put+0x33/0x40 net/tipc/subscr.c:122 tipc_nametbl_unsubscribe+0x52c/0xaf0 net/tipc/name_table.c:709 tipc_sub_unsubscribe+0x6d/0x305 net/tipc/subscr.c:166 tipc_conn_delete_sub+0x333/0x530 net/tipc/topsrv.c:245 tipc_topsrv_kern_unsubscr+0x280/0x3f0 net/tipc/topsrv.c:598 tipc_group_delete+0x2dd/0x3f0 net/tipc/group.c:231 tipc_sk_leave+0x10e/0x210 net/tipc/socket.c:2800 tipc_release+0x146/0x1290 net/tipc/socket.c:576 sock_release+0x96/0x1b0 net/socket.c:594 sock_close+0x16/0x20 net/socket.c:1149 __fput+0x34d/0x890 fs/file_table.c:209 ____fput+0x15/0x20 fs/file_table.c:243 task_work_run+0x1e4/0x290 kernel/task_work.c:113 exit_task_work include/linux/task_work.h:22 [inline] do_exit+0x1aee/0x2730 kernel/exit.c:865 do_group_exit+0x16f/0x430 kernel/exit.c:968 get_signal+0x886/0x1960 kernel/signal.c:2469 do_signal+0x98/0x2040 arch/x86/kernel/signal.c:810 exit_to_usermode_loop+0x28a/0x310 arch/x86/entry/common.c:162 prepare_exit_to_usermode arch/x86/entry/common.c:196 [inline] syscall_return_slowpath arch/x86/entry/common.c:265 [inline] do_syscall_64+0x792/0x9d0 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 The buggy address belongs to the object at ffff88019cb4a680 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 152 bytes inside of 256-byte region [ffff88019cb4a680, ffff88019cb4a780) The buggy address belongs to the page: page:ffffea000672d280 count:1 mapcount:0 mapping:ffff88019cb4a040 index:0x0 flags: 0x2fffc0000000100(slab) raw: 02fffc0000000100 ffff88019cb4a040 0000000000000000 000000010000000c raw: ffffea00074491a0 ffffea00067289a0 ffff8801dac007c0 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88019cb4a600: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff88019cb4a680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88019cb4a700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88019cb4a780: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00 ffff88019cb4a800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ==================================================================