================================================================== BUG: KASAN: double-free or invalid-free in slab_free mm/slub.c:3513 [inline] BUG: KASAN: double-free or invalid-free in kfree+0xf6/0x560 mm/slub.c:4561 CPU: 0 PID: 4058 Comm: syz-executor960 Not tainted 5.16.0-rc4-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description.constprop.0.cold+0x8d/0x320 mm/kasan/report.c:247 kasan_report_invalid_free+0x51/0x80 mm/kasan/report.c:372 ____kasan_slab_free mm/kasan/common.c:346 [inline] __kasan_slab_free+0x124/0x130 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:1723 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1749 slab_free mm/slub.c:3513 [inline] kfree+0xf6/0x560 mm/slub.c:4561 packet_set_ring+0xfa6/0x1b20 net/packet/af_packet.c:4495 packet_setsockopt+0x1bd3/0x3c10 net/packet/af_packet.c:3785 __sys_setsockopt+0x2db/0x610 net/socket.c:2176 __do_sys_setsockopt net/socket.c:2187 [inline] __se_sys_setsockopt net/socket.c:2184 [inline] __x64_sys_setsockopt+0xba/0x150 net/socket.c:2184 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7fa72f568139 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 41 15 00 00 90 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:00007fa72f4f8318 EFLAGS: 00000246 ORIG_RAX: 0000000000000036 RAX: ffffffffffffffda RBX: 00007fa72f5f14b8 RCX: 00007fa72f568139 RDX: 0000000000000005 RSI: 0000000000000107 RDI: 0000000000000003 RBP: 00007fa72f5f14b0 R08: 000000000000001c R09: 0000000000000000 R10: 00000000200000c0 R11: 0000000000000246 R12: 00007fa72f5be074 R13: 00007ffc06cde2cf R14: 00007fa72f4f8400 R15: 0000000000022000 Allocated by task 4057: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:434 [inline] ____kasan_kmalloc mm/kasan/common.c:513 [inline] ____kasan_kmalloc mm/kasan/common.c:472 [inline] __kasan_kmalloc+0xa9/0xd0 mm/kasan/common.c:522 kmalloc_array include/linux/slab.h:630 [inline] kcalloc include/linux/slab.h:661 [inline] alloc_pg_vec net/packet/af_packet.c:4317 [inline] packet_set_ring+0xa76/0x1b20 net/packet/af_packet.c:4407 packet_setsockopt+0x1bd3/0x3c10 net/packet/af_packet.c:3785 __sys_setsockopt+0x2db/0x610 net/socket.c:2176 __do_sys_setsockopt net/socket.c:2187 [inline] __se_sys_setsockopt net/socket.c:2184 [inline] __x64_sys_setsockopt+0xba/0x150 net/socket.c:2184 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 4057: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:46 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free mm/kasan/common.c:328 [inline] __kasan_slab_free+0xff/0x130 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:1723 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1749 slab_free mm/slub.c:3513 [inline] kfree+0xf6/0x560 mm/slub.c:4561 packet_set_ring+0x6c7/0x1b20 net/packet/af_packet.c:4497 packet_setsockopt+0x1bd3/0x3c10 net/packet/af_packet.c:3785 __sys_setsockopt+0x2db/0x610 net/socket.c:2176 __do_sys_setsockopt net/socket.c:2187 [inline] __se_sys_setsockopt net/socket.c:2184 [inline] __x64_sys_setsockopt+0xba/0x150 net/socket.c:2184 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff88801f146f80 which belongs to the cache kmalloc-64 of size 64 The buggy address is located 0 bytes inside of 64-byte region [ffff88801f146f80, ffff88801f146fc0) The buggy address belongs to the page: page:ffffea00007c5180 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1f146 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea0000682b00 dead000000000003 ffff888010c41640 raw: 0000000000000000 0000000000200020 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 11561985106, free_ts 0 prep_new_page mm/page_alloc.c:2418 [inline] get_page_from_freelist+0xa72/0x2f50 mm/page_alloc.c:4149 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5369 alloc_page_interleave+0x1e/0x200 mm/mempolicy.c:2036 alloc_pages+0x29f/0x300 mm/mempolicy.c:2186 alloc_slab_page mm/slub.c:1793 [inline] allocate_slab mm/slub.c:1930 [inline] new_slab+0x32d/0x4a0 mm/slub.c:1993 ___slab_alloc+0x918/0xfe0 mm/slub.c:3022 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3109 slab_alloc_node mm/slub.c:3200 [inline] slab_alloc mm/slub.c:3242 [inline] __kmalloc+0x2fb/0x340 mm/slub.c:4419 kmalloc_array include/linux/slab.h:630 [inline] kobj_map+0x72/0x440 drivers/base/map.c:44 cdev_add+0x9f/0x130 fs/char_dev.c:489 __video_register_device+0x20df/0x4ce0 drivers/media/v4l2-core/v4l2-dev.c:1023 video_register_device include/media/v4l2-dev.h:383 [inline] vivid_create_devnodes drivers/media/test-drivers/vivid/vivid-core.c:1595 [inline] vivid_create_instance drivers/media/test-drivers/vivid/vivid-core.c:1958 [inline] vivid_probe.cold+0x71a1/0x8586 drivers/media/test-drivers/vivid/vivid-core.c:2011 platform_probe+0xfc/0x1f0 drivers/base/platform.c:1411 call_driver_probe drivers/base/dd.c:517 [inline] really_probe+0x245/0xcc0 drivers/base/dd.c:596 __driver_probe_device+0x338/0x4d0 drivers/base/dd.c:751 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:781 page_owner free stack trace missing Memory state around the buggy address: ffff88801f146e80: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc ffff88801f146f00: 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc >ffff88801f146f80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ^ ffff88801f147000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88801f147080: 00 00 00 00 00 fc fc fc fc fc fc fc fc 00 00 00 ==================================================================