================================================================== BUG: KASAN: use-after-free in free_netdev+0x3fb/0x480 net/core/dev.c:10036 Read of size 8 at addr ffff8880917366f8 by task syz-executor.2/11851 CPU: 0 PID: 11851 Comm: syz-executor.2 Not tainted 5.8.0-rc2-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+0x18f/0x20d lib/dump_stack.c:118 print_address_description.constprop.0.cold+0xae/0x436 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:10036 netdev_run_todo+0x88e/0xac0 net/core/dev.c:9788 rtnl_unlock net/core/rtnetlink.c:112 [inline] rtnetlink_rcv_msg+0x45b/0xad0 net/core/rtnetlink.c:5461 netlink_rcv_skb+0x15a/0x430 net/netlink/af_netlink.c:2469 netlink_unicast_kernel net/netlink/af_netlink.c:1303 [inline] netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1329 netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1918 sock_sendmsg_nosec net/socket.c:652 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:672 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2352 ___sys_sendmsg+0xf3/0x170 net/socket.c:2406 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2439 do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:359 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x45cb29 Code: Bad RIP value. RSP: 002b:00007f194f639c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 0000000000502760 RCX: 000000000045cb29 RDX: 0000000000000000 RSI: 0000000020000140 RDI: 0000000000000005 RBP: 000000000078bf00 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff R13: 0000000000000a43 R14: 00000000004cd2a1 R15: 00007f194f63a6d4 Allocated by task 11851: save_stack+0x1b/0x40 mm/kasan/common.c:48 set_track mm/kasan/common.c:56 [inline] __kasan_kmalloc.constprop.0+0xc2/0xd0 mm/kasan/common.c:494 __do_kmalloc mm/slab.c:3656 [inline] __kmalloc+0x17a/0x340 mm/slab.c:3665 kmalloc include/linux/slab.h:560 [inline] sk_prot_alloc+0x17a/0x300 net/core/sock.c:1693 sk_alloc+0x32/0xbd0 net/core/sock.c:1747 tun_chr_open+0x7b/0x540 drivers/net/tun.c:3387 misc_open+0x372/0x4a0 drivers/char/misc.c:141 chrdev_open+0x266/0x770 fs/char_dev.c:414 do_dentry_open+0x501/0x1290 fs/open.c:828 do_open fs/namei.c:3243 [inline] path_openat+0x1bb9/0x2750 fs/namei.c:3360 do_filp_open+0x17e/0x3c0 fs/namei.c:3387 do_sys_openat2+0x16f/0x3b0 fs/open.c:1179 do_sys_open fs/open.c:1195 [inline] __do_sys_openat fs/open.c:1209 [inline] __se_sys_openat fs/open.c:1204 [inline] __x64_sys_openat+0x13f/0x1f0 fs/open.c:1204 do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:359 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Freed by task 11850: save_stack+0x1b/0x40 mm/kasan/common.c:48 set_track mm/kasan/common.c:56 [inline] kasan_set_free_info mm/kasan/common.c:316 [inline] __kasan_slab_free+0xf5/0x140 mm/kasan/common.c:455 __cache_free mm/slab.c:3426 [inline] kfree+0x103/0x2c0 mm/slab.c:3757 sk_prot_free net/core/sock.c:1730 [inline] __sk_destruct+0x63b/0x860 net/core/sock.c:1815 sk_destruct+0xbd/0xe0 net/core/sock.c:1830 __sk_free+0xef/0x3d0 net/core/sock.c:1841 sk_free+0x78/0xa0 net/core/sock.c:1852 sock_put include/net/sock.h:1780 [inline] __tun_detach+0xd69/0x1310 drivers/net/tun.c:696 tun_detach drivers/net/tun.c:708 [inline] tun_chr_close+0x10e/0x180 drivers/net/tun.c:3423 __fput+0x33c/0x880 fs/file_table.c:281 task_work_run+0xdd/0x190 kernel/task_work.c:123 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_usermode_loop arch/x86/entry/common.c:216 [inline] __prepare_exit_to_usermode+0x1e9/0x1f0 arch/x86/entry/common.c:246 do_syscall_64+0x6c/0xe0 arch/x86/entry/common.c:368 entry_SYSCALL_64_after_hwframe+0x44/0xa9 The buggy address belongs to the object at ffff888091736000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 1784 bytes inside of 4096-byte region [ffff888091736000, ffff888091737000) The buggy address belongs to the page: page:ffffea000245cd80 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 head:ffffea000245cd80 order:1 compound_mapcount:0 flags: 0xfffe0000010200(slab|head) raw: 00fffe0000010200 ffffea00025b9d08 ffffea00029acb08 ffff8880aa002000 raw: 0000000000000000 ffff888091736000 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888091736580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888091736600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888091736680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888091736700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888091736780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================