================================================================== BUG: KASAN: double-free or invalid-free in slab_free mm/slub.c:3212 [inline] BUG: KASAN: double-free or invalid-free in kfree+0xc3/0x290 mm/slub.c:4200 CPU: 1 PID: 833 Comm: syz-executor.4 Not tainted 5.10.134-syzkaller-01772-gf6ce9a9115d5 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118 print_address_description+0x81/0x3c0 mm/kasan/report.c:233 kasan_report_invalid_free+0x58/0x90 mm/kasan/report.c:358 ____kasan_slab_free+0x139/0x160 mm/kasan/common.c:362 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:368 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:1604 [inline] slab_free_freelist_hook+0xcc/0x1a0 mm/slub.c:1630 slab_free mm/slub.c:3212 [inline] kfree+0xc3/0x290 mm/slub.c:4200 selinux_tun_dev_free_security+0x15/0x20 security/selinux/hooks.c:5530 security_tun_dev_free_security+0x4d/0x90 security/security.c:2263 tun_free_netdev+0xbd/0x1c0 drivers/net/tun.c:2277 netdev_run_todo+0xbcd/0xe10 net/core/dev.c:10304 rtnl_unlock+0xe/0x10 net/core/rtnetlink.c:112 __tun_chr_ioctl+0x8ca/0x2130 drivers/net/tun.c:3362 tun_chr_ioctl+0x2a/0x40 drivers/net/tun.c:3371 vfs_ioctl fs/ioctl.c:48 [inline] __do_sys_ioctl fs/ioctl.c:753 [inline] __se_sys_ioctl+0x115/0x190 fs/ioctl.c:739 __x64_sys_ioctl+0x7b/0x90 fs/ioctl.c:739 do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xc6 RIP: 0033:0x7f761be0c279 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f761af82168 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f761bf1ef80 RCX: 00007f761be0c279 RDX: 00000000200001c0 RSI: 00000000400454ca RDI: 0000000000000003 RBP: 00007f761be66189 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fff3490e06f R14: 00007f761af82300 R15: 0000000000022000 Allocated by task 833: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:428 [inline] ____kasan_kmalloc+0xdc/0x110 mm/kasan/common.c:507 __kasan_kmalloc+0x9/0x10 mm/kasan/common.c:516 kasan_kmalloc include/linux/kasan.h:269 [inline] kmem_cache_alloc_trace+0x1dd/0x330 mm/slub.c:2983 kmalloc include/linux/slab.h:552 [inline] kzalloc include/linux/slab.h:664 [inline] selinux_tun_dev_alloc_security+0x51/0x140 security/selinux/hooks.c:5519 security_tun_dev_alloc_security+0x50/0xb0 security/security.c:2257 tun_set_iff+0x944/0x1100 drivers/net/tun.c:2795 __tun_chr_ioctl+0x8ab/0x2130 drivers/net/tun.c:3095 tun_chr_ioctl+0x2a/0x40 drivers/net/tun.c:3371 vfs_ioctl fs/ioctl.c:48 [inline] __do_sys_ioctl fs/ioctl.c:753 [inline] __se_sys_ioctl+0x115/0x190 fs/ioctl.c:739 __x64_sys_ioctl+0x7b/0x90 fs/ioctl.c:739 do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xc6 Freed by task 833: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4c/0x80 mm/kasan/common.c:46 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:357 ____kasan_slab_free+0x121/0x160 mm/kasan/common.c:360 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:368 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:1604 [inline] slab_free_freelist_hook+0xcc/0x1a0 mm/slub.c:1630 slab_free mm/slub.c:3212 [inline] kfree+0xc3/0x290 mm/slub.c:4200 selinux_tun_dev_free_security+0x15/0x20 security/selinux/hooks.c:5530 security_tun_dev_free_security+0x4d/0x90 security/security.c:2263 tun_set_iff+0xc98/0x1100 drivers/net/tun.c:2850 __tun_chr_ioctl+0x8ab/0x2130 drivers/net/tun.c:3095 tun_chr_ioctl+0x2a/0x40 drivers/net/tun.c:3371 vfs_ioctl fs/ioctl.c:48 [inline] __do_sys_ioctl fs/ioctl.c:753 [inline] __se_sys_ioctl+0x115/0x190 fs/ioctl.c:739 __x64_sys_ioctl+0x7b/0x90 fs/ioctl.c:739 do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xc6 The buggy address belongs to the object at ffff8881093c47f8 which belongs to the cache kmalloc-8 of size 8 The buggy address is located 0 bytes inside of 8-byte region [ffff8881093c47f8, ffff8881093c4800) The buggy address belongs to the page: page:ffffea000424f100 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1093c4 flags: 0x8000000000000200(slab) raw: 8000000000000200 dead000000000100 dead000000000122 ffff888100043c80 raw: 0000000000000000 0000000000660066 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 1, ts 1832382964, free_ts 0 set_page_owner include/linux/page_owner.h:35 [inline] post_alloc_hook mm/page_alloc.c:2385 [inline] prep_new_page mm/page_alloc.c:2391 [inline] get_page_from_freelist+0x745/0x760 mm/page_alloc.c:4067 __alloc_pages_nodemask+0x3b6/0x890 mm/page_alloc.c:5117 alloc_slab_page mm/slub.c:1815 [inline] allocate_slab+0x78/0x540 mm/slub.c:1817 new_slab mm/slub.c:1878 [inline] new_slab_objects mm/slub.c:2636 [inline] ___slab_alloc+0x131/0x2e0 mm/slub.c:2800 __slab_alloc+0x63/0xa0 mm/slub.c:2840 slab_alloc_node mm/slub.c:2922 [inline] slab_alloc mm/slub.c:2964 [inline] __kmalloc_track_caller+0x23e/0x350 mm/slub.c:4545 kvasprintf+0xd6/0x180 lib/kasprintf.c:25 kvasprintf_const+0x5e/0x180 lib/kasprintf.c:49 kobject_set_name_vargs+0x61/0x120 lib/kobject.c:289 dev_set_name+0xd1/0x120 drivers/base/core.c:3034 scsi_host_alloc+0x803/0xec0 drivers/scsi/hosts.c:481 virtscsi_probe+0x1fe/0xb60 drivers/scsi/virtio_scsi.c:864 virtio_dev_probe+0x813/0xad0 drivers/virtio/virtio.c:274 really_probe+0x5f0/0xfc0 drivers/base/dd.c:558 driver_probe_device+0x118/0x1c0 drivers/base/dd.c:747 device_driver_attach+0x186/0x290 drivers/base/dd.c:1025 page_owner free stack trace missing Memory state around the buggy address: ffff8881093c4680: fc fc 00 fc fc fc fc 00 fc fc fc fc 00 fc fc fc ffff8881093c4700: fc 00 fc fc fc fc 00 fc fc fc fc 00 fc fc fc fc >ffff8881093c4780: 00 fc fc fc fc 00 fc fc fc fc 00 fc fc fc fc fa ^ ffff8881093c4800: fc fc fc fc 00 fc fc fc fc 00 fc fc fc fc 00 fc ffff8881093c4880: fc fc fc 00 fc fc fc fc 00 fc fc fc fc 00 fc fc ==================================================================