================================================================== BUG: KASAN: use-after-free in si470x_int_in_callback.cold+0x96/0xbf drivers/media/radio/si470x/radio-si470x-usb.c:378 Read of size 8 at addr ffff88801e880ac0 by task pr/ttyS0/16 CPU: 1 PID: 16 Comm: pr/ttyS0 Not tainted 5.18.0-next-20220526-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+0xeb/0x495 mm/kasan/report.c:313 print_report mm/kasan/report.c:429 [inline] kasan_report.cold+0xf4/0x1c6 mm/kasan/report.c:491 si470x_int_in_callback.cold+0x96/0xbf drivers/media/radio/si470x/radio-si470x-usb.c:378 __usb_hcd_giveback_urb+0x2b0/0x5c0 drivers/usb/core/hcd.c:1670 usb_hcd_giveback_urb+0x367/0x410 drivers/usb/core/hcd.c:1747 dummy_timer+0x11f9/0x32b0 drivers/usb/gadget/udc/dummy_hcd.c:1988 call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1474 expire_timers kernel/time/timer.c:1519 [inline] __run_timers.part.0+0x679/0xa80 kernel/time/timer.c:1790 __run_timers kernel/time/timer.c:1768 [inline] run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1803 __do_softirq+0x29b/0x9c2 kernel/softirq.c:571 invoke_softirq kernel/softirq.c:445 [inline] __irq_exit_rcu+0x123/0x180 kernel/softirq.c:650 irq_exit_rcu+0x5/0x20 kernel/softirq.c:662 sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1106 asm_sysvec_apic_timer_interrupt+0x1b/0x20 arch/x86/include/asm/idtentry.h:649 RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:152 [inline] RIP: 0010:_raw_spin_unlock_irqrestore+0x38/0x70 kernel/locking/spinlock.c:194 Code: 74 24 10 e8 0a ae e4 f7 48 89 ef e8 12 2f e5 f7 81 e3 00 02 00 00 75 25 9c 58 f6 c4 02 75 2d 48 85 db 74 01 fb bf 01 00 00 00 43 37 d8 f7 65 8b 05 dc a6 88 76 85 c0 74 0a 5b 5d c3 e8 60 18 RSP: 0018:ffffc90000157b60 EFLAGS: 00000206 RAX: 0000000000000002 RBX: 0000000000000200 RCX: 1ffffffff2015a96 RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000001 RBP: ffffffff908c93a0 R08: 0000000000000001 R09: ffffffff900ac8c7 R10: 0000000000000001 R11: 0000000000000001 R12: 0000000000000002 R13: ffffffff908c93a0 R14: ffffffff84605ed0 R15: 0000000000000000 spin_unlock_irqrestore include/linux/spinlock.h:415 [inline] serial8250_console_write+0xd97/0xfe0 drivers/tty/serial/8250/8250_port.c:3465 call_console_driver kernel/printk/printk.c:2075 [inline] __console_emit_next_record+0x896/0xa60 kernel/printk/printk.c:2916 console_emit_next_record kernel/printk/printk.c:3721 [inline] printk_kthread_func.cold+0x702/0x73d kernel/printk/printk.c:3837 kthread+0x2e9/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:302 Allocated by task 142: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:436 [inline] ____kasan_kmalloc mm/kasan/common.c:515 [inline] ____kasan_kmalloc mm/kasan/common.c:474 [inline] __kasan_kmalloc+0xa9/0xd0 mm/kasan/common.c:524 kmalloc include/linux/slab.h:600 [inline] kzalloc include/linux/slab.h:733 [inline] si470x_usb_driver_probe+0x51/0xf90 drivers/media/radio/si470x/radio-si470x-usb.c:573 usb_probe_interface+0x315/0x7f0 drivers/usb/core/driver.c:396 call_driver_probe drivers/base/dd.c:562 [inline] really_probe+0x23e/0xb90 drivers/base/dd.c:641 __driver_probe_device+0x338/0x4d0 drivers/base/dd.c:774 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:804 __device_attach_driver+0x20b/0x2f0 drivers/base/dd.c:927 bus_for_each_drv+0x15f/0x1e0 drivers/base/bus.c:427 __device_attach+0x1e4/0x530 drivers/base/dd.c:999 bus_probe_device+0x1e4/0x290 drivers/base/bus.c:487 device_add+0xbda/0x1ea0 drivers/base/core.c:3417 usb_set_configuration+0x101e/0x1900 drivers/usb/core/message.c:2170 usb_generic_driver_probe+0xba/0x100 drivers/usb/core/generic.c:238 usb_probe_device+0xd9/0x2c0 drivers/usb/core/driver.c:293 call_driver_probe drivers/base/dd.c:562 [inline] really_probe+0x23e/0xb90 drivers/base/dd.c:641 __driver_probe_device+0x338/0x4d0 drivers/base/dd.c:774 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:804 __device_attach_driver+0x20b/0x2f0 drivers/base/dd.c:927 bus_for_each_drv+0x15f/0x1e0 drivers/base/bus.c:427 __device_attach+0x1e4/0x530 drivers/base/dd.c:999 bus_probe_device+0x1e4/0x290 drivers/base/bus.c:487 device_add+0xbda/0x1ea0 drivers/base/core.c:3417 usb_new_device.cold+0x641/0x1091 drivers/usb/core/hub.c:2566 hub_port_connect drivers/usb/core/hub.c:5363 [inline] hub_port_connect_change drivers/usb/core/hub.c:5507 [inline] port_event drivers/usb/core/hub.c:5663 [inline] hub_event+0x25d5/0x4690 drivers/usb/core/hub.c:5745 process_one_work+0x996/0x1610 kernel/workqueue.c:2289 worker_thread+0x665/0x1080 kernel/workqueue.c:2436 kthread+0x2e9/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:302 Freed by task 142: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:45 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free+0x166/0x1a0 mm/kasan/common.c:328 kasan_slab_free include/linux/kasan.h:200 [inline] slab_free_hook mm/slub.c:1727 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1753 slab_free mm/slub.c:3507 [inline] kfree+0xd6/0x4d0 mm/slub.c:4555 si470x_usb_driver_probe+0xb3d/0xf90 drivers/media/radio/si470x/radio-si470x-usb.c:760 usb_probe_interface+0x315/0x7f0 drivers/usb/core/driver.c:396 call_driver_probe drivers/base/dd.c:562 [inline] really_probe+0x23e/0xb90 drivers/base/dd.c:641 __driver_probe_device+0x338/0x4d0 drivers/base/dd.c:774 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:804 __device_attach_driver+0x20b/0x2f0 drivers/base/dd.c:927 bus_for_each_drv+0x15f/0x1e0 drivers/base/bus.c:427 __device_attach+0x1e4/0x530 drivers/base/dd.c:999 bus_probe_device+0x1e4/0x290 drivers/base/bus.c:487 device_add+0xbda/0x1ea0 drivers/base/core.c:3417 usb_set_configuration+0x101e/0x1900 drivers/usb/core/message.c:2170 usb_generic_driver_probe+0xba/0x100 drivers/usb/core/generic.c:238 usb_probe_device+0xd9/0x2c0 drivers/usb/core/driver.c:293 call_driver_probe drivers/base/dd.c:562 [inline] really_probe+0x23e/0xb90 drivers/base/dd.c:641 __driver_probe_device+0x338/0x4d0 drivers/base/dd.c:774 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:804 __device_attach_driver+0x20b/0x2f0 drivers/base/dd.c:927 bus_for_each_drv+0x15f/0x1e0 drivers/base/bus.c:427 __device_attach+0x1e4/0x530 drivers/base/dd.c:999 bus_probe_device+0x1e4/0x290 drivers/base/bus.c:487 device_add+0xbda/0x1ea0 drivers/base/core.c:3417 usb_new_device.cold+0x641/0x1091 drivers/usb/core/hub.c:2566 hub_port_connect drivers/usb/core/hub.c:5363 [inline] hub_port_connect_change drivers/usb/core/hub.c:5507 [inline] port_event drivers/usb/core/hub.c:5663 [inline] hub_event+0x25d5/0x4690 drivers/usb/core/hub.c:5745 process_one_work+0x996/0x1610 kernel/workqueue.c:2289 worker_thread+0x665/0x1080 kernel/workqueue.c:2436 kthread+0x2e9/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:302 The buggy address belongs to the object at ffff88801e880000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 2752 bytes inside of 4096-byte region [ffff88801e880000, ffff88801e881000) The buggy address belongs to the physical page: page:ffffea00007a2000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1e880 head:ffffea00007a2000 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 0000000000000000 dead000000000001 ffff888010c42140 raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 3254, tgid 3254 (dhcpcd-run-hook), ts 36378961419, free_ts 36360175842 prep_new_page mm/page_alloc.c:2448 [inline] get_page_from_freelist+0xa64/0x3d10 mm/page_alloc.c:4267 __alloc_pages+0x1c7/0x510 mm/page_alloc.c:5491 alloc_pages+0x1aa/0x310 mm/mempolicy.c:2272 alloc_slab_page mm/slub.c:1797 [inline] allocate_slab+0x26c/0x3c0 mm/slub.c:1942 new_slab mm/slub.c:2002 [inline] ___slab_alloc+0x985/0xd90 mm/slub.c:3002 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3089 slab_alloc_node mm/slub.c:3180 [inline] slab_alloc mm/slub.c:3222 [inline] __kmalloc+0x318/0x350 mm/slub.c:4413 kmalloc include/linux/slab.h:605 [inline] tomoyo_realpath_from_path+0xc3/0x620 security/tomoyo/realpath.c:254 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x21b/0x400 security/tomoyo/file.c:822 security_inode_getattr+0xcf/0x140 security/security.c:1344 vfs_getattr fs/stat.c:157 [inline] vfs_statx+0x16a/0x390 fs/stat.c:232 vfs_fstatat+0x8c/0xb0 fs/stat.c:255 __do_sys_newfstatat+0x91/0x110 fs/stat.c:425 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+0x46/0xb0 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1363 [inline] free_pcp_prepare+0x549/0xd20 mm/page_alloc.c:1413 free_unref_page_prepare mm/page_alloc.c:3299 [inline] free_unref_page+0x19/0x7b0 mm/page_alloc.c:3414 __unfreeze_partials+0x17c/0x1a0 mm/slub.c:2521 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0xa2/0xc0 mm/kasan/common.c:446 kasan_slab_alloc include/linux/kasan.h:224 [inline] slab_post_alloc_hook mm/slab.h:750 [inline] slab_alloc_node mm/slub.c:3214 [inline] slab_alloc mm/slub.c:3222 [inline] kmem_cache_alloc_trace+0x26d/0x3f0 mm/slub.c:3253 kmalloc include/linux/slab.h:600 [inline] kzalloc include/linux/slab.h:733 [inline] ext4_htree_create_dir_info fs/ext4/dir.c:438 [inline] ext4_dx_readdir fs/ext4/dir.c:556 [inline] ext4_readdir+0x2619/0x38b0 fs/ext4/dir.c:142 iterate_dir+0x56a/0x6f0 fs/readdir.c:65 __do_sys_getdents64 fs/readdir.c:369 [inline] __se_sys_getdents64 fs/readdir.c:354 [inline] __x64_sys_getdents64+0x13a/0x2c0 fs/readdir.c:354 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+0x46/0xb0 Memory state around the buggy address: ffff88801e880980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88801e880a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88801e880a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88801e880b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88801e880b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 74 24 je 0x26 2: 10 e8 adc %ch,%al 4: 0a ae e4 f7 48 89 or -0x76b7081c(%rsi),%ch a: ef out %eax,(%dx) b: e8 12 2f e5 f7 callq 0xf7e52f22 10: 81 e3 00 02 00 00 and $0x200,%ebx 16: 75 25 jne 0x3d 18: 9c pushfq 19: 58 pop %rax 1a: f6 c4 02 test $0x2,%ah 1d: 75 2d jne 0x4c 1f: 48 85 db test %rbx,%rbx 22: 74 01 je 0x25 24: fb sti 25: bf 01 00 00 00 mov $0x1,%edi * 2a: e8 43 37 d8 f7 callq 0xf7d83772 <-- trapping instruction 2f: 65 8b 05 dc a6 88 76 mov %gs:0x7688a6dc(%rip),%eax # 0x7688a712 36: 85 c0 test %eax,%eax 38: 74 0a je 0x44 3a: 5b pop %rbx 3b: 5d pop %rbp 3c: c3 retq 3d: e8 .byte 0xe8 3e: 60 (bad) 3f: 18 .byte 0x18