================================================================== BUG: KASAN: use-after-free in tls_write_space+0x238/0x2d0 net/tls/tls_main.c:222 Read of size 1 at addr ffff888085731470 by task ksoftirqd/0/7 CPU: 0 PID: 7 Comm: ksoftirqd/0 Not tainted 4.14.194-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x1b2/0x283 lib/dump_stack.c:58 print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252 TCP: request_sock_TCPv6: Possible SYN flooding on port 20002. Sending cookies. Check SNMP counters. kasan_report_error.cold+0x8a/0x194 mm/kasan/report.c:351 kasan_report mm/kasan/report.c:409 [inline] __asan_report_load1_noabort+0x68/0x70 mm/kasan/report.c:427 tls_write_space+0x238/0x2d0 net/tls/tls_main.c:222 tcp_new_space net/ipv4/tcp_input.c:5112 [inline] tcp_check_space+0x395/0x640 net/ipv4/tcp_input.c:5123 tcp_data_snd_check net/ipv4/tcp_input.c:5133 [inline] tcp_rcv_state_process+0xcb6/0x494e net/ipv4/tcp_input.c:6173 tcp_v6_do_rcv+0x3d5/0x1190 net/ipv6/tcp_ipv6.c:1326 tcp_v6_rcv+0x24e2/0x33a0 net/ipv6/tcp_ipv6.c:1519 ip6_input_finish+0x3e1/0x1570 net/ipv6/ip6_input.c:294 NF_HOOK include/linux/netfilter.h:250 [inline] ip6_input+0xb9/0x300 net/ipv6/ip6_input.c:337 dst_input include/net/dst.h:476 [inline] ip6_rcv_finish+0x23b/0x7a0 net/ipv6/ip6_input.c:71 NF_HOOK include/linux/netfilter.h:250 [inline] ipv6_rcv+0xafe/0x1bd0 net/ipv6/ip6_input.c:218 __netif_receive_skb_core+0x15ee/0x2a30 net/core/dev.c:4474 __netif_receive_skb+0x27/0x1a0 net/core/dev.c:4512 process_backlog+0x210/0x6f0 net/core/dev.c:5194 napi_poll net/core/dev.c:5595 [inline] net_rx_action+0x466/0xfd0 net/core/dev.c:5661 __do_softirq+0x254/0xa1d kernel/softirq.c:288 run_ksoftirqd+0x50/0x1a0 kernel/softirq.c:670 smpboot_thread_fn+0x5c1/0x920 kernel/smpboot.c:164 TCP: request_sock_TCPv6: Possible SYN flooding on port 20002. Sending cookies. Check SNMP counters. kthread+0x30d/0x420 kernel/kthread.c:232 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404 Allocated by task 13887: save_stack mm/kasan/kasan.c:447 [inline] set_track mm/kasan/kasan.c:459 [inline] kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551 kmem_cache_alloc_trace+0x131/0x3d0 mm/slab.c:3618 kmalloc include/linux/slab.h:488 [inline] kzalloc include/linux/slab.h:661 [inline] tls_init+0xb1/0x4e0 net/tls/tls_main.c:518 tcp_set_ulp+0x18f/0x4b6 net/ipv4/tcp_ulp.c:127 do_tcp_setsockopt.constprop.0+0x1f6/0x1c10 net/ipv4/tcp.c:2547 tcp_setsockopt net/ipv4/tcp.c:2830 [inline] tcp_setsockopt+0xa7/0xc0 net/ipv4/tcp.c:2822 SYSC_setsockopt net/socket.c:1865 [inline] SyS_setsockopt+0x110/0x1e0 net/socket.c:1844 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb Freed by task 13883: save_stack mm/kasan/kasan.c:447 [inline] set_track mm/kasan/kasan.c:459 [inline] kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524 __cache_free mm/slab.c:3496 [inline] kfree+0xc9/0x250 mm/slab.c:3815 tls_ctx_free net/tls/tls_main.c:252 [inline] tls_ctx_free net/tls/tls_main.c:246 [inline] tls_sk_proto_close+0x568/0x8b0 net/tls/tls_main.c:290 inet_release+0xdf/0x1b0 net/ipv4/af_inet.c:425 inet6_release+0x4c/0x70 net/ipv6/af_inet6.c:450 __sock_release+0xcd/0x2b0 net/socket.c:602 sock_close+0x15/0x20 net/socket.c:1139 __fput+0x25f/0x7a0 fs/file_table.c:210 task_work_run+0x11f/0x190 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:191 [inline] exit_to_usermode_loop+0x1ad/0x200 arch/x86/entry/common.c:164 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline] syscall_return_slowpath arch/x86/entry/common.c:270 [inline] do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297 entry_SYSCALL_64_after_hwframe+0x46/0xbb The buggy address belongs to the object at ffff888085731400 which belongs to the cache kmalloc-192 of size 192 The buggy address is located 112 bytes inside of 192-byte region [ffff888085731400, ffff8880857314c0) The buggy address belongs to the page: page:ffffea000215cc40 count:1 mapcount:0 mapping:ffff888085731000 index:0xffff888085731c00 flags: 0xfffe0000000100(slab) raw: 00fffe0000000100 ffff888085731000 ffff888085731c00 000000010000000e raw: ffffea0002a31820 ffffea000228f4e0 ffff88812fe52040 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888085731300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888085731380: 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888085731400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888085731480: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff888085731500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ==================================================================