================================================================== BUG: KASAN: use-after-free in cleanup_bearer+0x1ce/0x2b0 net/tipc/udp_media.c:815 Read of size 8 at addr ffff88812c20c3d8 by task kworker/1:8/1271 CPU: 1 PID: 1271 Comm: kworker/1:8 Tainted: G W 5.10.231-syzkaller-00700-g4055d754db6f #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Workqueue: events cleanup_bearer Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118 print_address_description+0x81/0x3b0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:435 [inline] kasan_report+0x179/0x1c0 mm/kasan/report.c:452 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:309 cleanup_bearer+0x1ce/0x2b0 net/tipc/udp_media.c:815 process_one_work+0x6dc/0xbd0 kernel/workqueue.c:2301 worker_thread+0xaea/0x1510 kernel/workqueue.c:2447 kthread+0x34b/0x3d0 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 Allocated by task 1635: 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:430 [inline] __kasan_slab_alloc+0xb1/0xe0 mm/kasan/common.c:463 kasan_slab_alloc include/linux/kasan.h:244 [inline] slab_post_alloc_hook+0x61/0x2f0 mm/slab.h:583 slab_alloc_node mm/slub.c:2947 [inline] slab_alloc mm/slub.c:2955 [inline] kmem_cache_alloc+0x168/0x2e0 mm/slub.c:2960 sock_alloc_inode+0x1b/0xb0 net/socket.c:253 alloc_inode fs/inode.c:233 [inline] new_inode_pseudo+0x64/0x220 fs/inode.c:968 sock_alloc net/socket.c:574 [inline] __sock_create+0x135/0x760 net/socket.c:1400 sock_create_kern+0x3b/0x50 net/socket.c:1505 udp_sock_create4+0xd6/0x670 net/ipv4/udp_tunnel_core.c:20 udp_sock_create+0x78/0xb0 include/net/udp_tunnel.h:59 tipc_udp_enable+0xeb6/0x1670 net/tipc/udp_media.c:765 tipc_enable_bearer net/tipc/bearer.c:323 [inline] __tipc_nl_bearer_enable+0x9d5/0x1140 net/tipc/bearer.c:1020 tipc_nl_bearer_enable+0x22/0x30 net/tipc/bearer.c:1029 genl_family_rcv_msg_doit net/netlink/genetlink.c:739 [inline] genl_family_rcv_msg net/netlink/genetlink.c:783 [inline] genl_rcv_msg+0x115d/0x16e0 net/netlink/genetlink.c:800 netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2485 genl_rcv+0x28/0x40 net/netlink/genetlink.c:811 netlink_unicast_kernel net/netlink/af_netlink.c:1307 [inline] netlink_unicast+0x8df/0xac0 net/netlink/af_netlink.c:1333 netlink_sendmsg+0xa46/0xd00 net/netlink/af_netlink.c:1901 sock_sendmsg_nosec net/socket.c:652 [inline] __sock_sendmsg net/socket.c:664 [inline] ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2376 ___sys_sendmsg+0x252/0x2e0 net/socket.c:2430 __sys_sendmsg net/socket.c:2459 [inline] __do_sys_sendmsg net/socket.c:2468 [inline] __se_sys_sendmsg+0x1b1/0x280 net/socket.c:2466 __x64_sys_sendmsg+0x7b/0x90 net/socket.c:2466 do_syscall_64+0x34/0x70 entry_SYSCALL_64_after_hwframe+0x61/0xcb Freed by task 2170: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:45 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370 ____kasan_slab_free+0x121/0x160 mm/kasan/common.c:362 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:370 kasan_slab_free include/linux/kasan.h:220 [inline] slab_free_hook mm/slub.c:1595 [inline] slab_free_freelist_hook+0xc0/0x190 mm/slub.c:1621 slab_free mm/slub.c:3203 [inline] kmem_cache_free+0xa9/0x1e0 mm/slub.c:3219 sock_free_inode+0x20/0x30 net/socket.c:274 i_callback+0x4b/0x70 fs/inode.c:222 rcu_do_batch+0x597/0xc40 kernel/rcu/tree.c:2494 rcu_core+0x5ad/0xe40 kernel/rcu/tree.c:2735 rcu_core_si+0x9/0x10 kernel/rcu/tree.c:2748 __do_softirq+0x268/0x5bb kernel/softirq.c:309 Last potentially related work creation: kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38 __kasan_record_aux_stack+0xd3/0x100 mm/kasan/generic.c:348 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358 __call_rcu kernel/rcu/tree.c:2976 [inline] call_rcu+0x135/0x11f0 kernel/rcu/tree.c:3050 destroy_inode fs/inode.c:288 [inline] evict+0x8e8/0x9c0 fs/inode.c:629 iput_final fs/inode.c:1736 [inline] iput+0x632/0x7e0 fs/inode.c:1762 __sock_release net/socket.c:609 [inline] sock_release+0x110/0x140 net/socket.c:625 udp_tunnel_sock_release+0x76/0x80 net/ipv4/udp_tunnel_core.c:199 cleanup_bearer+0x19d/0x2b0 net/tipc/udp_media.c:813 process_one_work+0x6dc/0xbd0 kernel/workqueue.c:2301 worker_thread+0xaea/0x1510 kernel/workqueue.c:2447 kthread+0x34b/0x3d0 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 Second to last potentially related work creation: kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38 __kasan_record_aux_stack+0xd3/0x100 mm/kasan/generic.c:348 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358 __call_rcu kernel/rcu/tree.c:2976 [inline] call_rcu+0x135/0x11f0 kernel/rcu/tree.c:3050 destroy_inode fs/inode.c:288 [inline] evict+0x8e8/0x9c0 fs/inode.c:629 iput_final fs/inode.c:1736 [inline] iput+0x632/0x7e0 fs/inode.c:1762 __sock_release net/socket.c:609 [inline] sock_release+0x110/0x140 net/socket.c:625 udp_tunnel_sock_release+0x76/0x80 net/ipv4/udp_tunnel_core.c:199 sock_free drivers/net/wireguard/socket.c:339 [inline] wg_socket_reinit+0x1b5/0x210 drivers/net/wireguard/socket.c:436 wg_netns_pre_exit+0xd3/0x1a0 drivers/net/wireguard/device.c:411 ops_pre_exit_list net/core/net_namespace.c:175 [inline] cleanup_net+0x540/0xcb0 net/core/net_namespace.c:597 process_one_work+0x6dc/0xbd0 kernel/workqueue.c:2301 worker_thread+0xaea/0x1510 kernel/workqueue.c:2447 kthread+0x34b/0x3d0 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 The buggy address belongs to the object at ffff88812c20c3c0 which belongs to the cache sock_inode_cache of size 832 The buggy address is located 24 bytes inside of 832-byte region [ffff88812c20c3c0, ffff88812c20c700) The buggy address belongs to the page: page:ffffea0004b08300 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x12c20c head:ffffea0004b08300 order:2 compound_mapcount:0 compound_pincount:0 flags: 0x4000000000010200(slab|head) raw: 4000000000010200 ffffea00046f6600 0000000300000003 ffff888107d94d80 raw: 0000000000000000 0000000000110011 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 2, migratetype Reclaimable, gfp_mask 0x1d20d0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL|__GFP_RECLAIMABLE), pid 1208, ts 102760791456, free_ts 94812969136 set_page_owner include/linux/page_owner.h:35 [inline] post_alloc_hook mm/page_alloc.c:2456 [inline] prep_new_page+0x166/0x180 mm/page_alloc.c:2462 get_page_from_freelist+0x2d8c/0x2f30 mm/page_alloc.c:4254 __alloc_pages_nodemask+0x435/0xaf0 mm/page_alloc.c:5348 allocate_slab mm/slub.c:1808 [inline] new_slab+0x80/0x400 mm/slub.c:1869 new_slab_objects mm/slub.c:2627 [inline] ___slab_alloc+0x302/0x4b0 mm/slub.c:2791 __slab_alloc+0x63/0xa0 mm/slub.c:2831 slab_alloc_node mm/slub.c:2913 [inline] slab_alloc mm/slub.c:2955 [inline] kmem_cache_alloc+0x1b9/0x2e0 mm/slub.c:2960 sock_alloc_inode+0x1b/0xb0 net/socket.c:253 alloc_inode fs/inode.c:233 [inline] new_inode_pseudo+0x64/0x220 fs/inode.c:968 sock_alloc net/socket.c:574 [inline] __sock_create+0x135/0x760 net/socket.c:1400 sock_create net/socket.c:1487 [inline] __sys_socket+0x132/0x370 net/socket.c:1529 __do_sys_socket net/socket.c:1538 [inline] __se_sys_socket net/socket.c:1536 [inline] __x64_sys_socket+0x7a/0x90 net/socket.c:1536 do_syscall_64+0x34/0x70 entry_SYSCALL_64_after_hwframe+0x61/0xcb page last free stack trace: reset_page_owner include/linux/page_owner.h:28 [inline] free_pages_prepare mm/page_alloc.c:1349 [inline] __free_pages_ok+0x82c/0x850 mm/page_alloc.c:1629 free_the_page+0x76/0x370 mm/page_alloc.c:5409 __free_pages+0x67/0xc0 mm/page_alloc.c:5418 __free_slab+0xcf/0x190 mm/slub.c:1894 free_slab mm/slub.c:1909 [inline] discard_slab mm/slub.c:1915 [inline] unfreeze_partials+0x15e/0x190 mm/slub.c:2410 put_cpu_partial+0xbf/0x180 mm/slub.c:2446 __slab_free+0x2c8/0x3a0 mm/slub.c:3095 do_slab_free mm/slub.c:3191 [inline] ___cache_free+0x111/0x130 mm/slub.c:3210 qlink_free+0x50/0x90 mm/kasan/quarantine.c:157 qlist_free_all+0x47/0xb0 mm/kasan/quarantine.c:176 kasan_quarantine_reduce+0x15a/0x170 mm/kasan/quarantine.c:283 __kasan_slab_alloc+0x2f/0xe0 mm/kasan/common.c:440 kasan_slab_alloc include/linux/kasan.h:244 [inline] slab_post_alloc_hook+0x61/0x2f0 mm/slab.h:583 slab_alloc_node mm/slub.c:2947 [inline] slab_alloc mm/slub.c:2955 [inline] kmem_cache_alloc+0x168/0x2e0 mm/slub.c:2960 getname_flags+0xba/0x520 fs/namei.c:141 user_path_at_empty+0x2d/0x50 fs/namei.c:2740 Memory state around the buggy address: ffff88812c20c280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88812c20c300: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc >ffff88812c20c380: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb ^ ffff88812c20c400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88812c20c480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== general protection fault, probably for non-canonical address 0xdffffc0000000006: 0000 [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000030-0x0000000000000037] CPU: 1 PID: 1271 Comm: kworker/1:8 Tainted: G B W 5.10.231-syzkaller-00700-g4055d754db6f #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Workqueue: events cleanup_bearer RIP: 0010:read_pnet include/net/net_namespace.h:335 [inline] RIP: 0010:sock_net include/net/sock.h:2653 [inline] RIP: 0010:cleanup_bearer+0x1dc/0x2b0 net/tipc/udp_media.c:815 Code: 8b 1e 48 83 c3 18 48 89 d8 48 c1 e8 03 42 80 3c 28 00 74 08 48 89 df e8 42 16 0a fd 48 8b 1b 48 83 c3 30 48 89 d8 48 c1 e8 03 <42> 80 3c 28 00 74 08 48 89 df e8 25 16 0a fd 4c 8b 33 48 c7 c0 80 RSP: 0018:ffffc90000b17cf0 EFLAGS: 00010206 RAX: 0000000000000006 RBX: 0000000000000030 RCX: ffff888104d83b40 RDX: 0000000000000000 RSI: 0000000000000282 RDI: 00000000ffffffff RBP: ffffc90000b17d30 R08: ffffffff813e2b7b R09: 0000000000000003 R10: fffffbfff0e11248 R11: dffffc0000000001 R12: ffff88810e895480 R13: dffffc0000000000 R14: ffff8881234d8908 R15: ffff8881234d8918 FS: 0000000000000000(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00005555694c14a8 CR3: 000000011cd3b000 CR4: 00000000003506a0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: process_one_work+0x6dc/0xbd0 kernel/workqueue.c:2301 worker_thread+0xaea/0x1510 kernel/workqueue.c:2447 kthread+0x34b/0x3d0 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 Modules linked in: ---[ end trace 20b0be3a6b655ac5 ]--- RIP: 0010:read_pnet include/net/net_namespace.h:335 [inline] RIP: 0010:sock_net include/net/sock.h:2653 [inline] RIP: 0010:cleanup_bearer+0x1dc/0x2b0 net/tipc/udp_media.c:815 Code: 8b 1e 48 83 c3 18 48 89 d8 48 c1 e8 03 42 80 3c 28 00 74 08 48 89 df e8 42 16 0a fd 48 8b 1b 48 83 c3 30 48 89 d8 48 c1 e8 03 <42> 80 3c 28 00 74 08 48 89 df e8 25 16 0a fd 4c 8b 33 48 c7 c0 80 RSP: 0018:ffffc90000b17cf0 EFLAGS: 00010206 RAX: 0000000000000006 RBX: 0000000000000030 RCX: ffff888104d83b40 RDX: 0000000000000000 RSI: 0000000000000282 RDI: 00000000ffffffff RBP: ffffc90000b17d30 R08: ffffffff813e2b7b R09: 0000000000000003 R10: fffffbfff0e11248 R11: dffffc0000000001 R12: ffff88810e895480 R13: dffffc0000000000 R14: ffff8881234d8908 R15: ffff8881234d8918 FS: 0000000000000000(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00005555694c14a8 CR3: 000000010d194000 CR4: 00000000003506a0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 ---------------- Code disassembly (best guess): 0: 8b 1e mov (%rsi),%ebx 2: 48 83 c3 18 add $0x18,%rbx 6: 48 89 d8 mov %rbx,%rax 9: 48 c1 e8 03 shr $0x3,%rax d: 42 80 3c 28 00 cmpb $0x0,(%rax,%r13,1) 12: 74 08 je 0x1c 14: 48 89 df mov %rbx,%rdi 17: e8 42 16 0a fd call 0xfd0a165e 1c: 48 8b 1b mov (%rbx),%rbx 1f: 48 83 c3 30 add $0x30,%rbx 23: 48 89 d8 mov %rbx,%rax 26: 48 c1 e8 03 shr $0x3,%rax * 2a: 42 80 3c 28 00 cmpb $0x0,(%rax,%r13,1) <-- trapping instruction 2f: 74 08 je 0x39 31: 48 89 df mov %rbx,%rdi 34: e8 25 16 0a fd call 0xfd0a165e 39: 4c 8b 33 mov (%rbx),%r14 3c: 48 rex.W 3d: c7 .byte 0xc7 3e: c0 .byte 0xc0 3f: 80 .byte 0x80