================================================================== BUG: KASAN: slab-out-of-bounds in mcp2221_raw_event+0xf98/0x1030 drivers/hid/hid-mcp2221.c:852 Read of size 1 at addr ffff888101f07fff by task syz.1.3894/22740 CPU: 0 UID: 0 PID: 22740 Comm: syz.1.3894 Not tainted 6.13.0-rc1-syzkaller-gd8d936c51388 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xc3/0x620 mm/kasan/report.c:489 kasan_report+0xd9/0x110 mm/kasan/report.c:602 mcp2221_raw_event+0xf98/0x1030 drivers/hid/hid-mcp2221.c:852 __hid_input_report.constprop.0+0x312/0x440 drivers/hid/hid-core.c:2111 hid_irq_in+0x35e/0x870 drivers/hid/usbhid/hid-core.c:285 __usb_hcd_giveback_urb+0x389/0x6e0 drivers/usb/core/hcd.c:1650 usb_hcd_giveback_urb+0x396/0x450 drivers/usb/core/hcd.c:1734 dummy_timer+0x17f0/0x3930 drivers/usb/gadget/udc/dummy_hcd.c:1993 __run_hrtimer kernel/time/hrtimer.c:1739 [inline] __hrtimer_run_queues+0x20a/0xae0 kernel/time/hrtimer.c:1803 hrtimer_run_softirq+0x17d/0x350 kernel/time/hrtimer.c:1820 handle_softirqs+0x206/0x8d0 kernel/softirq.c:554 __do_softirq kernel/softirq.c:588 [inline] invoke_softirq kernel/softirq.c:428 [inline] __irq_exit_rcu+0xfa/0x160 kernel/softirq.c:655 irq_exit_rcu+0x9/0x30 kernel/softirq.c:671 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1049 [inline] sysvec_apic_timer_interrupt+0x90/0xb0 arch/x86/kernel/apic/apic.c:1049 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702 RIP: 0010:_compound_head include/linux/page-flags.h:244 [inline] RIP: 0010:free_pages_and_swap_cache+0x21b/0x510 mm/swap_state.c:323 Code: 0f 85 6d 02 00 00 4d 8b 75 00 4c 89 f5 48 83 e5 fc 48 8d 7d 08 48 89 f8 48 c1 e8 03 80 3c 18 00 0f 85 b0 02 00 00 48 8b 45 08 <31> ff 49 89 c7 48 89 44 24 10 41 83 e7 01 4c 89 fe e8 9f 16 ac ff RSP: 0018:ffffc900046cf708 EFLAGS: 00000246 RAX: 0000000000000000 RBX: dffffc0000000000 RCX: ffff8881315cc010 RDX: ffff88811b99d7c0 RSI: ffffffff81af3ddb RDI: ffffea0004714788 RBP: ffffea0004714780 R08: 0000000000000004 R09: 00000000000001fd R10: 000000000000007d R11: 0000000000000001 R12: 000000000000007d R13: ffff8881315cc3f8 R14: ffffea0004714780 R15: 00000000000001fd __tlb_batch_free_encoded_pages+0xf9/0x290 mm/mmu_gather.c:136 tlb_batch_pages_flush mm/mmu_gather.c:149 [inline] tlb_flush_mmu_free mm/mmu_gather.c:366 [inline] tlb_flush_mmu mm/mmu_gather.c:373 [inline] tlb_finish_mmu+0x168/0x7b0 mm/mmu_gather.c:465 exit_mmap+0x3df/0xb20 mm/mmap.c:1680 __mmput kernel/fork.c:1353 [inline] mmput+0xdb/0x430 kernel/fork.c:1375 exit_mm kernel/exit.c:570 [inline] do_exit+0x9bf/0x2ce0 kernel/exit.c:925 do_group_exit+0xd3/0x2a0 kernel/exit.c:1087 get_signal+0x24ed/0x26c0 kernel/signal.c:3017 arch_do_signal_or_restart+0x90/0x7e0 arch/x86/kernel/signal.c:337 exit_to_user_mode_loop kernel/entry/common.c:111 [inline] exit_to_user_mode_prepare include/linux/entry-common.h:329 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline] syscall_exit_to_user_mode+0x147/0x260 kernel/entry/common.c:218 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Allocated by task 5233: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:377 [inline] __kasan_kmalloc+0x8f/0xa0 mm/kasan/common.c:394 kmalloc_noprof include/linux/slab.h:901 [inline] slab_free_hook mm/slub.c:2290 [inline] slab_free mm/slub.c:4598 [inline] kmem_cache_free+0x2d0/0x470 mm/slub.c:4700 file_free fs/file_table.c:76 [inline] fput+0x3ad/0x440 fs/file_table.c:505 path_openat+0xec1/0x2d60 fs/namei.c:3996 do_filp_open+0x20c/0x470 fs/namei.c:4014 do_sys_openat2+0x17a/0x1e0 fs/open.c:1402 do_sys_open fs/open.c:1417 [inline] __do_sys_openat fs/open.c:1433 [inline] __se_sys_openat fs/open.c:1428 [inline] __x64_sys_openat+0x175/0x210 fs/open.c:1428 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 22049: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:582 poison_slab_object mm/kasan/common.c:247 [inline] __kasan_slab_free+0x37/0x50 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:233 [inline] slab_free_hook mm/slub.c:2338 [inline] slab_free mm/slub.c:4598 [inline] kfree+0x130/0x470 mm/slub.c:4746 slab_free_after_rcu_debug+0x69/0x2b0 mm/slub.c:4635 rcu_do_batch kernel/rcu/tree.c:2567 [inline] rcu_core+0x79d/0x14d0 kernel/rcu/tree.c:2823 handle_softirqs+0x206/0x8d0 kernel/softirq.c:554 __do_softirq kernel/softirq.c:588 [inline] invoke_softirq kernel/softirq.c:428 [inline] __irq_exit_rcu+0xfa/0x160 kernel/softirq.c:655 irq_exit_rcu+0x9/0x30 kernel/softirq.c:671 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1049 [inline] sysvec_apic_timer_interrupt+0x90/0xb0 arch/x86/kernel/apic/apic.c:1049 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702 Last potentially related work creation: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 __kasan_record_aux_stack+0x9b/0xb0 mm/kasan/generic.c:544 __call_rcu_common.constprop.0+0x99/0x7a0 kernel/rcu/tree.c:3086 slab_free_hook mm/slub.c:2302 [inline] slab_free mm/slub.c:4598 [inline] kmem_cache_free+0x2fe/0x470 mm/slub.c:4700 file_free fs/file_table.c:76 [inline] fput+0x3ad/0x440 fs/file_table.c:505 path_openat+0xec1/0x2d60 fs/namei.c:3996 do_filp_open+0x20c/0x470 fs/namei.c:4014 do_sys_openat2+0x17a/0x1e0 fs/open.c:1402 do_sys_open fs/open.c:1417 [inline] __do_sys_openat fs/open.c:1433 [inline] __se_sys_openat fs/open.c:1428 [inline] __x64_sys_openat+0x175/0x210 fs/open.c:1428 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff888101f07fc0 which belongs to the cache kmalloc-32 of size 32 The buggy address is located 31 bytes to the right of allocated 32-byte region [ffff888101f07fc0, ffff888101f07fe0) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101f07 anon flags: 0x200000000000000(node=0|zone=2) page_type: f5(slab) raw: 0200000000000000 ffff888100041780 ffffea00046b3c80 dead000000000003 raw: 0000000000000000 0000000000400040 00000001f5000000 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 0x52800(GFP_NOWAIT|__GFP_NORETRY|__GFP_COMP), pid 3311, tgid 3311 (modprobe), ts 45264848505, free_ts 45127892356 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1556 prep_new_page mm/page_alloc.c:1564 [inline] get_page_from_freelist+0xe76/0x2b90 mm/page_alloc.c:3474 __alloc_pages_noprof+0x21c/0x22a0 mm/page_alloc.c:4751 alloc_pages_mpol_noprof+0xeb/0x400 mm/mempolicy.c:2265 alloc_slab_page mm/slub.c:2408 [inline] allocate_slab mm/slub.c:2574 [inline] new_slab+0x2c9/0x410 mm/slub.c:2627 ___slab_alloc+0xd45/0x1750 mm/slub.c:3815 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3905 __slab_alloc_node mm/slub.c:3980 [inline] slab_alloc_node mm/slub.c:4141 [inline] __kmalloc_cache_noprof+0x217/0x3e0 mm/slub.c:4309 kmalloc_noprof include/linux/slab.h:901 [inline] slab_free_hook mm/slub.c:2290 [inline] slab_free mm/slub.c:4598 [inline] kmem_cache_free+0x2d0/0x470 mm/slub.c:4700 file_free fs/file_table.c:76 [inline] fput+0x3ad/0x440 fs/file_table.c:505 path_openat+0xec1/0x2d60 fs/namei.c:3996 do_filp_open+0x20c/0x470 fs/namei.c:4014 do_sys_openat2+0x17a/0x1e0 fs/open.c:1402 do_sys_open fs/open.c:1417 [inline] __do_sys_openat fs/open.c:1433 [inline] __se_sys_openat fs/open.c:1428 [inline] __x64_sys_openat+0x175/0x210 fs/open.c:1428 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f page last free pid 3302 tgid 3302 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1127 [inline] free_unref_page+0x661/0xe40 mm/page_alloc.c:2657 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x4e/0x120 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x195/0x1e0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x4e/0x70 mm/kasan/common.c:329 kasan_slab_alloc include/linux/kasan.h:250 [inline] slab_post_alloc_hook mm/slub.c:4104 [inline] slab_alloc_node mm/slub.c:4153 [inline] kmem_cache_alloc_noprof+0x154/0x3b0 mm/slub.c:4160 vm_area_alloc+0x1f/0x1f0 kernel/fork.c:472 __install_special_mapping mm/mmap.c:1877 [inline] _install_special_mapping+0x2e/0x3d0 mm/mmap.c:1925 map_vdso+0x160/0x590 arch/x86/entry/vdso/vma.c:267 arch_setup_additional_pages+0x33/0x50 arch/x86/entry/vdso/vma.c:357 load_elf_binary+0x1fd0/0x4ec0 fs/binfmt_elf.c:1278 search_binary_handler fs/exec.c:1748 [inline] exec_binprm fs/exec.c:1790 [inline] bprm_execve fs/exec.c:1842 [inline] bprm_execve+0x703/0x19a0 fs/exec.c:1818 kernel_execve+0x2ef/0x3b0 fs/exec.c:2009 call_usermodehelper_exec_async+0x255/0x4c0 kernel/umh.c:109 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Memory state around the buggy address: ffff888101f07e80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc ffff888101f07f00: fa fb fb fb fc fc fc fc 00 00 06 fc fc fc fc fc >ffff888101f07f80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc ^ ffff888101f08000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888101f08080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ================================================================== ---------------- Code disassembly (best guess): 0: 0f 85 6d 02 00 00 jne 0x273 6: 4d 8b 75 00 mov 0x0(%r13),%r14 a: 4c 89 f5 mov %r14,%rbp d: 48 83 e5 fc and $0xfffffffffffffffc,%rbp 11: 48 8d 7d 08 lea 0x8(%rbp),%rdi 15: 48 89 f8 mov %rdi,%rax 18: 48 c1 e8 03 shr $0x3,%rax 1c: 80 3c 18 00 cmpb $0x0,(%rax,%rbx,1) 20: 0f 85 b0 02 00 00 jne 0x2d6 26: 48 8b 45 08 mov 0x8(%rbp),%rax * 2a: 31 ff xor %edi,%edi <-- trapping instruction 2c: 49 89 c7 mov %rax,%r15 2f: 48 89 44 24 10 mov %rax,0x10(%rsp) 34: 41 83 e7 01 and $0x1,%r15d 38: 4c 89 fe mov %r15,%rsi 3b: e8 9f 16 ac ff call 0xffac16df