================================================================== BUG: KASAN: use-after-free in free_netdev+0x31a/0x360 net/core/dev.c:8192 Read of size 8 at addr ffff8801c1e8fb60 by task syz-executor6/3994 CPU: 1 PID: 3994 Comm: syz-executor6 Not tainted 4.14.0-rc5-mm1+ #20 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:16 [inline] dump_stack+0x194/0x257 lib/dump_stack.c:52 print_address_description+0x73/0x250 mm/kasan/report.c:252 kasan_report_error mm/kasan/report.c:351 [inline] kasan_report+0x25b/0x340 mm/kasan/report.c:409 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430 free_netdev+0x31a/0x360 net/core/dev.c:8192 netdev_run_todo+0x736/0xae0 net/core/dev.c:7940 rtnl_unlock+0xe/0x10 net/core/rtnetlink.c:106 tun_detach drivers/net/tun.c:665 [inline] tun_chr_close+0x49/0x60 drivers/net/tun.c:2835 __fput+0x327/0x7e0 fs/file_table.c:210 ____fput+0x15/0x20 fs/file_table.c:244 task_work_run+0x199/0x270 kernel/task_work.c:112 exit_task_work include/linux/task_work.h:21 [inline] do_exit+0x9b5/0x1ad0 kernel/exit.c:869 do_group_exit+0x149/0x400 kernel/exit.c:972 get_signal+0x73f/0x16d0 kernel/signal.c:2333 do_signal+0x94/0x1ee0 arch/x86/kernel/signal.c:808 exit_to_usermode_loop+0x214/0x310 arch/x86/entry/common.c:158 prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline] syscall_return_slowpath+0x42f/0x510 arch/x86/entry/common.c:266 entry_SYSCALL_64_fastpath+0xbc/0xbe RIP: 0033:0x452879 RSP: 002b:00007fb5732d3ce8 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca RAX: fffffffffffffe00 RBX: 0000000000758100 RCX: 0000000000452879 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000758100 RBP: 0000000000758100 R08: 0000000000000014 R09: 00000000007580d8 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000a6f7ff R14: 00007fb5732d49c0 R15: 0000000000000001 Allocated by task 3992: save_stack+0x43/0xd0 mm/kasan/kasan.c:447 set_track mm/kasan/kasan.c:459 [inline] kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:551 __do_kmalloc mm/slab.c:3712 [inline] __kmalloc+0x162/0x760 mm/slab.c:3721 kmalloc include/linux/slab.h:504 [inline] sk_prot_alloc+0x101/0x2a0 net/core/sock.c:1469 sk_alloc+0x89/0x700 net/core/sock.c:1523 tun_chr_open+0xec/0x490 drivers/net/tun.c:2804 misc_open+0x382/0x500 drivers/char/misc.c:153 chrdev_open+0x257/0x730 fs/char_dev.c:416 do_dentry_open+0x664/0xd40 fs/open.c:752 vfs_open+0x107/0x220 fs/open.c:866 do_last fs/namei.c:3387 [inline] path_openat+0x1151/0x3520 fs/namei.c:3527 do_filp_open+0x25b/0x3b0 fs/namei.c:3562 do_sys_open+0x502/0x6d0 fs/open.c:1059 SYSC_open fs/open.c:1077 [inline] SyS_open+0x2d/0x40 fs/open.c:1072 entry_SYSCALL_64_fastpath+0x1f/0xbe Freed by task 3994: save_stack+0x43/0xd0 mm/kasan/kasan.c:447 set_track mm/kasan/kasan.c:459 [inline] kasan_slab_free+0x71/0xc0 mm/kasan/kasan.c:524 __cache_free mm/slab.c:3492 [inline] kfree+0xca/0x250 mm/slab.c:3807 sk_prot_free net/core/sock.c:1506 [inline] __sk_destruct+0x74a/0x910 net/core/sock.c:1585 sk_destruct+0x47/0x80 net/core/sock.c:1593 __sk_free+0x57/0x230 net/core/sock.c:1601 sk_free+0x2a/0x40 net/core/sock.c:1612 sock_put include/net/sock.h:1651 [inline] __tun_detach+0x75b/0x1570 drivers/net/tun.c:657 tun_detach drivers/net/tun.c:664 [inline] tun_chr_close+0x44/0x60 drivers/net/tun.c:2835 __fput+0x327/0x7e0 fs/file_table.c:210 ____fput+0x15/0x20 fs/file_table.c:244 task_work_run+0x199/0x270 kernel/task_work.c:112 exit_task_work include/linux/task_work.h:21 [inline] do_exit+0x9b5/0x1ad0 kernel/exit.c:869 do_group_exit+0x149/0x400 kernel/exit.c:972 get_signal+0x73f/0x16d0 kernel/signal.c:2333 do_signal+0x94/0x1ee0 arch/x86/kernel/signal.c:808 exit_to_usermode_loop+0x214/0x310 arch/x86/entry/common.c:158 prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline] syscall_return_slowpath+0x42f/0x510 arch/x86/entry/common.c:266 entry_SYSCALL_64_fastpath+0xbc/0xbe The buggy address belongs to the object at ffff8801c1e8f5c0 which belongs to the cache kmalloc-2048 of size 2048 The buggy address is located 1440 bytes inside of 2048-byte region [ffff8801c1e8f5c0, ffff8801c1e8fdc0) The buggy address belongs to the page: page:ffffea000707a380 count:1 mapcount:0 mapping:ffff8801c1e8e4c0 index:0x0 compound_mapcount: 0 flags: 0x200000000008100(slab|head) raw: 0200000000008100 ffff8801c1e8e4c0 0000000000000000 0000000100000003 raw: ffffea0007074420 ffffea000707a7a0 ffff8801dac00c40 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8801c1e8fa00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8801c1e8fa80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8801c1e8fb00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8801c1e8fb80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8801c1e8fc00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================