================================================================== BUG: KASAN: use-after-free in __ptr_ring_peek include/linux/ptr_ring.h:179 [inline] BUG: KASAN: use-after-free in __ptr_ring_consume include/linux/ptr_ring.h:249 [inline] BUG: KASAN: use-after-free in ptr_ring_consume include/linux/ptr_ring.h:269 [inline] BUG: KASAN: use-after-free in skb_array_consume include/linux/skb_array.h:97 [inline] BUG: KASAN: use-after-free in tun_ring_recv drivers/net/tun.c:1477 [inline] BUG: KASAN: use-after-free in tun_do_read.part.42+0x1033/0x1250 drivers/net/tun.c:1514 Read of size 8 at addr ffff8801ac086600 by task syz-executor1/19532 CPU: 1 PID: 19532 Comm: syz-executor1 Not tainted 4.9.99-gc2f9bce #25 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 ffff8801c370f9d8 ffffffff81eb0f09 ffffea0006b02000 ffff8801ac086600 0000000000000000 ffff8801ac086600 1ffff1003994d0b9 ffff8801c370fa10 ffffffff815652eb ffff8801ac086600 0000000000000008 0000000000000000 Call Trace: [] __dump_stack lib/dump_stack.c:15 [inline] [] dump_stack+0xc1/0x128 lib/dump_stack.c:51 [] print_address_description+0x6c/0x234 mm/kasan/report.c:256 [] kasan_report_error mm/kasan/report.c:355 [inline] [] kasan_report.cold.6+0x242/0x2fe mm/kasan/report.c:412 [] __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433 [] __ptr_ring_peek include/linux/ptr_ring.h:179 [inline] [] __ptr_ring_consume include/linux/ptr_ring.h:249 [inline] [] ptr_ring_consume include/linux/ptr_ring.h:269 [inline] [] skb_array_consume include/linux/skb_array.h:97 [inline] [] tun_ring_recv drivers/net/tun.c:1477 [inline] [] tun_do_read.part.42+0x1033/0x1250 drivers/net/tun.c:1514 [] tun_do_read drivers/net/tun.c:1536 [inline] [] tun_chr_read_iter+0x161/0x1f0 drivers/net/tun.c:1536 [] new_sync_read fs/read_write.c:439 [inline] [] __vfs_read+0x3dd/0x570 fs/read_write.c:451 [] vfs_read+0x120/0x380 fs/read_write.c:472 [] SYSC_pread64 fs/read_write.c:626 [inline] [] SyS_pread64+0x145/0x170 fs/read_write.c:613 [] do_syscall_64+0x1a6/0x490 arch/x86/entry/common.c:282 [] entry_SYSCALL_64_after_swapgs+0x5d/0xdb Allocated by task 19532: save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57 save_stack+0x43/0xd0 mm/kasan/kasan.c:505 set_track mm/kasan/kasan.c:517 [inline] kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:609 __kmalloc+0x11d/0x300 mm/slub.c:3741 kmalloc_array include/linux/slab.h:582 [inline] kcalloc include/linux/slab.h:593 [inline] __ptr_ring_init_queue_alloc include/linux/ptr_ring.h:356 [inline] ptr_ring_init include/linux/ptr_ring.h:361 [inline] skb_array_init include/linux/skb_array.h:151 [inline] tun_attach+0x63c/0xa70 drivers/net/tun.c:665 tun_set_iff drivers/net/tun.c:1842 [inline] __tun_chr_ioctl+0x2663/0x3450 drivers/net/tun.c:2051 tun_chr_ioctl+0x2a/0x40 drivers/net/tun.c:2300 vfs_ioctl fs/ioctl.c:43 [inline] file_ioctl fs/ioctl.c:493 [inline] do_vfs_ioctl+0x1ac/0x11a0 fs/ioctl.c:677 SYSC_ioctl fs/ioctl.c:694 [inline] SyS_ioctl+0x8f/0xc0 fs/ioctl.c:685 do_syscall_64+0x1a6/0x490 arch/x86/entry/common.c:282 entry_SYSCALL_64_after_swapgs+0x5d/0xdb Freed by task 19570: save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57 save_stack+0x43/0xd0 mm/kasan/kasan.c:505 set_track mm/kasan/kasan.c:517 [inline] kasan_slab_free+0x72/0xc0 mm/kasan/kasan.c:582 slab_free_hook mm/slub.c:1355 [inline] slab_free_freelist_hook mm/slub.c:1377 [inline] slab_free mm/slub.c:2958 [inline] kfree+0xfb/0x310 mm/slub.c:3878 ptr_ring_cleanup include/linux/ptr_ring.h:483 [inline] skb_array_cleanup include/linux/skb_array.h:176 [inline] tun_cleanup_tx_array.part.39+0x16f/0x1f0 drivers/net/tun.c:531 tun_cleanup_tx_array drivers/net/tun.c:530 [inline] tun_detach_all+0x394/0x7e0 drivers/net/tun.c:616 tun_net_uninit+0x15/0x20 drivers/net/tun.c:825 rollback_registered_many+0x684/0x920 net/core/dev.c:6846 unregister_netdevice_many.part.106+0x1b/0x110 net/core/dev.c:7879 unregister_netdevice_many+0x39/0x50 net/core/dev.c:7878 rtnl_delete_link+0xdc/0x130 net/core/rtnetlink.c:2292 rtnl_dellink+0x1e7/0x670 net/core/rtnetlink.c:2327 rtnetlink_rcv_msg+0x49c/0x650 net/core/rtnetlink.c:4059 netlink_rcv_skb+0x145/0x370 net/netlink/af_netlink.c:2356 rtnetlink_rcv+0x2a/0x40 net/core/rtnetlink.c:4065 netlink_unicast_kernel net/netlink/af_netlink.c:1278 [inline] netlink_unicast+0x4d8/0x6f0 net/netlink/af_netlink.c:1304 netlink_sendmsg+0x78b/0xc10 net/netlink/af_netlink.c:1850 sock_sendmsg_nosec net/socket.c:635 [inline] sock_sendmsg+0xcc/0x110 net/socket.c:645 ___sys_sendmsg+0x6fc/0x840 net/socket.c:1969 __sys_sendmsg+0xd9/0x190 net/socket.c:2003 SYSC_sendmsg net/socket.c:2014 [inline] SyS_sendmsg+0x2d/0x50 net/socket.c:2010 do_syscall_64+0x1a6/0x490 arch/x86/entry/common.c:282 entry_SYSCALL_64_after_swapgs+0x5d/0xdb The buggy address belongs to the object at ffff8801ac086600 which belongs to the cache kmalloc-4096 of size 4096 The buggy address is located 0 bytes inside of 4096-byte region [ffff8801ac086600, ffff8801ac087600) The buggy address belongs to the page: page:ffffea0006b02000 count:1 mapcount:0 mapping: (null) index:0x0 compound_mapcount: 0 flags: 0x8000000000004080(slab|head) page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8801ac086500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8801ac086580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8801ac086600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8801ac086680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8801ac086700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================