BUG: KASAN: use-after-free in free_netdev+0x176/0x300 net/core/dev.c:9602 Read of size 8 at addr ffff8881c206d538 by task syz-executor.4/3026 CPU: 1 PID: 3026 Comm: syz-executor.4 Not tainted 5.4.50-syzkaller-01110-g45217b91eaaa #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+0x14a/0x1ce lib/dump_stack.c:118 print_address_description+0x93/0x620 mm/kasan/report.c:374 __kasan_report+0x16d/0x1e0 mm/kasan/report.c:506 kasan_report+0x36/0x60 mm/kasan/common.c:634 free_netdev+0x176/0x300 net/core/dev.c:9602 netdev_run_todo+0xc38/0xe90 net/core/dev.c:9353 rtnl_unlock net/core/rtnetlink.c:112 [inline] rtnetlink_rcv_msg+0x9a0/0xc60 net/core/rtnetlink.c:5255 netlink_rcv_skb+0x200/0x480 net/netlink/af_netlink.c:2478 netlink_unicast_kernel net/netlink/af_netlink.c:1303 [inline] netlink_unicast+0x8ad/0xa50 net/netlink/af_netlink.c:1329 netlink_sendmsg+0x9de/0xd80 net/netlink/af_netlink.c:1918 sock_sendmsg_nosec net/socket.c:638 [inline] sock_sendmsg net/socket.c:658 [inline] ____sys_sendmsg+0x58a/0x8d0 net/socket.c:2298 ___sys_sendmsg net/socket.c:2352 [inline] __sys_sendmsg+0x2d5/0x3c0 net/socket.c:2398 do_syscall_64+0xcb/0x150 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x45cb29 Code: 0d b7 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 db b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007fe0a8b5fc78 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: 00007fe0a8b606d4 Allocated by task 3026: save_stack mm/kasan/common.c:69 [inline] set_track mm/kasan/common.c:77 [inline] __kasan_kmalloc+0x12c/0x1c0 mm/kasan/common.c:510 __kmalloc+0xf7/0x2d0 mm/slub.c:3821 kmalloc include/linux/slab.h:561 [inline] sk_prot_alloc+0xd6/0x290 net/core/sock.c:1605 sk_alloc+0x33/0x340 net/core/sock.c:1659 tun_chr_open+0x77/0x4a0 drivers/net/tun.c:3425 misc_open+0x356/0x3d0 drivers/char/misc.c:141 chrdev_open+0x585/0x640 fs/char_dev.c:414 do_dentry_open+0x8f7/0x1070 fs/open.c:809 do_last fs/namei.c:3528 [inline] path_openat+0x12db/0x3d10 fs/namei.c:3646 do_filp_open+0x20d/0x440 fs/namei.c:3676 do_sys_open+0x387/0x7d0 fs/open.c:1106 do_syscall_64+0xcb/0x150 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Freed by task 3025: save_stack mm/kasan/common.c:69 [inline] set_track mm/kasan/common.c:77 [inline] kasan_set_free_info mm/kasan/common.c:332 [inline] __kasan_slab_free+0x181/0x230 mm/kasan/common.c:471 slab_free_hook mm/slub.c:1424 [inline] slab_free_freelist_hook+0xd0/0x150 mm/slub.c:1457 slab_free mm/slub.c:3014 [inline] kfree+0x12b/0x600 mm/slub.c:3975 sk_prot_free net/core/sock.c:1642 [inline] __sk_destruct+0x3f9/0x480 net/core/sock.c:1727 tun_detach drivers/net/tun.c:740 [inline] tun_chr_close+0xb4/0xd0 drivers/net/tun.c:3461 __fput+0x27d/0x6c0 fs/file_table.c:280 task_work_run+0x176/0x1a0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_usermode_loop arch/x86/entry/common.c:163 [inline] prepare_exit_to_usermode+0x286/0x2e0 arch/x86/entry/common.c:194 entry_SYSCALL_64_after_hwframe+0x44/0xa9 The buggy address belongs to the object at ffff8881c206d000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 1336 bytes inside of 2048-byte region [ffff8881c206d000, ffff8881c206d800) The buggy address belongs to the page: page:ffffea0007081a00 refcount:1 mapcount:0 mapping:ffff8881da80c000 index:0x0 compound_mapcount: 0 flags: 0x8000000000010200(slab|head) raw: 8000000000010200 dead000000000100 dead000000000122 ffff8881da80c000 raw: 0000000000000000 0000000080080008 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8881c206d400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881c206d480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8881c206d500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881c206d580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881c206d600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================