================================================================== BUG: KASAN: use-after-free in free_netdev+0x443/0x4d0 net/core/dev.c:9886 Read of size 8 at addr ffff8880a37b46b8 by task syz-executor.2/10867 CPU: 0 PID: 10867 Comm: syz-executor.2 Not tainted 5.6.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+0x188/0x20d lib/dump_stack.c:118 print_address_description.constprop.0.cold+0xd3/0x315 mm/kasan/report.c:374 __kasan_report.cold+0x1a/0x32 mm/kasan/report.c:506 kasan_report+0xe/0x20 mm/kasan/common.c:641 free_netdev+0x443/0x4d0 net/core/dev.c:9886 netdev_run_todo+0x5fc/0x760 net/core/dev.c:9636 rtnl_unlock net/core/rtnetlink.c:112 [inline] rtnetlink_rcv_msg+0x45b/0xad0 net/core/rtnetlink.c:5441 netlink_rcv_skb+0x15a/0x410 net/netlink/af_netlink.c:2478 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+0x6b9/0x7d0 net/socket.c:2343 ___sys_sendmsg+0x100/0x170 net/socket.c:2397 __sys_sendmsg+0xec/0x1b0 net/socket.c:2430 do_syscall_64+0xf6/0x790 arch/x86/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x45c4a9 Code: ad b6 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 7b b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f6e60b3cc78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f6e60b3d6d4 RCX: 000000000045c4a9 RDX: 0000000000000000 RSI: 0000000020000140 RDI: 0000000000000006 RBP: 000000000076bf20 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff R13: 00000000000009f9 R14: 00000000004cc766 R15: 000000000076bf2c Allocated by task 10879: save_stack+0x1b/0x80 mm/kasan/common.c:72 set_track mm/kasan/common.c:80 [inline] __kasan_kmalloc mm/kasan/common.c:515 [inline] __kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:488 __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:1604 sk_alloc+0x36/0xfa0 net/core/sock.c:1658 tun_chr_open+0x7b/0x540 drivers/net/tun.c:3374 misc_open+0x372/0x4a0 drivers/char/misc.c:141 chrdev_open+0x219/0x5c0 fs/char_dev.c:414 do_dentry_open+0x4a2/0x1250 fs/open.c:797 do_last fs/namei.c:3490 [inline] path_openat+0x122a/0x32b0 fs/namei.c:3607 do_filp_open+0x192/0x260 fs/namei.c:3637 do_sys_openat2+0x54c/0x740 fs/open.c:1149 do_sys_open+0xc3/0x140 fs/open.c:1165 do_syscall_64+0xf6/0x790 arch/x86/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 10866: save_stack+0x1b/0x80 mm/kasan/common.c:72 set_track mm/kasan/common.c:80 [inline] kasan_set_free_info mm/kasan/common.c:337 [inline] __kasan_slab_free+0xf7/0x140 mm/kasan/common.c:476 __cache_free mm/slab.c:3426 [inline] kfree+0x109/0x2b0 mm/slab.c:3757 sk_prot_free net/core/sock.c:1641 [inline] __sk_destruct+0x5ad/0x7c0 net/core/sock.c:1725 sk_destruct+0xc6/0x100 net/core/sock.c:1740 __sk_free+0xef/0x3d0 net/core/sock.c:1751 sk_free+0x78/0xa0 net/core/sock.c:1762 sock_put include/net/sock.h:1777 [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:3410 __fput+0x2da/0x850 fs/file_table.c:280 task_work_run+0x13f/0x1b0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_usermode_loop+0x2fa/0x360 arch/x86/entry/common.c:164 prepare_exit_to_usermode arch/x86/entry/common.c:195 [inline] syscall_return_slowpath arch/x86/entry/common.c:278 [inline] do_syscall_64+0x672/0x790 arch/x86/entry/common.c:304 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff8880a37b4000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 1720 bytes inside of 4096-byte region [ffff8880a37b4000, ffff8880a37b5000) The buggy address belongs to the page: page:ffffea00028ded00 refcount:1 mapcount:0 mapping:ffff8880aa002000 index:0x0 compound_mapcount: 0 flags: 0xfffe0000010200(slab|head) raw: 00fffe0000010200 ffffea00023ba508 ffffea00024f1a08 ffff8880aa002000 raw: 0000000000000000 ffff8880a37b4000 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8880a37b4580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880a37b4600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8880a37b4680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880a37b4700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880a37b4780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================