================================================================== BUG: KASAN: use-after-free in cleanup_bearer+0x1ce/0x2b0 net/tipc/udp_media.c:815 Read of size 8 at addr ffff88811bce21d8 by task kworker/1:56/515 CPU: 1 PID: 515 Comm: kworker/1:56 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 1358: 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 0: 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 dentry_unlink_inode+0x2ea/0x3d0 fs/dcache.c:378 __dentry_kill+0x447/0x650 fs/dcache.c:583 dentry_kill+0xc0/0x2a0 dput+0x40/0x80 fs/dcache.c:883 __fput+0x52e/0x7b0 fs/file_table.c:294 ____fput+0x15/0x20 fs/file_table.c:314 task_work_run+0x129/0x190 kernel/task_work.c:189 exit_task_work include/linux/task_work.h:33 [inline] do_exit+0xc83/0x2a50 kernel/exit.c:863 do_group_exit+0x141/0x310 kernel/exit.c:985 get_signal+0x10a0/0x1410 kernel/signal.c:2793 arch_do_signal_or_restart+0xbd/0x17c0 arch/x86/kernel/signal.c:805 handle_signal_work kernel/entry/common.c:145 [inline] exit_to_user_mode_loop+0x9b/0xd0 kernel/entry/common.c:169 exit_to_user_mode_prepare kernel/entry/common.c:199 [inline] syscall_exit_to_user_mode+0xa2/0x1a0 kernel/entry/common.c:274 ret_from_fork+0x15/0x30 arch/x86/entry/entry_64.S:291 The buggy address belongs to the object at ffff88811bce21c0 which belongs to the cache sock_inode_cache of size 832 The buggy address is located 24 bytes inside of 832-byte region [ffff88811bce21c0, ffff88811bce2500) The buggy address belongs to the page: page:ffffea00046f3800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11bce0 head:ffffea00046f3800 order:2 compound_mapcount:0 compound_pincount:0 flags: 0x4000000000010200(slab|head) raw: 4000000000010200 0000000000000000 0000000100000001 ffff888107d94000 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 0xd20d0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_RECLAIMABLE), pid 289, ts 27159043866, free_ts 0 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_lite+0x8d/0x500 net/socket.c:1235 __netlink_kernel_create+0x12f/0x910 net/netlink/af_netlink.c:2024 netlink_kernel_create include/linux/netlink.h:60 [inline] diag_net_init+0xa3/0x120 net/core/sock_diag.c:318 ops_init+0x1cd/0x4a0 net/core/net_namespace.c:144 setup_net+0x367/0xbf0 net/core/net_namespace.c:345 copy_net_ns+0x32f/0x520 net/core/net_namespace.c:486 create_new_namespaces+0x410/0x660 kernel/nsproxy.c:110 page_owner free stack trace missing Memory state around the buggy address: ffff88811bce2080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88811bce2100: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc >ffff88811bce2180: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb ^ ffff88811bce2200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88811bce2280: 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: 515 Comm: kworker/1:56 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:ffffc9000921fcf0 EFLAGS: 00010206 RAX: 0000000000000006 RBX: 0000000000000030 RCX: ffff888114bc13c0 RDX: 0000000000000000 RSI: 0000000000000282 RDI: 00000000ffffffff RBP: ffffc9000921fd30 R08: ffffffff813e2b7b R09: 0000000000000003 R10: fffffbfff0e11248 R11: dffffc0000000001 R12: ffff888113ccd418 R13: dffffc0000000000 R14: ffff888112ef0908 R15: ffff888112ef0918 FS: 0000000000000000(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ff184d8b178 CR3: 000000012b1f4000 CR4: 00000000003526a0 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 3345467c54565154 ]--- 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:ffffc9000921fcf0 EFLAGS: 00010206 RAX: 0000000000000006 RBX: 0000000000000030 RCX: ffff888114bc13c0 RDX: 0000000000000000 RSI: 0000000000000282 RDI: 00000000ffffffff RBP: ffffc9000921fd30 R08: ffffffff813e2b7b R09: 0000000000000003 R10: fffffbfff0e11248 R11: dffffc0000000001 R12: ffff888113ccd418 R13: dffffc0000000000 R14: ffff888112ef0908 R15: ffff888112ef0918 FS: 0000000000000000(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ff184d8b178 CR3: 000000010d2c5000 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