================================================================== BUG: KASAN: use-after-free in free_netdev+0x18d/0x390 net/core/dev.c:10695 Read of size 8 at addr ffff88814a18b578 by task syz-executor.0/8780 CPU: 0 PID: 8780 Comm: syz-executor.0 Not tainted 5.10.119-syzkaller-00334-gebc9fb07d294 #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_lvl+0x1e2/0x24b lib/dump_stack.c:118 print_address_description+0x81/0x3c0 mm/kasan/report.c:233 __kasan_report mm/kasan/report.c:419 [inline] kasan_report+0x1a4/0x1f0 mm/kasan/report.c:436 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:309 free_netdev+0x18d/0x390 net/core/dev.c:10695 netdev_run_todo+0xc0b/0xe10 net/core/dev.c:10409 rtnl_unlock net/core/rtnetlink.c:112 [inline] rtnetlink_rcv_msg+0xb1b/0xc60 net/core/rtnetlink.c:5583 netlink_rcv_skb+0x1f0/0x460 net/netlink/af_netlink.c:2515 rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:5600 netlink_unicast_kernel net/netlink/af_netlink.c:1313 [inline] netlink_unicast+0x91a/0xb10 net/netlink/af_netlink.c:1339 netlink_sendmsg+0xa40/0xd00 net/netlink/af_netlink.c:1934 sock_sendmsg_nosec net/socket.c:652 [inline] sock_sendmsg net/socket.c:672 [inline] ____sys_sendmsg+0x597/0x8e0 net/socket.c:2343 ___sys_sendmsg net/socket.c:2397 [inline] __sys_sendmsg+0x37b/0x460 net/socket.c:2430 __do_sys_sendmsg net/socket.c:2439 [inline] __se_sys_sendmsg net/socket.c:2437 [inline] __x64_sys_sendmsg+0x7f/0x90 net/socket.c:2437 do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7f64017be1f9 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:00007f6400934168 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f64018d0f60 RCX: 00007f64017be1f9 RDX: 0000000000000000 RSI: 0000000020000180 RDI: 0000000000000004 RBP: 00007f64009341d0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 00007ffda15fd89f R14: 00007f6400934300 R15: 0000000000022000 Allocated by task 8780: 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:428 [inline] ____kasan_kmalloc+0xdc/0x110 mm/kasan/common.c:507 __kasan_kmalloc+0x9/0x10 mm/kasan/common.c:516 kasan_kmalloc include/linux/kasan.h:269 [inline] __kmalloc+0x1f7/0x360 mm/slub.c:4042 kmalloc include/linux/slab.h:557 [inline] sk_prot_alloc+0xbc/0x250 net/core/sock.c:1692 sk_alloc+0x38/0x4c0 net/core/sock.c:1746 tun_chr_open+0x7b/0x4a0 drivers/net/tun.c:3415 misc_open+0x3ea/0x440 drivers/char/misc.c:141 chrdev_open+0x5fb/0x680 fs/char_dev.c:414 do_dentry_open+0x7a2/0x1090 fs/open.c:819 vfs_open+0x73/0x80 fs/open.c:942 do_open fs/namei.c:3327 [inline] path_openat+0x2638/0x2fd0 fs/namei.c:3444 do_filp_open+0x200/0x440 fs/namei.c:3471 do_sys_openat2+0x13b/0x470 fs/open.c:1211 do_sys_open fs/open.c:1227 [inline] __do_sys_openat fs/open.c:1243 [inline] __se_sys_openat fs/open.c:1238 [inline] __x64_sys_openat+0x243/0x290 fs/open.c:1238 do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Freed by task 8778: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4c/0x80 mm/kasan/common.c:46 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:357 ____kasan_slab_free+0x121/0x160 mm/kasan/common.c:360 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:368 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:1604 [inline] slab_free_freelist_hook+0xcc/0x1a0 mm/slub.c:1630 slab_free mm/slub.c:3212 [inline] kfree+0xc3/0x290 mm/slub.c:4200 sk_prot_free net/core/sock.c:1729 [inline] __sk_destruct+0x48d/0x540 net/core/sock.c:1815 sk_destruct net/core/sock.c:1830 [inline] __sk_free+0x364/0x470 net/core/sock.c:1841 sk_free+0x51/0x90 net/core/sock.c:1852 sock_put include/net/sock.h:1802 [inline] __tun_detach+0x1649/0x1c20 drivers/net/tun.c:686 tun_detach drivers/net/tun.c:698 [inline] tun_chr_close+0xb8/0xd0 drivers/net/tun.c:3451 __fput+0x348/0x7c0 fs/file_table.c:281 ____fput+0x15/0x20 fs/file_table.c:314 task_work_run+0x147/0x1b0 kernel/task_work.c:154 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_user_mode_loop+0xc8/0xe0 kernel/entry/common.c:164 exit_to_user_mode_prepare kernel/entry/common.c:191 [inline] syscall_exit_to_user_mode+0x77/0xa0 kernel/entry/common.c:266 do_syscall_64+0x40/0x70 arch/x86/entry/common.c:56 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Last potentially related work creation: kasan_save_stack+0x36/0x60 mm/kasan/common.c:38 kasan_record_aux_stack+0xca/0xf0 mm/kasan/generic.c:345 __call_rcu kernel/rcu/tree.c:2967 [inline] call_rcu+0x140/0x1300 kernel/rcu/tree.c:3041 netlink_release+0x1334/0x1780 net/netlink/af_netlink.c:809 __sock_release net/socket.c:597 [inline] sock_close+0xdb/0x250 net/socket.c:1267 __fput+0x348/0x7c0 fs/file_table.c:281 ____fput+0x15/0x20 fs/file_table.c:314 task_work_run+0x147/0x1b0 kernel/task_work.c:154 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_user_mode_loop+0xc8/0xe0 kernel/entry/common.c:164 exit_to_user_mode_prepare kernel/entry/common.c:191 [inline] syscall_exit_to_user_mode+0x77/0xa0 kernel/entry/common.c:266 do_syscall_64+0x40/0x70 arch/x86/entry/common.c:56 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Second to last potentially related work creation: kasan_save_stack+0x36/0x60 mm/kasan/common.c:38 kasan_record_aux_stack+0xca/0xf0 mm/kasan/generic.c:345 __call_rcu kernel/rcu/tree.c:2967 [inline] call_rcu+0x140/0x1300 kernel/rcu/tree.c:3041 netlink_release+0x1334/0x1780 net/netlink/af_netlink.c:809 __sock_release net/socket.c:597 [inline] sock_close+0xdb/0x250 net/socket.c:1267 __fput+0x348/0x7c0 fs/file_table.c:281 ____fput+0x15/0x20 fs/file_table.c:314 task_work_run+0x147/0x1b0 kernel/task_work.c:154 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_user_mode_loop+0xc8/0xe0 kernel/entry/common.c:164 exit_to_user_mode_prepare kernel/entry/common.c:191 [inline] syscall_exit_to_user_mode+0x77/0xa0 kernel/entry/common.c:266 do_syscall_64+0x40/0x70 arch/x86/entry/common.c:56 entry_SYSCALL_64_after_hwframe+0x44/0xa9 The buggy address belongs to the object at ffff88814a18b000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 1400 bytes inside of 2048-byte region [ffff88814a18b000, ffff88814a18b800) The buggy address belongs to the page: page:ffffea0005286200 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x14a188 head:ffffea0005286200 order:3 compound_mapcount:0 compound_pincount:0 flags: 0x8000000000010200(slab|head) raw: 8000000000010200 0000000000000000 0000000200000001 ffff888100042d80 raw: 0000000000000000 0000000000080008 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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 378, ts 81714611399, free_ts 0 set_page_owner include/linux/page_owner.h:35 [inline] post_alloc_hook mm/page_alloc.c:2385 [inline] prep_new_page mm/page_alloc.c:2391 [inline] get_page_from_freelist+0x745/0x760 mm/page_alloc.c:4067 __alloc_pages_nodemask+0x3b6/0x890 mm/page_alloc.c:5117 alloc_slab_page mm/slub.c:1815 [inline] allocate_slab+0x78/0x540 mm/slub.c:1817 new_slab mm/slub.c:1878 [inline] new_slab_objects mm/slub.c:2637 [inline] ___slab_alloc+0x131/0x2e0 mm/slub.c:2800 __slab_alloc+0x63/0xa0 mm/slub.c:2840 slab_alloc_node mm/slub.c:2922 [inline] slab_alloc mm/slub.c:2964 [inline] __kmalloc+0x24f/0x360 mm/slub.c:4038 kmalloc include/linux/slab.h:557 [inline] kzalloc include/linux/slab.h:664 [inline] __register_sysctl_table+0xee/0x1280 fs/proc/proc_sysctl.c:1314 register_net_sysctl+0x2c/0x40 net/sysctl_net.c:121 __addrconf_sysctl_register+0x26e/0x3c0 net/ipv6/addrconf.c:6988 addrconf_sysctl_register+0x141/0x1a0 net/ipv6/addrconf.c:7035 ipv6_add_dev+0xc07/0x10a0 net/ipv6/addrconf.c:447 addrconf_notify+0x584/0xe90 net/ipv6/addrconf.c:3533 notifier_call_chain kernel/notifier.c:83 [inline] raw_notifier_call_chain+0x9e/0x110 kernel/notifier.c:410 call_netdevice_notifiers_info net/core/dev.c:2054 [inline] call_netdevice_notifiers_extack net/core/dev.c:2066 [inline] call_netdevice_notifiers+0x14e/0x1d0 net/core/dev.c:2080 register_netdevice+0x13e7/0x1790 net/core/dev.c:10145 veth_newlink+0x692/0xba0 drivers/net/veth.c:1360 page_owner free stack trace missing Memory state around the buggy address: ffff88814a18b400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88814a18b480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88814a18b500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88814a18b580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88814a18b600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================