================================================================== BUG: KASAN: use-after-free in free_netdev+0x17d/0x310 net/core/dev.c:9696 Read of size 8 at addr ffff8881e8efc578 by task syz-executor.5/4366 CPU: 1 PID: 4366 Comm: syz-executor.5 Not tainted 5.4.190-syzkaller-00008-g330fa791a029 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/29/2022 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x18e/0x1d5 lib/dump_stack.c:118 print_address_description+0x8c/0x630 mm/kasan/report.c:384 __kasan_report+0xf6/0x130 mm/kasan/report.c:516 kasan_report+0x30/0x60 mm/kasan/common.c:653 free_netdev+0x17d/0x310 net/core/dev.c:9696 netdev_run_todo+0xa79/0xc80 net/core/dev.c:9447 rtnl_unlock net/core/rtnetlink.c:112 [inline] rtnetlink_rcv_msg+0xa49/0xb90 net/core/rtnetlink.c:5263 netlink_rcv_skb+0x190/0x3a0 net/netlink/af_netlink.c:2500 netlink_unicast_kernel net/netlink/af_netlink.c:1312 [inline] netlink_unicast+0x771/0x8d0 net/netlink/af_netlink.c:1338 netlink_sendmsg+0x913/0xb90 net/netlink/af_netlink.c:1933 sock_sendmsg_nosec net/socket.c:638 [inline] sock_sendmsg net/socket.c:658 [inline] ____sys_sendmsg+0x4ee/0x7c0 net/socket.c:2287 ___sys_sendmsg net/socket.c:2341 [inline] __sys_sendmsg+0x235/0x2f0 net/socket.c:2387 do_syscall_64+0xcb/0x1c0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7f30414981f9 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f304060e168 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f30415aaf60 RCX: 00007f30414981f9 RDX: 0000000000000000 RSI: 0000000020000180 RDI: 0000000000000004 RBP: 00007f30414f2161 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fff36a8e87f R14: 00007f304060e300 R15: 0000000000022000 Allocated by task 4366: save_stack mm/kasan/common.c:70 [inline] set_track mm/kasan/common.c:78 [inline] __kasan_kmalloc+0x131/0x1e0 mm/kasan/common.c:529 kmalloc include/linux/slab.h:561 [inline] sk_prot_alloc+0xbc/0x3c0 net/core/sock.c:1618 sk_alloc+0x30/0x330 net/core/sock.c:1676 tun_chr_open+0x77/0x490 drivers/net/tun.c:3487 misc_open+0x346/0x3c0 drivers/char/misc.c:141 chrdev_open+0x4ec/0x5b0 fs/char_dev.c:414 do_dentry_open+0x7e3/0xef0 fs/open.c:796 do_last fs/namei.c:3495 [inline] path_openat+0x1464/0x3710 fs/namei.c:3612 do_filp_open+0x19a/0x3a0 fs/namei.c:3642 do_sys_open+0x2e3/0x700 fs/open.c:1113 do_syscall_64+0xcb/0x1c0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Freed by task 4365: save_stack mm/kasan/common.c:70 [inline] set_track mm/kasan/common.c:78 [inline] kasan_set_free_info mm/kasan/common.c:345 [inline] __kasan_slab_free+0x178/0x240 mm/kasan/common.c:487 slab_free_hook mm/slub.c:1455 [inline] slab_free_freelist_hook+0x80/0x150 mm/slub.c:1494 slab_free mm/slub.c:3080 [inline] kfree+0xc6/0x260 mm/slub.c:4071 sk_prot_free+0xa3/0x160 net/core/sock.c:1659 tun_detach drivers/net/tun.c:748 [inline] tun_chr_close+0xb4/0xd0 drivers/net/tun.c:3523 __fput+0x261/0x680 fs/file_table.c:281 task_work_run+0x186/0x1b0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_usermode_loop+0x1ba/0x1d0 arch/x86/entry/common.c:163 prepare_exit_to_usermode+0x17c/0x1d0 arch/x86/entry/common.c:194 entry_SYSCALL_64_after_hwframe+0x44/0xa9 The buggy address belongs to the object at ffff8881e8efc000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 1400 bytes inside of 2048-byte region [ffff8881e8efc000, ffff8881e8efc800) The buggy address belongs to the page: page:ffffea0007a3be00 refcount:1 mapcount:0 mapping:ffff8881f5c0c000 index:0xffff8881e8efb000 compound_mapcount: 0 flags: 0x8000000000010200(slab|head) raw: 8000000000010200 ffff8881f5c00a90 ffffea00079c3808 ffff8881f5c0c000 raw: ffff8881e8efb000 0000000000080006 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL) set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook mm/page_alloc.c:2165 [inline] prep_new_page+0x194/0x380 mm/page_alloc.c:2171 get_page_from_freelist+0x524/0x560 mm/page_alloc.c:3794 __alloc_pages_nodemask+0x2ab/0x6f0 mm/page_alloc.c:4857 alloc_slab_page+0x39/0x3e0 mm/slub.c:343 allocate_slab mm/slub.c:1683 [inline] new_slab+0x97/0x450 mm/slub.c:1749 new_slab_objects mm/slub.c:2506 [inline] ___slab_alloc+0x320/0x4b0 mm/slub.c:2667 __slab_alloc+0x5a/0x90 mm/slub.c:2707 slab_alloc_node mm/slub.c:2792 [inline] slab_alloc mm/slub.c:2837 [inline] __kmalloc_track_caller+0x168/0x280 mm/slub.c:4449 __kmalloc_reserve net/core/skbuff.c:142 [inline] __alloc_skb+0xb5/0x4d0 net/core/skbuff.c:210 alloc_skb include/linux/skbuff.h:1060 [inline] nlmsg_new include/net/netlink.h:888 [inline] rtmsg_ifinfo_build_skb+0x81/0x180 net/core/rtnetlink.c:3503 rtmsg_ifinfo_event net/core/rtnetlink.c:3539 [inline] rtmsg_ifinfo+0x70/0x110 net/core/rtnetlink.c:3548 register_netdevice+0xe88/0x1140 net/core/dev.c:9227 __ip_tunnel_create+0x246/0x2f0 net/ipv4/ip_tunnel.c:267 ip_tunnel_init_net+0x230/0x6c0 net/ipv4/ip_tunnel.c:1062 ops_init+0x278/0x350 net/core/net_namespace.c:137 setup_net+0x1bb/0x9e0 net/core/net_namespace.c:338 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1176 [inline] __free_pages_ok+0x7ee/0x920 mm/page_alloc.c:1438 free_the_page mm/page_alloc.c:4919 [inline] __free_pages+0x45/0x1e0 mm/page_alloc.c:4925 __free_slab+0x22b/0x2e0 mm/slub.c:1774 free_slab mm/slub.c:1789 [inline] discard_slab mm/slub.c:1795 [inline] unfreeze_partials+0x14f/0x180 mm/slub.c:2287 put_cpu_partial+0xb5/0x150 mm/slub.c:2323 __slab_free+0x2ac/0x370 mm/slub.c:2971 qlist_free_all+0x4c/0xb0 mm/kasan/quarantine.c:167 quarantine_reduce+0x174/0x190 mm/kasan/quarantine.c:260 __kasan_kmalloc+0x43/0x1e0 mm/kasan/common.c:507 slab_post_alloc_hook mm/slab.h:584 [inline] slab_alloc_node mm/slub.c:2829 [inline] slab_alloc mm/slub.c:2837 [inline] kmem_cache_alloc+0xd0/0x210 mm/slub.c:2842 getname_flags+0xb8/0x4e0 fs/namei.c:141 do_sys_open+0x2a3/0x700 fs/open.c:1107 do_syscall_64+0xcb/0x1c0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Memory state around the buggy address: ffff8881e8efc400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881e8efc480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8881e8efc500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881e8efc580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881e8efc600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================