================================================================== BUG: KASAN: use-after-free in free_netdev+0x41f/0x4a0 net/core/dev.c:10023 Read of size 8 at addr ffff888091ec46f8 by task syz-executor405/9779 CPU: 0 PID: 9779 Comm: syz-executor405 Not tainted 5.7.0-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+0x188/0x20d lib/dump_stack.c:118 print_address_description.constprop.0.cold+0xd3/0x413 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+0x41f/0x4a0 net/core/dev.c:10023 netdev_run_todo+0x5fc/0x760 net/core/dev.c:9773 rtnl_unlock net/core/rtnetlink.c:112 [inline] rtnetlink_rcv_msg+0x45b/0xad0 net/core/rtnetlink.c:5462 netlink_rcv_skb+0x15a/0x410 net/netlink/af_netlink.c:2469 netlink_unicast_kernel net/netlink/af_netlink.c:1303 [inline] netlink_unicast+0x537/0x740 net/netlink/af_netlink.c:1329 netlink_sendmsg+0x882/0xe10 net/netlink/af_netlink.c:1918 sock_sendmsg_nosec net/socket.c:652 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:672 ____sys_sendmsg+0x6e6/0x810 net/socket.c:2352 ___sys_sendmsg+0x100/0x170 net/socket.c:2406 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2439 do_syscall_64+0xf6/0x7d0 arch/x86/entry/common.c:295 entry_SYSCALL_64_after_hwframe+0x49/0xb3 RIP: 0033:0x448629 Code: e8 7c e6 ff ff 48 83 c4 18 c3 0f 1f 80 00 00 00 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 0f 83 1b 05 fc ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f28fe8fdce8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00000000006dec78 RCX: 0000000000448629 RDX: 0000000000000000 RSI: 0000000020000140 RDI: 0000000000000005 RBP: 00000000006dec70 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006dec7c R13: 00007fffdf5f1bff R14: 00007f28fe8fe9c0 R15: 0000000000000001 Allocated by task 9746: save_stack+0x1b/0x40 mm/kasan/common.c:48 set_track mm/kasan/common.c:56 [inline] __kasan_kmalloc mm/kasan/common.c:494 [inline] __kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:467 __do_kmalloc mm/slab.c:3656 [inline] __kmalloc+0x161/0x7a0 mm/slab.c:3665 kmalloc include/linux/slab.h:560 [inline] sk_prot_alloc+0x223/0x2f0 net/core/sock.c:1693 sk_alloc+0x36/0x1100 net/core/sock.c:1747 tun_chr_open+0x7b/0x550 drivers/net/tun.c:3385 misc_open+0x372/0x4a0 drivers/char/misc.c:141 chrdev_open+0x219/0x5c0 fs/char_dev.c:414 do_dentry_open+0x546/0x1340 fs/open.c:828 do_open fs/namei.c:3229 [inline] path_openat+0x1e59/0x27d0 fs/namei.c:3346 do_filp_open+0x192/0x260 fs/namei.c:3373 do_sys_openat2+0x585/0x7d0 fs/open.c:1179 do_sys_open+0xc3/0x140 fs/open.c:1195 do_syscall_64+0xf6/0x7d0 arch/x86/entry/common.c:295 entry_SYSCALL_64_after_hwframe+0x49/0xb3 Freed by task 9745: 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+0xf7/0x140 mm/kasan/common.c:455 __cache_free mm/slab.c:3426 [inline] kfree+0x109/0x2b0 mm/slab.c:3757 sk_prot_free net/core/sock.c:1730 [inline] __sk_destruct+0x5ad/0x7c0 net/core/sock.c:1814 sk_destruct+0xc6/0x100 net/core/sock.c:1829 __sk_free+0xef/0x3d0 net/core/sock.c:1840 sk_free+0x78/0xa0 net/core/sock.c:1851 sock_put include/net/sock.h:1780 [inline] __tun_detach+0xbc3/0x1110 drivers/net/tun.c:695 tun_detach drivers/net/tun.c:707 [inline] tun_chr_close+0x10e/0x180 drivers/net/tun.c:3421 __fput+0x33e/0x880 fs/file_table.c:281 task_work_run+0xf4/0x1b0 kernel/task_work.c:123 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_usermode_loop+0x2fa/0x360 arch/x86/entry/common.c:165 prepare_exit_to_usermode arch/x86/entry/common.c:196 [inline] syscall_return_slowpath arch/x86/entry/common.c:279 [inline] do_syscall_64+0x6b1/0x7d0 arch/x86/entry/common.c:305 entry_SYSCALL_64_after_hwframe+0x49/0xb3 The buggy address belongs to the object at ffff888091ec4000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 1784 bytes inside of 4096-byte region [ffff888091ec4000, ffff888091ec5000) The buggy address belongs to the page: page:ffffea000247b100 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 head:ffffea000247b100 order:1 compound_mapcount:0 flags: 0xfffe0000010200(slab|head) raw: 00fffe0000010200 ffffea0002a4be88 ffffea0002a04988 ffff8880aa002000 raw: 0000000000000000 ffff888091ec4000 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888091ec4580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888091ec4600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888091ec4680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888091ec4700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888091ec4780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================