================================================================== BUG: KASAN: use-after-free in mptcp_pm_nl_rm_addr_or_subflow+0x6b8/0xcf0 net/mptcp/pm_netlink.c:792 Read of size 4 at addr ffff888017251850 by task syz.0.22/3722 CPU: 1 PID: 3722 Comm: syz.0.22 Not tainted 5.15.167-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106 print_address_description+0x63/0x3b0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:434 [inline] kasan_report+0x16b/0x1c0 mm/kasan/report.c:451 mptcp_pm_nl_rm_addr_or_subflow+0x6b8/0xcf0 net/mptcp/pm_netlink.c:792 mptcp_pm_nl_rm_subflow_received net/mptcp/pm_netlink.c:823 [inline] mptcp_nl_remove_id_zero_address net/mptcp/pm_netlink.c:1453 [inline] mptcp_nl_cmd_del_addr+0x85a/0x17e0 net/mptcp/pm_netlink.c:1483 genl_family_rcv_msg_doit net/netlink/genetlink.c:731 [inline] genl_family_rcv_msg net/netlink/genetlink.c:775 [inline] genl_rcv_msg+0xfbd/0x14a0 net/netlink/genetlink.c:792 netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2503 genl_rcv+0x24/0x40 net/netlink/genetlink.c:803 netlink_unicast_kernel net/netlink/af_netlink.c:1326 [inline] netlink_unicast+0x7b6/0x980 net/netlink/af_netlink.c:1352 netlink_sendmsg+0xa30/0xd60 net/netlink/af_netlink.c:1920 sock_sendmsg_nosec net/socket.c:704 [inline] __sock_sendmsg net/socket.c:716 [inline] ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2431 ___sys_sendmsg+0x252/0x2e0 net/socket.c:2485 __sys_sendmsg net/socket.c:2514 [inline] __do_sys_sendmsg net/socket.c:2523 [inline] __se_sys_sendmsg+0x19a/0x260 net/socket.c:2521 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 RIP: 0033:0x7f6f2ae7eff9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f6f292f7038 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f6f2b036f80 RCX: 00007f6f2ae7eff9 RDX: 0000000000000000 RSI: 0000000020000140 RDI: 0000000000000005 RBP: 00007f6f2aef1296 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f6f2b036f80 R15: 00007ffd2335c908 Allocated by task 3722: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:434 [inline] ____kasan_kmalloc+0xba/0xf0 mm/kasan/common.c:513 kasan_kmalloc include/linux/kasan.h:264 [inline] kmem_cache_alloc_trace+0x143/0x290 mm/slub.c:3247 kmalloc include/linux/slab.h:591 [inline] kzalloc include/linux/slab.h:721 [inline] subflow_create_ctx net/mptcp/subflow.c:1607 [inline] subflow_ulp_init+0x8f/0x470 net/mptcp/subflow.c:1690 __tcp_set_ulp net/ipv4/tcp_ulp.c:143 [inline] tcp_set_ulp+0x498/0x550 net/ipv4/tcp_ulp.c:164 mptcp_subflow_create_socket+0x64f/0xc10 net/mptcp/subflow.c:1572 __mptcp_socket_create net/mptcp/protocol.c:108 [inline] mptcp_init_sock+0x114/0x790 net/mptcp/protocol.c:2579 inet_create+0xa35/0xd40 net/ipv4/af_inet.c:383 __sock_create+0x460/0x8d0 net/socket.c:1486 sock_create net/socket.c:1537 [inline] __sys_socket+0x132/0x370 net/socket.c:1579 __do_sys_socket net/socket.c:1588 [inline] __se_sys_socket net/socket.c:1586 [inline] __x64_sys_socket+0x76/0x80 net/socket.c:1586 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 Freed by task 3610: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4b/0x80 mm/kasan/common.c:46 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360 ____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:366 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:1705 [inline] slab_free_freelist_hook+0xdd/0x160 mm/slub.c:1731 slab_free mm/slub.c:3499 [inline] kmem_cache_free_bulk+0x28f/0x4c0 mm/slub.c:3640 kfree_bulk include/linux/slab.h:448 [inline] kfree_rcu_work+0x332/0x7a0 kernel/rcu/tree.c:3295 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310 worker_thread+0xaca/0x1280 kernel/workqueue.c:2457 kthread+0x3f6/0x4f0 kernel/kthread.c:334 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 Last potentially related work creation: kasan_save_stack+0x36/0x60 mm/kasan/common.c:38 kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348 kvfree_call_rcu+0x118/0x8a0 kernel/rcu/tree.c:3596 tcp_cleanup_ulp+0x6d/0xe0 net/ipv4/tcp_ulp.c:124 tcp_v4_destroy_sock+0x184/0x700 net/ipv4/tcp_ipv4.c:2297 inet_csk_destroy_sock+0x153/0x370 net/ipv4/inet_connection_sock.c:1040 __tcp_close+0x890/0xec0 net/ipv4/tcp.c:2881 __mptcp_close_ssk+0x1ff/0x470 net/mptcp/protocol.c:2314 mptcp_pm_nl_rm_addr_or_subflow+0x4b4/0xcf0 net/mptcp/pm_netlink.c:789 mptcp_pm_nl_rm_subflow_received net/mptcp/pm_netlink.c:823 [inline] mptcp_nl_remove_id_zero_address net/mptcp/pm_netlink.c:1453 [inline] mptcp_nl_cmd_del_addr+0x85a/0x17e0 net/mptcp/pm_netlink.c:1483 genl_family_rcv_msg_doit net/netlink/genetlink.c:731 [inline] genl_family_rcv_msg net/netlink/genetlink.c:775 [inline] genl_rcv_msg+0xfbd/0x14a0 net/netlink/genetlink.c:792 netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2503 genl_rcv+0x24/0x40 net/netlink/genetlink.c:803 netlink_unicast_kernel net/netlink/af_netlink.c:1326 [inline] netlink_unicast+0x7b6/0x980 net/netlink/af_netlink.c:1352 netlink_sendmsg+0xa30/0xd60 net/netlink/af_netlink.c:1920 sock_sendmsg_nosec net/socket.c:704 [inline] __sock_sendmsg net/socket.c:716 [inline] ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2431 ___sys_sendmsg+0x252/0x2e0 net/socket.c:2485 __sys_sendmsg net/socket.c:2514 [inline] __do_sys_sendmsg net/socket.c:2523 [inline] __se_sys_sendmsg+0x19a/0x260 net/socket.c:2521 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 Second to last potentially related work creation: kasan_save_stack+0x36/0x60 mm/kasan/common.c:38 kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348 __call_rcu kernel/rcu/tree.c:3007 [inline] call_rcu+0x1c4/0xa70 kernel/rcu/tree.c:3087 fib_create_info+0x190d/0x2570 net/ipv4/fib_semantics.c:1608 fib_table_insert+0x213/0x1f90 net/ipv4/fib_trie.c:1231 fib_magic net/ipv4/fib_frontend.c:1093 [inline] fib_add_ifaddr+0xf4c/0x1730 net/ipv4/fib_frontend.c:1137 fib_inetaddr_event+0x12b/0x2b0 net/ipv4/fib_frontend.c:1429 notifier_call_chain kernel/notifier.c:83 [inline] blocking_notifier_call_chain+0x104/0x1b0 kernel/notifier.c:318 __inet_insert_ifa+0x9f8/0xc10 net/ipv4/devinet.c:553 inet_rtm_newaddr+0x8ca/0x1840 net/ipv4/devinet.c:956 rtnetlink_rcv_msg+0x993/0xee0 net/core/rtnetlink.c:5618 netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2503 netlink_unicast_kernel net/netlink/af_netlink.c:1326 [inline] netlink_unicast+0x7b6/0x980 net/netlink/af_netlink.c:1352 netlink_sendmsg+0xa30/0xd60 net/netlink/af_netlink.c:1920 sock_sendmsg_nosec net/socket.c:704 [inline] __sock_sendmsg net/socket.c:716 [inline] ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2431 ___sys_sendmsg+0x252/0x2e0 net/socket.c:2485 __sys_sendmsg net/socket.c:2514 [inline] __do_sys_sendmsg net/socket.c:2523 [inline] __se_sys_sendmsg+0x19a/0x260 net/socket.c:2521 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 The buggy address belongs to the object at ffff888017251800 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 80 bytes inside of 256-byte region [ffff888017251800, ffff888017251900) The buggy address belongs to the page: page:ffffea00005c9400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x17250 head:ffffea00005c9400 order:1 compound_mapcount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 0000000000000000 0000000100000001 ffff888017041b40 raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 1, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 1, ts 2462683080, free_ts 0 prep_new_page mm/page_alloc.c:2426 [inline] get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159 __alloc_pages+0x272/0x700 mm/page_alloc.c:5423 alloc_page_interleave+0x22/0x1c0 mm/mempolicy.c:2031 alloc_slab_page mm/slub.c:1775 [inline] allocate_slab mm/slub.c:1912 [inline] new_slab+0xbb/0x4b0 mm/slub.c:1975 ___slab_alloc+0x6f6/0xe10 mm/slub.c:3008 __slab_alloc mm/slub.c:3095 [inline] slab_alloc_node mm/slub.c:3186 [inline] slab_alloc mm/slub.c:3228 [inline] __kmalloc_track_caller+0x1c7/0x300 mm/slub.c:4925 __do_krealloc mm/slab_common.c:1217 [inline] krealloc+0x4b/0xc0 mm/slab_common.c:1250 add_sysfs_param+0xca/0x7f0 kernel/params.c:651 kernel_add_sysfs_param+0xb0/0x130 kernel/params.c:812 param_sysfs_builtin+0x16a/0x1f0 kernel/params.c:851 param_sysfs_init+0x66/0x70 kernel/params.c:970 do_one_initcall+0x22b/0x7a0 init/main.c:1302 do_initcall_level+0x157/0x210 init/main.c:1375 do_initcalls+0x49/0x90 init/main.c:1391 kernel_init_freeable+0x425/0x5c0 init/main.c:1615 kernel_init+0x19/0x290 init/main.c:1506 page_owner free stack trace missing Memory state around the buggy address: ffff888017251700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888017251780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888017251800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888017251880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888017251900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================