================================================================== BUG: KASAN: use-after-free in free_netdev+0x41f/0x4a0 net/core/dev.c:10027 Read of size 8 at addr ffff8880959de6f8 by task syz-executor075/8907 CPU: 1 PID: 8907 Comm: syz-executor075 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:10027 netdev_run_todo+0x5fc/0x760 net/core/dev.c:9777 rtnl_unlock net/core/rtnetlink.c:112 [inline] rtnetlink_rcv_msg+0x45b/0xad0 net/core/rtnetlink.c:5462 netlink_rcv_skb+0x15a/0x430 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:0x4499f9 Code: e8 5c 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 cb 06 fc ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f2dbf475d98 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00000000006dfc98 RCX: 00000000004499f9 RDX: 0000000000000000 RSI: 0000000020000140 RDI: 0000000000000005 RBP: 00000000006dfc90 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006dfc9c R13: 0000000000006f6c R14: 0000000000000000 R15: 0000000000000000 Allocated by task 8904: 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 8905: 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 get_signal+0x207a/0x2510 kernel/signal.c:2533 do_signal+0x81/0x2240 arch/x86/kernel/signal.c:810 exit_to_usermode_loop+0x26c/0x360 arch/x86/entry/common.c:161 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 ffff8880959de000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 1784 bytes inside of 4096-byte region [ffff8880959de000, ffff8880959df000) The buggy address belongs to the page: page:ffffea0002567780 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 head:ffffea0002567780 order:1 compound_mapcount:0 flags: 0xfffe0000010200(slab|head) raw: 00fffe0000010200 ffffea000291a488 ffffea000298bc88 ffff8880aa002000 raw: 0000000000000000 ffff8880959de000 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8880959de580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880959de600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8880959de680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880959de700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880959de780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================