================================================================== BUG: KASAN: double-free or invalid-free in security_tun_dev_free_security+0x3e/0x70 security/security.c:2276 CPU: 1 PID: 8657 Comm: syz-executor.1 Not tainted 5.11.0-rc5-syzkaller #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:79 [inline] dump_stack+0x107/0x163 lib/dump_stack.c:120 print_address_description.constprop.0.cold+0x5b/0x2c6 mm/kasan/report.c:230 kasan_report_invalid_free+0x51/0x80 mm/kasan/report.c:355 ____kasan_slab_free+0xcc/0xe0 mm/kasan/common.c:341 kasan_slab_free include/linux/kasan.h:192 [inline] __cache_free mm/slab.c:3424 [inline] kfree+0xed/0x270 mm/slab.c:3760 security_tun_dev_free_security+0x3e/0x70 security/security.c:2276 tun_free_netdev+0xdc/0x140 drivers/net/tun.c:2205 netdev_run_todo+0x8c3/0xdd0 net/core/dev.c:10344 __tun_chr_ioctl.isra.0+0xb2c/0x4360 drivers/net/tun.c:3254 vfs_ioctl fs/ioctl.c:48 [inline] __do_sys_ioctl fs/ioctl.c:753 [inline] __se_sys_ioctl fs/ioctl.c:739 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:739 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x4658c7 Code: 3c 1c 48 f7 d8 49 39 c4 72 b8 e8 a4 4d 02 00 85 c0 78 bd 48 83 c4 08 4c 89 e0 5b 41 5c c3 0f 1f 44 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffe7b026ea8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007ffe7b026f88 RCX: 00000000004658c7 RDX: 00007ffe7b026ed0 RSI: 00000000400454ca RDI: 00000000000000f0 RBP: 00007ffe7b026f80 R08: 00007ffe7b026ed0 R09: 00007ffe7b026d00 R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffe7b026f80 R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000400538 Allocated by task 8657: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:401 [inline] ____kasan_kmalloc.constprop.0+0x7f/0xa0 mm/kasan/common.c:429 kasan_kmalloc include/linux/kasan.h:219 [inline] kmem_cache_alloc_trace+0x1e0/0x400 mm/slab.c:3554 kmalloc include/linux/slab.h:552 [inline] kzalloc include/linux/slab.h:682 [inline] selinux_tun_dev_alloc_security+0x43/0x190 security/selinux/hooks.c:5449 security_tun_dev_alloc_security+0x40/0x90 security/security.c:2270 __tun_chr_ioctl.isra.0+0x2858/0x4360 drivers/net/tun.c:2717 vfs_ioctl fs/ioctl.c:48 [inline] __do_sys_ioctl fs/ioctl.c:753 [inline] __se_sys_ioctl fs/ioctl.c:739 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:739 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Freed by task 8657: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_set_track+0x1c/0x30 mm/kasan/common.c:46 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:356 ____kasan_slab_free+0xb0/0xe0 mm/kasan/common.c:362 kasan_slab_free include/linux/kasan.h:192 [inline] __cache_free mm/slab.c:3424 [inline] kfree+0xed/0x270 mm/slab.c:3760 security_tun_dev_free_security+0x3e/0x70 security/security.c:2276 __tun_chr_ioctl.isra.0+0x2db0/0x4360 drivers/net/tun.c:2772 vfs_ioctl fs/ioctl.c:48 [inline] __do_sys_ioctl fs/ioctl.c:753 [inline] __se_sys_ioctl fs/ioctl.c:739 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:739 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 The buggy address belongs to the object at ffff888023996c00 which belongs to the cache kmalloc-32 of size 32 The buggy address is located 0 bytes inside of 32-byte region [ffff888023996c00, ffff888023996c20) The buggy address belongs to the page: page:00000000fb661c79 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888023996fc1 pfn:0x23996 flags: 0xfff00000000200(slab) raw: 00fff00000000200 ffffea0000934f88 ffffea00005b2d48 ffff888010040100 raw: ffff888023996fc1 ffff888023996000 000000010000003f 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888023996b00: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc ffff888023996b80: fa fb fb fb fc fc fc fc 00 fc fc fc fc fc fc fc >ffff888023996c00: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc ^ ffff888023996c80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc ffff888023996d00: 05 fc fc fc fc fc fc fc 05 fc fc fc fc fc fc fc ==================================================================