================================================================== 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 ffff8880791981f8 by task syz-executor.5/30097 CPU: 0 PID: 30097 Comm: syz-executor.5 Not tainted 5.18.0-rc5-syzkaller-00028-ga7391ad35724 #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 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:169 [inline] exit_to_user_mode_prepare+0x23c/0x250 kernel/entry/common.c:201 __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline] syscall_exit_to_user_mode+0x19/0x60 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:0x7f62dd83bd2b Code: 0f 05 48 3d 00 f0 ff ff 77 45 c3 0f 1f 40 00 48 83 ec 18 89 7c 24 0c e8 63 fc ff ff 8b 7c 24 0c 41 89 c0 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 44 89 c7 89 44 24 0c e8 a1 fc ff ff 8b 44 RSP: 002b:00007f62ddecfb80 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 000000000000000c RCX: 00007f62dd83bd2b RDX: 0000001b2cc20000 RSI: 00007f62dd800000 RDI: 000000000000000b RBP: 00007f62dd99d960 R08: 0000000000000000 R09: 00000000290858ad R10: 00007ffd2f378090 R11: 0000000000000293 R12: 000000000010bb4b R13: 00007f62ddecfc80 R14: 00007f62ddecfca0 R15: 0000000000000032 The buggy address belongs to the physical page: page:ffffea0001e46600 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x79198 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 ffffea0001095f08 ffff8880b9d40498 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 3660, tgid 3660 (kworker/0:5), ts 1095085214145, free_ts 1096771741991 prep_new_page mm/page_alloc.c:2441 [inline] get_page_from_freelist+0xba2/0x3e00 mm/page_alloc.c:4182 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5408 alloc_pages+0x1aa/0x310 mm/mempolicy.c:2272 kmalloc_order+0x34/0xf0 mm/slab_common.c:953 kmalloc_order_trace+0x14/0x120 mm/slab_common.c:969 kmalloc_large include/linux/slab.h:510 [inline] kmalloc include/linux/slab.h:574 [inline] kzalloc include/linux/slab.h:714 [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:1356 [inline] free_pcp_prepare+0x549/0xd20 mm/page_alloc.c:1406 free_unref_page_prepare mm/page_alloc.c:3328 [inline] free_unref_page+0x19/0x6a0 mm/page_alloc.c:3423 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: ffff888079198080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888079198100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888079198180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888079198200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888079198280: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================