================================================================== 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: 7611 Comm: kworker/1:22 Not tainted 6.0.0-syzkaller-05118-g833477fce7a1 #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 12694: 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_reinit_congestion_control net/ipv4/tcp_cong.c:217 [inline] tcp_set_congestion_control+0x76b/0xa30 net/ipv4/tcp_cong.c:391 do_tcp_setsockopt+0x592/0x2460 net/ipv4/tcp.c:3513 mptcp_setsockopt+0x2b08/0x3a90 net/mptcp/sockopt.c:844 __sys_setsockopt+0x65d/0xa00 net/socket.c:2252 __do_sys_setsockopt net/socket.c:2263 [inline] __se_sys_setsockopt net/socket.c:2260 [inline] __x64_sys_setsockopt+0xb1/0xc0 net/socket.c:2260 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 22: 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+0x1908/0x2280 net/ipv4/tcp_input.c:6624 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 ffff88801cc99600 which belongs to the cache kmalloc-64 of size 64 The buggy address is located 0 bytes inside of 64-byte region [ffff88801cc99600, ffff88801cc99640) The buggy address belongs to the physical page: page:ffffea0000732640 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1cc99 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea0001d74e40 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 0x12c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY), pid 2976, tgid 2976 (udevadm), ts 14489974414, free_ts 14467449092 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_check_open_permission+0x22f/0x490 security/tomoyo/file.c:771 security_file_open+0x50/0x560 security/security.c:1646 do_dentry_open+0x34c/0x1180 fs/open.c:867 do_open fs/namei.c:3557 [inline] path_openat+0x260e/0x2e00 fs/namei.c:3691 do_filp_open+0x275/0x500 fs/namei.c:3718 do_sys_openat2+0x13b/0x500 fs/open.c:1313 do_sys_open fs/open.c:1329 [inline] __do_sys_openat fs/open.c:1345 [inline] __se_sys_openat fs/open.c:1340 [inline] __x64_sys_openat+0x243/0x290 fs/open.c:1340 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 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: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] __kmalloc+0x1bd/0x370 mm/slub.c:4425 kmalloc include/linux/slab.h:605 [inline] tomoyo_realpath_from_path+0xd8/0x5f0 security/tomoyo/realpath.c:254 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_check_open_permission+0x22f/0x490 security/tomoyo/file.c:771 security_file_open+0x50/0x560 security/security.c:1646 do_dentry_open+0x34c/0x1180 fs/open.c:867 do_open fs/namei.c:3557 [inline] path_openat+0x260e/0x2e00 fs/namei.c:3691 do_filp_open+0x275/0x500 fs/namei.c:3718 do_sys_openat2+0x13b/0x500 fs/open.c:1313 do_sys_open fs/open.c:1329 [inline] __do_sys_openat fs/open.c:1345 [inline] __se_sys_openat fs/open.c:1340 [inline] __x64_sys_openat+0x243/0x290 fs/open.c:1340 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: ffff88801cc99500: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc ffff88801cc99580: 00 00 00 00 01 fc fc fc fc fc fc fc fc fc fc fc >ffff88801cc99600: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ^ ffff88801cc99680: 00 00 00 00 01 fc fc fc fc fc fc fc fc fc fc fc ffff88801cc99700: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ==================================================================