================================================================== BUG: KASAN: use-after-free in i2c_put_adapter drivers/i2c/i2c-core-base.c:2471 [inline] BUG: KASAN: use-after-free in i2c_put_adapter+0x4c/0x50 drivers/i2c/i2c-core-base.c:2465 Read of size 8 at addr ffff888016e341f8 by task syz-executor.3/26404 CPU: 1 PID: 26404 Comm: syz-executor.3 Not tainted 5.18.0-rc2-next-20220414-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 i2c_put_adapter drivers/i2c/i2c-core-base.c:2471 [inline] i2c_put_adapter+0x4c/0x50 drivers/i2c/i2c-core-base.c:2465 i2cdev_release+0x55/0xb0 drivers/i2c/i2c-dev.c:619 __fput+0x277/0x9d0 fs/file_table.c:317 task_work_run+0xdd/0x1a0 kernel/task_work.c:164 exit_task_work include/linux/task_work.h:37 [inline] do_exit+0xaff/0x2a00 kernel/exit.c:796 do_group_exit+0xd2/0x2f0 kernel/exit.c:926 get_signal+0x22df/0x24c0 kernel/signal.c:2864 arch_do_signal_or_restart+0x82/0x20f0 arch/x86/kernel/signal.c:867 exit_to_user_mode_loop kernel/entry/common.c:166 [inline] exit_to_user_mode_prepare+0x15f/0x250 kernel/entry/common.c:201 __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline] syscall_exit_to_user_mode+0x19/0x50 kernel/entry/common.c:294 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f44e8688ea7 Code: Unable to access opcode bytes at RIP 0x7f44e8688e7d. RSP: 002b:00007f44e9870098 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: fffffffffffffffc RBX: 00007f44e9871110 RCX: 00007f44e8688ea7 RDX: 00007f44e9871110 RSI: 0000000080085502 RDI: 0000000000000005 RBP: 0000000000000005 R08: 0000000000000100 R09: 00007f44e9870108 R10: 00007f44e9870140 R11: 0000000000000246 R12: 0000000800000000 R13: 0000000000000000 R14: 0000000000000008 R15: 00007f44e86eeafe The buggy address belongs to the physical page: page:ffffea00005b8d00 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x16e34 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 ffffea0001f9dc08 ffff8880b9d403f0 0000000000000000 raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 2, migratetype Unmovable, gfp_mask 0x140dc0(GFP_USER|__GFP_COMP|__GFP_ZERO), pid 3679, tgid 3679 (kworker/0:5), ts 1351984611111, free_ts 1355482502813 prep_new_page mm/page_alloc.c:2394 [inline] get_page_from_freelist+0xba2/0x3e00 mm/page_alloc.c:4144 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5365 alloc_pages+0x1aa/0x310 mm/mempolicy.c:2279 kmalloc_order+0x34/0xf0 mm/slab_common.c:946 kmalloc_order_trace+0x14/0x120 mm/slab_common.c:962 kmalloc_large include/linux/slab.h:517 [inline] kmalloc include/linux/slab.h:581 [inline] kzalloc include/linux/slab.h:721 [inline] pvr2_hdw_create+0x108/0x25b0 drivers/media/usb/pvrusb2/pvrusb2-hdw.c:2370 pvr2_context_create+0x1ae/0x280 drivers/media/usb/pvrusb2/pvrusb2-context.c:222 pvr_probe+0x21/0xc0 drivers/media/usb/pvrusb2/pvrusb2-main.c:62 usb_probe_interface+0x315/0x7f0 drivers/usb/core/driver.c:396 call_driver_probe drivers/base/dd.c:542 [inline] really_probe+0x23e/0xb20 drivers/base/dd.c:621 __driver_probe_device+0x338/0x4d0 drivers/base/dd.c:752 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:782 __device_attach_driver+0x20b/0x2f0 drivers/base/dd.c:899 bus_for_each_drv+0x15f/0x1e0 drivers/base/bus.c:427 __device_attach+0x228/0x4a0 drivers/base/dd.c:970 bus_probe_device+0x1e4/0x290 drivers/base/bus.c:487 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1309 [inline] free_pcp_prepare+0x549/0xd20 mm/page_alloc.c:1359 free_unref_page_prepare mm/page_alloc.c:3290 [inline] free_unref_page+0x19/0x6a0 mm/page_alloc.c:3385 pvr2_hdw_destroy+0x249/0x350 drivers/media/usb/pvrusb2/pvrusb2-hdw.c:2692 pvr2_context_destroy+0x84/0x230 drivers/media/usb/pvrusb2/pvrusb2-context.c:70 pvr2_context_check drivers/media/usb/pvrusb2/pvrusb2-context.c:137 [inline] pvr2_context_thread_func+0x647/0x850 drivers/media/usb/pvrusb2/pvrusb2-context.c:158 kthread+0x2e9/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 Memory state around the buggy address: ffff888016e34080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888016e34100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888016e34180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888016e34200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888016e34280: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================