================================================================== BUG: KASAN: use-after-free in sctp_sock_dump+0xaa3/0xb20 net/sctp/diag.c:311 Read of size 8 at addr ffff8880a2020098 by task syz-executor.0/9755 CPU: 0 PID: 9755 Comm: syz-executor.0 Not tainted 5.4.0-rc8-next-20191119-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+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:638 __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:135 sctp_sock_dump+0xaa3/0xb20 net/sctp/diag.c:311 sctp_for_each_transport+0x2b4/0x350 net/sctp/socket.c:5460 sctp_diag_dump+0x33e/0x450 net/sctp/diag.c:513 __inet_diag_dump+0x9e/0x130 net/ipv4/inet_diag.c:1052 inet_diag_dump+0x9b/0x110 net/ipv4/inet_diag.c:1068 netlink_dump+0x558/0xfb0 net/netlink/af_netlink.c:2244 __netlink_dump_start+0x5b1/0x7d0 net/netlink/af_netlink.c:2352 netlink_dump_start include/linux/netlink.h:233 [inline] inet_diag_handler_cmd+0x262/0x320 net/ipv4/inet_diag.c:1173 __sock_diag_cmd net/core/sock_diag.c:233 [inline] sock_diag_rcv_msg+0x319/0x410 net/core/sock_diag.c:264 netlink_rcv_skb+0x177/0x450 net/netlink/af_netlink.c:2477 sock_diag_rcv+0x2b/0x40 net/core/sock_diag.c:275 netlink_unicast_kernel net/netlink/af_netlink.c:1302 [inline] netlink_unicast+0x531/0x710 net/netlink/af_netlink.c:1328 netlink_sendmsg+0x8cf/0xda0 net/netlink/af_netlink.c:1917 sock_sendmsg_nosec net/socket.c:638 [inline] sock_sendmsg+0xd7/0x130 net/socket.c:658 sock_write_iter+0x27c/0x3e0 net/socket.c:990 call_write_iter include/linux/fs.h:1902 [inline] do_iter_readv_writev+0x5f8/0x8f0 fs/read_write.c:693 do_iter_write fs/read_write.c:970 [inline] do_iter_write+0x184/0x610 fs/read_write.c:951 vfs_writev+0x1b3/0x2f0 fs/read_write.c:1015 do_writev+0x15b/0x330 fs/read_write.c:1058 __do_sys_writev fs/read_write.c:1131 [inline] __se_sys_writev fs/read_write.c:1128 [inline] __x64_sys_writev+0x75/0xb0 fs/read_write.c:1128 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x45a639 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:00007fca715e2c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000014 RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 000000000045a639 RDX: 0000000000000001 RSI: 0000000020000240 RDI: 0000000000000003 RBP: 000000000075bfc8 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007fca715e36d4 R13: 00000000004c7ede R14: 00000000004e3758 R15: 00000000ffffffff Allocated by task 9755: save_stack+0x23/0x90 mm/kasan/common.c:71 set_track mm/kasan/common.c:79 [inline] __kasan_kmalloc mm/kasan/common.c:512 [inline] __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:485 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:526 kmem_cache_alloc_trace+0x158/0x790 mm/slab.c:3551 kmalloc include/linux/slab.h:556 [inline] kzalloc include/linux/slab.h:670 [inline] sctp_endpoint_new+0x79/0xb90 net/sctp/endpointola.c:133 sctp_init_sock+0xcf7/0x1450 net/sctp/socket.c:5145 inet6_create net/ipv6/af_inet6.c:253 [inline] inet6_create+0x9bb/0xf70 net/ipv6/af_inet6.c:107 __sock_create+0x3ce/0x730 net/socket.c:1419 sock_create net/socket.c:1470 [inline] __sys_socket+0x103/0x220 net/socket.c:1512 __do_sys_socket net/socket.c:1521 [inline] __se_sys_socket net/socket.c:1519 [inline] __x64_sys_socket+0x73/0xb0 net/socket.c:1519 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 9753: save_stack+0x23/0x90 mm/kasan/common.c:71 set_track mm/kasan/common.c:79 [inline] kasan_set_free_info mm/kasan/common.c:334 [inline] __kasan_slab_free+0x102/0x150 mm/kasan/common.c:473 kasan_slab_free+0xe/0x10 mm/kasan/common.c:482 __cache_free mm/slab.c:3426 [inline] kfree+0x10a/0x2c0 mm/slab.c:3757 sctp_endpoint_destroy net/sctp/endpointola.c:219 [inline] sctp_endpoint_put+0x1a7/0x210 net/sctp/endpointola.c:235 sctp_endpoint_free+0x77/0x90 net/sctp/endpointola.c:182 sctp_destroy_sock+0x9f/0x3e0 net/sctp/socket.c:5198 sctp_v6_destroy_sock+0x16/0x30 net/sctp/socket.c:9638 sk_common_release+0x6b/0x340 net/core/sock.c:3170 sctp_close+0x4f6/0x880 net/sctp/socket.c:1537 inet_release+0xed/0x200 net/ipv4/af_inet.c:427 inet6_release+0x53/0x80 net/ipv6/af_inet6.c:470 __sock_release+0xce/0x280 net/socket.c:591 sock_close+0x1e/0x30 net/socket.c:1269 __fput+0x2ff/0x890 fs/file_table.c:280 ____fput+0x16/0x20 fs/file_table.c:313 task_work_run+0x145/0x1c0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_usermode_loop+0x316/0x380 arch/x86/entry/common.c:164 prepare_exit_to_usermode arch/x86/entry/common.c:195 [inline] syscall_return_slowpath arch/x86/entry/common.c:278 [inline] do_syscall_64+0x676/0x790 arch/x86/entry/common.c:304 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff8880a2020000 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 152 bytes inside of 512-byte region [ffff8880a2020000, ffff8880a2020200) The buggy address belongs to the page: page:ffffea0002880800 refcount:1 mapcount:0 mapping:ffff8880aa400a80 index:0x0 raw: 01fffc0000000200 ffffea000297b208 ffffea000272b9c8 ffff8880aa400a80 raw: 0000000000000000 ffff8880a2020000 0000000100000004 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8880a201ff80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880a2020000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8880a2020080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880a2020100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880a2020180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================