================================================================== BUG: KASAN: use-after-free in tcp_cdg_cwnd_event+0x189/0x300 net/ipv4/tcp_cdg.c:355 Write of size 64 at addr ffff88807f358c00 by task kworker/0:2/917 CPU: 0 PID: 917 Comm: kworker/0:2 Not tainted 5.17.0-rc2-next-20220204-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: events mptcp_worker Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description.constprop.0.cold+0xa5/0x3e0 mm/kasan/report.c:255 __kasan_report mm/kasan/report.c:442 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:459 check_region_inline mm/kasan/generic.c:183 [inline] kasan_check_range+0x13d/0x180 mm/kasan/generic.c:189 memset+0x20/0x40 mm/kasan/shadow.c:44 tcp_cdg_cwnd_event+0x189/0x300 net/ipv4/tcp_cdg.c:355 tcp_ca_event include/net/tcp.h:1156 [inline] tcp_cwnd_restart+0x108/0x4a0 net/ipv4/tcp_output.c:147 tcp_slow_start_after_idle_check include/net/tcp.h:1409 [inline] tcp_skb_entail+0x5c2/0x710 net/ipv4/tcp.c:666 __mptcp_alloc_tx_skb net/mptcp/protocol.c:1193 [inline] mptcp_alloc_tx_skb net/mptcp/protocol.c:1210 [inline] mptcp_sendmsg_frag+0x5f1/0x2400 net/mptcp/protocol.c:1275 __mptcp_push_pending+0x232/0x720 net/mptcp/protocol.c:1561 mptcp_release_cb+0x1ef/0x990 net/mptcp/protocol.c:3079 release_sock+0xb4/0x1b0 net/core/sock.c:3333 mptcp_worker+0x4d0/0xbb0 net/mptcp/protocol.c:2512 process_one_work+0x996/0x1610 kernel/workqueue.c:2289 worker_thread+0x665/0x1080 kernel/workqueue.c:2436 kthread+0x2e9/0x3a0 kernel/kthread.c:377 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Allocated by task 8673: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:436 [inline] ____kasan_kmalloc mm/kasan/common.c:515 [inline] ____kasan_kmalloc mm/kasan/common.c:474 [inline] __kasan_kmalloc+0xa9/0xd0 mm/kasan/common.c:524 kmalloc_array include/linux/slab.h:621 [inline] kcalloc include/linux/slab.h:652 [inline] tcp_cdg_init+0x10d/0x170 net/ipv4/tcp_cdg.c:380 tcp_init_congestion_control+0xab/0x550 net/ipv4/tcp_cong.c:183 tcp_reinit_congestion_control net/ipv4/tcp_cong.c:207 [inline] tcp_set_congestion_control+0x96c/0xaa0 net/ipv4/tcp_cong.c:381 do_tcp_setsockopt net/ipv4/tcp.c:3403 [inline] tcp_setsockopt+0x620/0x2520 net/ipv4/tcp.c:3690 mptcp_setsockopt+0xa04/0x2640 net/mptcp/sockopt.c:812 __sys_setsockopt+0x2db/0x6a0 net/socket.c:2180 __do_sys_setsockopt net/socket.c:2191 [inline] __se_sys_setsockopt net/socket.c:2188 [inline] __x64_sys_setsockopt+0xba/0x150 net/socket.c:2188 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 19: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:45 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free+0x166/0x1a0 mm/kasan/common.c:328 kasan_slab_free include/linux/kasan.h:226 [inline] slab_free_hook mm/slub.c:1728 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1754 slab_free mm/slub.c:3509 [inline] kfree+0xce/0x2d0 mm/slub.c:4562 tcp_cleanup_congestion_control+0x70/0x120 net/ipv4/tcp_cong.c:216 tcp_v4_destroy_sock+0xe2/0x760 net/ipv4/tcp_ipv4.c:2277 tcp_v6_destroy_sock+0x11/0x20 net/ipv6/tcp_ipv6.c:1975 inet_csk_destroy_sock+0x196/0x440 net/ipv4/inet_connection_sock.c:1007 tcp_done+0x23b/0x340 net/ipv4/tcp.c:4454 tcp_reset+0x16f/0x4a0 net/ipv4/tcp_input.c:4314 tcp_validate_incoming+0xfc1/0x1c40 net/ipv4/tcp_input.c:5722 tcp_rcv_established+0x5b1/0x2130 net/ipv4/tcp_input.c:5934 tcp_v6_do_rcv+0x802/0x13a0 net/ipv6/tcp_ipv6.c:1526 tcp_v6_rcv+0x23a2/0x2cf0 net/ipv6/tcp_ipv6.c:1770 ip6_protocol_deliver_rcu+0x2e9/0x1d10 net/ipv6/ip6_input.c:422 ip6_input_finish+0x62/0x170 net/ipv6/ip6_input.c:463 NF_HOOK include/linux/netfilter.h:307 [inline] NF_HOOK include/linux/netfilter.h:301 [inline] ip6_input+0x9c/0xd0 net/ipv6/ip6_input.c:472 dst_input include/net/dst.h:461 [inline] ip6_rcv_finish+0x1ca/0x300 net/ipv6/ip6_input.c:76 ip_sabotage_in net/bridge/br_netfilter_hooks.c:872 [inline] ip_sabotage_in+0x1fa/0x260 net/bridge/br_netfilter_hooks.c:863 nf_hook_entry_hookfn include/linux/netfilter.h:142 [inline] nf_hook_slow+0xc5/0x1e0 net/netfilter/core.c:619 nf_hook.constprop.0+0x3ac/0x650 include/linux/netfilter.h:262 NF_HOOK include/linux/netfilter.h:305 [inline] ipv6_rcv+0x9e/0x3b0 net/ipv6/ip6_input.c:297 __netif_receive_skb_one_core+0x114/0x180 net/core/dev.c:5351 __netif_receive_skb+0x24/0x1b0 net/core/dev.c:5465 netif_receive_skb_internal net/core/dev.c:5551 [inline] netif_receive_skb+0x13e/0x8e0 net/core/dev.c:5610 NF_HOOK include/linux/netfilter.h:307 [inline] NF_HOOK include/linux/netfilter.h:301 [inline] br_pass_frame_up+0x2d2/0x3e0 net/bridge/br_input.c:61 br_handle_frame_finish+0x696/0x1860 net/bridge/br_input.c:174 br_nf_hook_thresh+0x2a5/0x360 net/bridge/br_netfilter_hooks.c:1024 br_nf_pre_routing_finish_ipv6+0x684/0xe00 net/bridge/br_netfilter_ipv6.c:206 NF_HOOK include/linux/netfilter.h:307 [inline] br_nf_pre_routing_ipv6+0x42c/0x7b0 net/bridge/br_netfilter_ipv6.c:236 br_nf_pre_routing+0x1477/0x1ec0 net/bridge/br_netfilter_hooks.c:505 nf_hook_entry_hookfn include/linux/netfilter.h:142 [inline] nf_hook_bridge_pre net/bridge/br_input.c:230 [inline] br_handle_frame+0x8fa/0x1180 net/bridge/br_input.c:370 __netif_receive_skb_core+0x9f9/0x3850 net/core/dev.c:5245 __netif_receive_skb_one_core+0xae/0x180 net/core/dev.c:5349 __netif_receive_skb+0x24/0x1b0 net/core/dev.c:5465 process_backlog+0x3a0/0x800 net/core/dev.c:5797 __napi_poll+0xb3/0x6e0 net/core/dev.c:6365 napi_poll net/core/dev.c:6432 [inline] net_rx_action+0x8ec/0xc60 net/core/dev.c:6519 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558 Last potentially related work creation: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 __kasan_record_aux_stack+0xbe/0xd0 mm/kasan/generic.c:348 kvfree_call_rcu+0x74/0x990 kernel/rcu/tree.c:3596 sctp_bind_addr_clean+0x135/0x1f0 net/sctp/bind_addr.c:125 sctp_endpoint_destroy net/sctp/endpointola.c:219 [inline] sctp_endpoint_put+0x106/0x200 net/sctp/endpointola.c:243 sctp_destroy_sock+0xa7/0x3e0 net/sctp/socket.c:5098 sctp_v6_destroy_sock+0x11/0x20 net/sctp/socket.c:9671 sk_common_release+0x64/0x390 net/core/sock.c:3512 sctp_close+0x4dd/0x940 net/sctp/socket.c:1547 inet_release+0x12e/0x280 net/ipv4/af_inet.c:428 inet6_release+0x4c/0x70 net/ipv6/af_inet6.c:478 __sock_release+0xcd/0x280 net/socket.c:650 sock_close+0x18/0x20 net/socket.c:1318 __fput+0x286/0x9f0 fs/file_table.c:311 task_work_run+0xdd/0x1a0 kernel/task_work.c:164 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_user_mode_loop kernel/entry/common.c:175 [inline] exit_to_user_mode_prepare+0x27e/0x290 kernel/entry/common.c:207 __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline] syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:300 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff88807f358c00 which belongs to the cache kmalloc-64 of size 64 The buggy address is located 0 bytes inside of 64-byte region [ffff88807f358c00, ffff88807f358c40) The buggy address belongs to the page: page:ffffea0001fcd600 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7f358 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea0001cda100 dead000000000003 ffff888010c41640 raw: 0000000000000000 0000000000200020 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY), pid 1, ts 16683023686, free_ts 16519837040 prep_new_page mm/page_alloc.c:2489 [inline] get_page_from_freelist+0x13ea/0x31d0 mm/page_alloc.c:4219 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5435 alloc_pages+0x1aa/0x310 mm/mempolicy.c:2268 alloc_slab_page mm/slub.c:1799 [inline] allocate_slab mm/slub.c:1944 [inline] new_slab+0x295/0x400 mm/slub.c:2004 ___slab_alloc+0x7ed/0xe00 mm/slub.c:3018 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3105 slab_alloc_node mm/slub.c:3196 [inline] slab_alloc mm/slub.c:3238 [inline] __kmalloc_track_caller+0x2e7/0x320 mm/slub.c:4926 __do_krealloc mm/slab_common.c:1184 [inline] krealloc+0x87/0xf0 mm/slab_common.c:1217 ima_collect_measurement+0x348/0x570 security/integrity/ima/ima_api.c:260 process_measurement+0xd37/0x1920 security/integrity/ima/ima_main.c:337 ima_file_check+0xac/0x100 security/integrity/ima/ima_main.c:516 do_open fs/namei.c:3478 [inline] path_openat+0x1647/0x2940 fs/namei.c:3609 do_filp_open+0x1aa/0x400 fs/namei.c:3636 do_sys_openat2+0x16d/0x4d0 fs/open.c:1347 do_sys_open fs/open.c:1363 [inline] __do_sys_openat fs/open.c:1379 [inline] __se_sys_openat fs/open.c:1374 [inline] __x64_sys_openat+0x13f/0x1f0 fs/open.c:1374 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1356 [inline] free_pcp_prepare+0x549/0xd20 mm/page_alloc.c:1406 free_unref_page_prepare mm/page_alloc.c:3376 [inline] free_unref_page+0x19/0x6c0 mm/page_alloc.c:3455 kasan_depopulate_vmalloc_pte+0x5c/0x70 mm/kasan/shadow.c:359 apply_to_pte_range mm/memory.c:2541 [inline] apply_to_pmd_range mm/memory.c:2585 [inline] apply_to_pud_range mm/memory.c:2621 [inline] apply_to_p4d_range mm/memory.c:2657 [inline] __apply_to_page_range+0x686/0x1030 mm/memory.c:2691 kasan_release_vmalloc+0xa7/0xc0 mm/kasan/shadow.c:469 __purge_vmap_area_lazy+0x8f9/0x1c50 mm/vmalloc.c:1717 _vm_unmap_aliases.part.0+0x3f0/0x500 mm/vmalloc.c:2122 _vm_unmap_aliases mm/vmalloc.c:2096 [inline] vm_unmap_aliases+0x45/0x50 mm/vmalloc.c:2145 change_page_attr_set_clr+0x241/0x500 arch/x86/mm/pat/set_memory.c:1743 change_page_attr_set arch/x86/mm/pat/set_memory.c:1793 [inline] set_memory_nx+0xb2/0x110 arch/x86/mm/pat/set_memory.c:1941 free_init_pages+0x73/0xc0 arch/x86/mm/init.c:898 kernel_init+0x2e/0x1d0 init/main.c:1516 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Memory state around the buggy address: ffff88807f358b00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff88807f358b80: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc >ffff88807f358c00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ^ ffff88807f358c80: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc ffff88807f358d00: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc ==================================================================