================================================================== BUG: KASAN: use-after-free in free_netdev+0x3fb/0x480 net/core/dev.c:10352 Read of size 8 at addr ffff888084e566f8 by task syz-executor.5/1645 CPU: 1 PID: 1645 Comm: syz-executor.5 Not tainted 5.9.0-rc3-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x198/0x1fd lib/dump_stack.c:118 print_address_description.constprop.0.cold+0xae/0x497 mm/kasan/report.c:383 __kasan_report mm/kasan/report.c:513 [inline] kasan_report.cold+0x1f/0x37 mm/kasan/report.c:530 free_netdev+0x3fb/0x480 net/core/dev.c:10352 netdev_run_todo+0x8ac/0xb40 net/core/dev.c:10104 rtnl_unlock net/core/rtnetlink.c:112 [inline] rtnetlink_rcv_msg+0x45b/0xad0 net/core/rtnetlink.c:5564 netlink_rcv_skb+0x15a/0x430 net/netlink/af_netlink.c:2470 netlink_unicast_kernel net/netlink/af_netlink.c:1304 [inline] netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1330 netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1919 sock_sendmsg_nosec net/socket.c:651 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:671 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2353 ___sys_sendmsg+0xf3/0x170 net/socket.c:2407 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2440 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x45d5f9 Code: 5d b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 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 0f 83 2b b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f2f3241ac78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 000000000002cf00 RCX: 000000000045d5f9 RDX: 0000000000000000 RSI: 0000000020000140 RDI: 0000000000000005 RBP: 000000000118d020 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000118cfec R13: 00007ffe536f84bf R14: 00007f2f3241b9c0 R15: 000000000118cfec Allocated by task 1638: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48 kasan_set_track mm/kasan/common.c:56 [inline] __kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:461 __do_kmalloc mm/slab.c:3655 [inline] __kmalloc+0x1b0/0x360 mm/slab.c:3664 kmalloc include/linux/slab.h:559 [inline] sk_prot_alloc+0x17a/0x300 net/core/sock.c:1685 sk_alloc+0x32/0xbd0 net/core/sock.c:1739 tun_chr_open+0x7b/0x540 drivers/net/tun.c:3372 misc_open+0x372/0x4a0 drivers/char/misc.c:141 chrdev_open+0x266/0x770 fs/char_dev.c:414 do_dentry_open+0x4b9/0x11b0 fs/open.c:817 do_open fs/namei.c:3251 [inline] path_openat+0x1b9a/0x2730 fs/namei.c:3368 do_filp_open+0x17e/0x3c0 fs/namei.c:3395 do_sys_openat2+0x16d/0x420 fs/open.c:1168 do_sys_open fs/open.c:1184 [inline] __do_sys_openat fs/open.c:1200 [inline] __se_sys_openat fs/open.c:1195 [inline] __x64_sys_openat+0x13f/0x1f0 fs/open.c:1195 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Freed by task 1635: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48 kasan_set_track+0x1c/0x30 mm/kasan/common.c:56 kasan_set_free_info+0x1b/0x30 mm/kasan/generic.c:355 __kasan_slab_free+0xd8/0x120 mm/kasan/common.c:422 __cache_free mm/slab.c:3418 [inline] kfree+0x10e/0x2b0 mm/slab.c:3756 sk_prot_free net/core/sock.c:1722 [inline] __sk_destruct+0x63b/0x860 net/core/sock.c:1807 sk_destruct+0xbd/0xe0 net/core/sock.c:1822 __sk_free+0xef/0x3d0 net/core/sock.c:1833 sk_free+0x78/0xa0 net/core/sock.c:1844 sock_put include/net/sock.h:1781 [inline] __tun_detach+0xdb8/0x13c0 drivers/net/tun.c:696 tun_detach drivers/net/tun.c:708 [inline] tun_chr_close+0x10e/0x180 drivers/net/tun.c:3408 __fput+0x285/0x920 fs/file_table.c:281 task_work_run+0xdd/0x190 kernel/task_work.c:141 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_user_mode_loop kernel/entry/common.c:140 [inline] exit_to_user_mode_prepare+0x1e1/0x200 kernel/entry/common.c:167 syscall_exit_to_user_mode+0x7e/0x2e0 kernel/entry/common.c:242 entry_SYSCALL_64_after_hwframe+0x44/0xa9 The buggy address belongs to the object at ffff888084e56000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 1784 bytes inside of 4096-byte region [ffff888084e56000, ffff888084e57000) The buggy address belongs to the page: page:00000000784d1b42 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x84e56 head:00000000784d1b42 order:1 compound_mapcount:0 flags: 0xfffe0000010200(slab|head) raw: 00fffe0000010200 ffffea000175e208 ffffea00014c6188 ffff8880aa040900 raw: 0000000000000000 ffff888084e56000 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888084e56580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888084e56600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888084e56680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888084e56700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888084e56780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================