================================================================== BUG: KASAN: double-free or invalid-free in selinux_tun_dev_free_security+0x15/0x20 security/selinux/hooks.c:5028 CPU: 0 PID: 7142 Comm: syz-executor1 Not tainted 4.13.0-rc5-next-20170816+ #4 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 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_double_free+0x55/0x80 mm/kasan/report.c:333 kasan_slab_free+0xa3/0xc0 mm/kasan/kasan.c:514 __cache_free mm/slab.c:3503 [inline] kfree+0xca/0x250 mm/slab.c:3820 selinux_tun_dev_free_security+0x15/0x20 security/selinux/hooks.c:5028 security_tun_dev_free_security+0x48/0x80 security/security.c:1502 tun_set_iff drivers/net/tun.c:2087 [inline] __tun_chr_ioctl+0x2cb5/0x3d20 drivers/net/tun.c:2262 tun_chr_ioctl+0x2a/0x40 drivers/net/tun.c:2507 vfs_ioctl fs/ioctl.c:45 [inline] do_vfs_ioctl+0x1b1/0x1520 fs/ioctl.c:685 SYSC_ioctl fs/ioctl.c:700 [inline] SyS_ioctl+0x8f/0xc0 fs/ioctl.c:691 entry_SYSCALL_64_fastpath+0x1f/0xbe RIP: 0033:0x446739 RSP: 002b:00007f2625a38c08 EFLAGS: 00000282 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 0000000000000006 RCX: 0000000000446739 RDX: 0000000020c2dfd8 RSI: 00000000400454ca RDI: 0000000000000006 RBP: 0000000000708000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000282 R12: 00000000ffffffff R13: 0000000000005790 R14: 00000000006e7850 R15: 0000000000000000 Allocated by task 7142: save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59 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 kmem_cache_alloc_trace+0x136/0x750 mm/slab.c:3627 kmalloc include/linux/slab.h:493 [inline] kzalloc include/linux/slab.h:666 [inline] selinux_tun_dev_alloc_security+0x49/0x170 security/selinux/hooks.c:5017 security_tun_dev_alloc_security+0x6d/0xa0 security/security.c:1496 tun_set_iff drivers/net/tun.c:2042 [inline] __tun_chr_ioctl+0x1730/0x3d20 drivers/net/tun.c:2262 tun_chr_ioctl+0x2a/0x40 drivers/net/tun.c:2507 vfs_ioctl fs/ioctl.c:45 [inline] do_vfs_ioctl+0x1b1/0x1520 fs/ioctl.c:685 SYSC_ioctl fs/ioctl.c:700 [inline] SyS_ioctl+0x8f/0xc0 fs/ioctl.c:691 entry_SYSCALL_64_fastpath+0x1f/0xbe Freed by task 7142: save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59 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:3503 [inline] kfree+0xca/0x250 mm/slab.c:3820 selinux_tun_dev_free_security+0x15/0x20 security/selinux/hooks.c:5028 security_tun_dev_free_security+0x48/0x80 security/security.c:1502 tun_free_netdev+0x13b/0x1b0 drivers/net/tun.c:1766 register_netdevice+0x92b/0xf40 net/core/dev.c:7646 tun_set_iff drivers/net/tun.c:2062 [inline] __tun_chr_ioctl+0x1caf/0x3d20 drivers/net/tun.c:2262 tun_chr_ioctl+0x2a/0x40 drivers/net/tun.c:2507 vfs_ioctl fs/ioctl.c:45 [inline] do_vfs_ioctl+0x1b1/0x1520 fs/ioctl.c:685 SYSC_ioctl fs/ioctl.c:700 [inline] SyS_ioctl+0x8f/0xc0 fs/ioctl.c:691 entry_SYSCALL_64_fastpath+0x1f/0xbe The buggy address belongs to the object at ffff88003d05ecc0 which belongs to the cache kmalloc-32 of size 32 The buggy address is located 0 bytes inside of 32-byte region [ffff88003d05ecc0, ffff88003d05ece0) The buggy address belongs to the page: page:ffffea0000f41780 count:1 mapcount:0 mapping:ffff88003d05e000 index:0xffff88003d05efc1 flags: 0x100000000000100(slab) raw: 0100000000000100 ffff88003d05e000 ffff88003d05efc1 0000000100000039 raw: ffffea0000f5a4a0 ffffea0000f5c820 ffff88003e8001c0 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88003d05eb80: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc ffff88003d05ec00: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc >ffff88003d05ec80: 00 fc fc fc fc fc fc fc fb fb fb fb fc fc fc fc ^ ffff88003d05ed00: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc ffff88003d05ed80: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc ==================================================================