================================================================== BUG: KASAN: double-free in slab_free mm/slub.c:3539 [inline] BUG: KASAN: double-free in kfree+0xda/0x210 mm/slub.c:4567 CPU: 1 PID: 6045 Comm: kworker/1:10 Not tainted 6.0.0-syzkaller-03015-g2bca25eaeba6 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022 Workqueue: events mptcp_worker Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 print_address_description+0x65/0x4b0 mm/kasan/report.c:317 print_report+0x108/0x220 mm/kasan/report.c:433 kasan_report_invalid_free+0xb9/0xd0 mm/kasan/report.c:462 ____kasan_slab_free+0xfd/0x120 kasan_slab_free include/linux/kasan.h:200 [inline] slab_free_hook mm/slub.c:1759 [inline] slab_free_freelist_hook+0x12e/0x1a0 mm/slub.c:1785 slab_free mm/slub.c:3539 [inline] kfree+0xda/0x210 mm/slub.c:4567 tcp_disconnect+0x9ee/0x1a10 net/ipv4/tcp.c:3145 __mptcp_close_ssk+0x31a/0x6a0 net/mptcp/protocol.c:2327 mptcp_do_fastclose net/mptcp/protocol.c:2592 [inline] mptcp_worker+0x67b/0xfe0 net/mptcp/protocol.c:2627 process_one_work+0x81c/0xd10 kernel/workqueue.c:2289 worker_thread+0xb14/0x1330 kernel/workqueue.c:2436 kthread+0x266/0x300 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 Allocated by task 7138: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:437 [inline] ____kasan_kmalloc+0xdc/0x110 mm/kasan/common.c:516 kasan_kmalloc include/linux/kasan.h:234 [inline] __kmalloc+0x226/0x370 mm/slub.c:4429 kmalloc_array include/linux/slab.h:640 [inline] kcalloc include/linux/slab.h:671 [inline] tcp_cdg_init+0x4f/0x140 net/ipv4/tcp_cdg.c:380 tcp_init_congestion_control+0x97/0x5d0 net/ipv4/tcp_cong.c:193 tcp_init_transfer+0x328/0xee0 net/ipv4/tcp_input.c:6045 tcp_finish_connect+0x1c7/0x5f0 net/ipv4/tcp_input.c:6063 tcp_rcv_synsent_state_process+0x12e0/0x2520 net/ipv4/tcp_input.c:6285 tcp_rcv_state_process+0x269/0x2280 net/ipv4/tcp_input.c:6488 tcp_v6_do_rcv+0x935/0x1260 net/ipv6/tcp_ipv6.c:1525 sk_backlog_rcv include/net/sock.h:1109 [inline] __release_sock+0x1d8/0x4c0 net/core/sock.c:2906 release_sock+0x5d/0x1c0 net/core/sock.c:3462 inet_wait_for_connect net/ipv4/af_inet.c:593 [inline] __inet_stream_connect+0x71f/0xe10 net/ipv4/af_inet.c:685 inet_stream_connect+0x61/0xa0 net/ipv4/af_inet.c:724 mptcp_stream_connect+0x601/0xa90 net/mptcp/protocol.c:3622 __sys_connect_file net/socket.c:1976 [inline] __sys_connect+0x29b/0x2d0 net/socket.c:1993 __do_sys_connect net/socket.c:2003 [inline] __se_sys_connect net/socket.c:2000 [inline] __x64_sys_connect+0x76/0x80 net/socket.c:2000 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 92: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4c/0x70 mm/kasan/common.c:45 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:370 ____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:367 kasan_slab_free include/linux/kasan.h:200 [inline] slab_free_hook mm/slub.c:1759 [inline] slab_free_freelist_hook+0x12e/0x1a0 mm/slub.c:1785 slab_free mm/slub.c:3539 [inline] kfree+0xda/0x210 mm/slub.c:4567 tcp_cleanup_congestion_control+0x69/0xf0 net/ipv4/tcp_cong.c:226 tcp_v4_destroy_sock+0xfc/0x520 net/ipv4/tcp_ipv4.c:2254 tcp_v6_destroy_sock+0x11/0x20 net/ipv6/tcp_ipv6.c:1969 inet_csk_destroy_sock+0x155/0x390 net/ipv4/inet_connection_sock.c:1157 tcp_rcv_state_process+0x18a5/0x2280 net/ipv4/tcp_input.c:6607 tcp_v6_do_rcv+0x935/0x1260 net/ipv6/tcp_ipv6.c:1525 tcp_v6_rcv+0x2347/0x2b50 net/ipv6/tcp_ipv6.c:1759 ip6_protocol_deliver_rcu+0xb22/0x1300 net/ipv6/ip6_input.c:439 ip6_input_finish+0x140/0x260 net/ipv6/ip6_input.c:484 ip_sabotage_in+0x1a9/0x210 net/bridge/br_netfilter_hooks.c:874 nf_hook_entry_hookfn include/linux/netfilter.h:142 [inline] nf_hook_slow+0xae/0x1e0 net/netfilter/core.c:614 nf_hook+0x235/0x3a0 include/linux/netfilter.h:257 NF_HOOK include/linux/netfilter.h:300 [inline] ipv6_rcv+0x87/0xd0 net/ipv6/ip6_input.c:309 __netif_receive_skb_one_core net/core/dev.c:5485 [inline] __netif_receive_skb+0x1c5/0x500 net/core/dev.c:5599 netif_receive_skb_internal+0x108/0x360 net/core/dev.c:5685 netif_receive_skb+0x19/0x30 net/core/dev.c:5744 br_handle_frame_finish+0x1608/0x1bd0 br_nf_hook_thresh+0x478/0x560 net/bridge/br_netfilter_hooks.c:1041 br_nf_pre_routing_finish_ipv6+0xa19/0xcc0 NF_HOOK include/linux/netfilter.h:302 [inline] br_nf_pre_routing_ipv6+0x294/0x340 net/bridge/br_netfilter_ipv6.c:237 nf_hook_entry_hookfn include/linux/netfilter.h:142 [inline] nf_hook_bridge_pre net/bridge/br_input.c:255 [inline] br_handle_frame+0x9b4/0x1310 net/bridge/br_input.c:399 __netif_receive_skb_core+0x1448/0x3c00 net/core/dev.c:5379 __netif_receive_skb_one_core net/core/dev.c:5483 [inline] __netif_receive_skb+0x11a/0x500 net/core/dev.c:5599 process_backlog+0x4f8/0x8b0 net/core/dev.c:5927 __napi_poll+0xbe/0x4b0 net/core/dev.c:6494 napi_poll net/core/dev.c:6561 [inline] net_rx_action+0x76c/0x10b0 net/core/dev.c:6672 __do_softirq+0x277/0x75b kernel/softirq.c:571 The buggy address belongs to the object at ffff88801fb07180 which belongs to the cache kmalloc-64 of size 64 The buggy address is located 0 bytes inside of 64-byte region [ffff88801fb07180, ffff88801fb071c0) The buggy address belongs to the physical page: page:ffffea00007ec1c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1fb07 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea0001a8a9c0 dead000000000002 ffff888012041640 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 0x112c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_HARDWALL), pid 2974, tgid 2974 (udevd), ts 366367408603, free_ts 366364158839 prep_new_page mm/page_alloc.c:2532 [inline] get_page_from_freelist+0x72b/0x7a0 mm/page_alloc.c:4283 __alloc_pages+0x259/0x560 mm/page_alloc.c:5549 alloc_slab_page+0x70/0xf0 mm/slub.c:1829 allocate_slab+0x5e/0x520 mm/slub.c:1974 new_slab mm/slub.c:2034 [inline] ___slab_alloc+0x42e/0xce0 mm/slub.c:3036 __slab_alloc mm/slub.c:3123 [inline] slab_alloc_node mm/slub.c:3214 [inline] slab_alloc mm/slub.c:3256 [inline] __kmalloc+0x2bd/0x370 mm/slub.c:4425 kmalloc include/linux/slab.h:605 [inline] kzalloc include/linux/slab.h:733 [inline] tomoyo_encode2 security/tomoyo/realpath.c:45 [inline] tomoyo_encode+0x26f/0x540 security/tomoyo/realpath.c:80 tomoyo_realpath_from_path+0x5b4/0x5f0 security/tomoyo/realpath.c:288 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x270/0x6b0 security/tomoyo/file.c:822 security_inode_getattr+0xc0/0x140 security/security.c:1345 vfs_getattr+0x26/0x360 fs/stat.c:158 vfs_statx+0x1b5/0x4e0 fs/stat.c:233 vfs_fstatat fs/stat.c:267 [inline] __do_sys_newfstatat fs/stat.c:437 [inline] __se_sys_newfstatat+0x104/0x7b0 fs/stat.c:431 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1449 [inline] free_pcp_prepare+0x812/0x900 mm/page_alloc.c:1499 free_unref_page_prepare mm/page_alloc.c:3380 [inline] free_unref_page+0x7d/0x630 mm/page_alloc.c:3476 qlist_free_all+0x2b/0x70 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x169/0x180 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x2f/0xe0 mm/kasan/common.c:447 kasan_slab_alloc include/linux/kasan.h:224 [inline] slab_post_alloc_hook mm/slab.h:727 [inline] slab_alloc_node mm/slub.c:3248 [inline] slab_alloc mm/slub.c:3256 [inline] __kmem_cache_alloc_lru mm/slub.c:3263 [inline] kmem_cache_alloc+0x1a6/0x310 mm/slub.c:3273 getname_flags+0xb8/0x4e0 fs/namei.c:139 vfs_fstatat fs/stat.c:266 [inline] __do_sys_newfstatat fs/stat.c:437 [inline] __se_sys_newfstatat+0xe2/0x7b0 fs/stat.c:431 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffff88801fb07080: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc ffff88801fb07100: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc >ffff88801fb07180: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ^ ffff88801fb07200: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff88801fb07280: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ==================================================================