================================================================== BUG: KASAN: use-after-free in free_netdev+0x3fb/0x480 net/core/dev.c:10045 Read of size 8 at addr ffff8880909286f8 by task syz-executor.0/12696 CPU: 1 PID: 12696 Comm: syz-executor.0 Not tainted 5.8.0-rc3-next-20200703-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:10045 netdev_run_todo+0x88e/0xac0 net/core/dev.c:9797 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:367 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x45cb29 Code: Bad RIP value. RSP: 002b:00007fd41d6c5c78 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: 00007fd41d6c66d4 Allocated by task 12696: save_stack+0x1b/0x40 mm/kasan/common.c:48 set_track mm/kasan/common.c:56 [inline] __kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:494 __do_kmalloc mm/slab.c:3659 [inline] __kmalloc+0x18f/0x4d0 mm/slab.c:3668 kmalloc include/linux/slab.h:559 [inline] sk_prot_alloc+0x17a/0x300 net/core/sock.c:1684 sk_alloc+0x32/0xbd0 net/core/sock.c:1738 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+0x4b9/0x11b0 fs/open.c:822 do_open fs/namei.c:3249 [inline] path_openat+0x1bb9/0x2750 fs/namei.c:3366 do_filp_open+0x17e/0x3c0 fs/namei.c:3393 do_sys_openat2+0x16f/0x3b0 fs/open.c:1173 do_sys_open fs/open.c:1189 [inline] __do_sys_openat fs/open.c:1203 [inline] __se_sys_openat fs/open.c:1198 [inline] __x64_sys_openat+0x13f/0x1f0 fs/open.c:1198 do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:367 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Freed by task 12690: 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+0xf2/0x130 mm/kasan/common.c:455 __cache_free mm/slab.c:3422 [inline] kfree+0x103/0x2c0 mm/slab.c:3760 sk_prot_free net/core/sock.c:1721 [inline] __sk_destruct+0x63b/0x860 net/core/sock.c:1806 sk_destruct+0xbd/0xe0 net/core/sock.c:1821 __sk_free+0xef/0x3d0 net/core/sock.c:1832 sk_free+0x78/0xa0 net/core/sock.c:1843 sock_put include/net/sock.h:1789 [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:135 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_usermode_loop arch/x86/entry/common.c:222 [inline] __prepare_exit_to_usermode+0x1e9/0x1f0 arch/x86/entry/common.c:252 do_syscall_64+0x6c/0xe0 arch/x86/entry/common.c:376 entry_SYSCALL_64_after_hwframe+0x44/0xa9 The buggy address belongs to the object at ffff888090928000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 1784 bytes inside of 4096-byte region [ffff888090928000, ffff888090929000) The buggy address belongs to the page: page:ffffea0002424a00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 head:ffffea0002424a00 order:1 compound_mapcount:0 flags: 0xfffe0000010200(slab|head) raw: 00fffe0000010200 ffffea0001f1fb88 ffffea0002572588 ffff8880aa000900 raw: 0000000000000000 ffff888090928000 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888090928580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888090928600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888090928680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888090928700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888090928780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================