================================================================== BUG: KASAN: use-after-free in sctp_transport_get_next+0x11c/0x140 net/sctp/socket.c:5008 Read of size 8 at addr ffff8801b12206a0 by task syz-executor7/16716 CPU: 0 PID: 16716 Comm: syz-executor7 Not tainted 4.18.0+ #205 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+0x1c9/0x2b4 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/0x30d mm/kasan/report.c:412 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433 sctp_transport_get_next+0x11c/0x140 net/sctp/socket.c:5008 sctp_transport_get_idx net/sctp/socket.c:5022 [inline] sctp_for_each_transport+0x152/0x370 net/sctp/socket.c:5083 sctp_diag_dump+0x3a7/0x620 net/sctp/diag.c:527 __inet_diag_dump+0xa8/0x140 net/ipv4/inet_diag.c:1049 inet_diag_dump+0x9b/0x110 net/ipv4/inet_diag.c:1065 netlink_dump+0x519/0xd50 net/netlink/af_netlink.c:2233 __netlink_dump_start+0x4f1/0x6f0 net/netlink/af_netlink.c:2329 netlink_dump_start include/linux/netlink.h:213 [inline] inet_diag_handler_cmd+0x2ce/0x3f0 net/ipv4/inet_diag.c:1170 __sock_diag_cmd net/core/sock_diag.c:232 [inline] sock_diag_rcv_msg+0x31d/0x410 net/core/sock_diag.c:263 netlink_rcv_skb+0x172/0x440 net/netlink/af_netlink.c:2454 sock_diag_rcv+0x2a/0x40 net/core/sock_diag.c:274 netlink_unicast_kernel net/netlink/af_netlink.c:1317 [inline] netlink_unicast+0x5a0/0x760 net/netlink/af_netlink.c:1343 netlink_sendmsg+0xa18/0xfc0 net/netlink/af_netlink.c:1908 sock_sendmsg_nosec net/socket.c:621 [inline] sock_sendmsg+0xd5/0x120 net/socket.c:631 sock_write_iter+0x362/0x5c0 net/socket.c:900 call_write_iter include/linux/fs.h:1807 [inline] do_iter_readv_writev+0x8b0/0xa80 fs/read_write.c:680 do_iter_write+0x185/0x5f0 fs/read_write.c:959 vfs_writev+0x1f1/0x360 fs/read_write.c:1004 do_writev+0x11a/0x310 fs/read_write.c:1039 __do_sys_writev fs/read_write.c:1112 [inline] __se_sys_writev fs/read_write.c:1109 [inline] __x64_sys_writev+0x75/0xb0 fs/read_write.c:1109 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x457089 Code: fd b4 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 cb b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f64c2c29c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000014 RAX: ffffffffffffffda RBX: 00007f64c2c2a6d4 RCX: 0000000000457089 RDX: 0000000000000001 RSI: 0000000020000000 RDI: 0000000000000005 RBP: 00000000009300a0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff R13: 00000000004d77f0 R14: 00000000004c834e R15: 0000000000000000 Allocated by task 16688: 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/0x730 mm/slab.c:3620 kmalloc include/linux/slab.h:513 [inline] kzalloc include/linux/slab.h:707 [inline] sctp_association_new+0x127/0x2290 net/sctp/associola.c:311 sctp_sendmsg_new_asoc+0x39e/0x1200 net/sctp/socket.c:1742 sctp_sendmsg+0x18a5/0x1da0 net/sctp/socket.c:2103 inet_sendmsg+0x1a1/0x690 net/ipv4/af_inet.c:798 sock_sendmsg_nosec net/socket.c:621 [inline] sock_sendmsg+0xd5/0x120 net/socket.c:631 __sys_sendto+0x3d7/0x670 net/socket.c:1786 __do_sys_sendto net/socket.c:1798 [inline] __se_sys_sendto net/socket.c:1794 [inline] __x64_sys_sendto+0xe1/0x1a0 net/socket.c:1794 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 16688: 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/0x210 mm/slab.c:3813 sctp_association_destroy net/sctp/associola.c:437 [inline] sctp_association_put+0x264/0x350 net/sctp/associola.c:885 sctp_transport_destroy net/sctp/transport.c:180 [inline] sctp_transport_put+0x193/0x200 net/sctp/transport.c:332 sctp_backlog_rcv+0x28e/0xd50 net/sctp/input.c:357 sk_backlog_rcv include/net/sock.h:931 [inline] __release_sock+0x12f/0x3a0 net/core/sock.c:2336 release_sock+0xad/0x2c0 net/core/sock.c:2849 sctp_sendmsg+0x13e6/0x1da0 net/sctp/socket.c:2135 inet_sendmsg+0x1a1/0x690 net/ipv4/af_inet.c:798 sock_sendmsg_nosec net/socket.c:621 [inline] sock_sendmsg+0xd5/0x120 net/socket.c:631 __sys_sendto+0x3d7/0x670 net/socket.c:1786 __do_sys_sendto net/socket.c:1798 [inline] __se_sys_sendto net/socket.c:1794 [inline] __x64_sys_sendto+0xe1/0x1a0 net/socket.c:1794 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff8801b1220680 which belongs to the cache kmalloc-4096 of size 4096 The buggy address is located 32 bytes inside of 4096-byte region [ffff8801b1220680, ffff8801b1221680) The buggy address belongs to the page: page:ffffea0006c48800 count:1 mapcount:0 mapping:ffff8801dac00dc0 index:0x0 compound_mapcount: 0 flags: 0x2fffc0000008100(slab|head) raw: 02fffc0000008100 ffffea0006a50a08 ffffea0006cb0e08 ffff8801dac00dc0 raw: 0000000000000000 ffff8801b1220680 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8801b1220580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8801b1220600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8801b1220680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8801b1220700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8801b1220780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================