bisecting fixing commit since 4010a528219e01dd02e768b22168f7f0e78365ce building syzkaller on 9a4781d43abfb86fe8521cb6fb084519e237454c testing commit 4010a528219e01dd02e768b22168f7f0e78365ce compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 030d6b6724621dc857b1d0db70c6342e74649bae266c754ace8ec11300ea81cf run #0: crashed: KASAN: use-after-free Read in v4l2_fh_init run #1: crashed: KASAN: use-after-free Read in v4l2_fh_init run #2: crashed: KASAN: use-after-free Read in v4l2_fh_init run #3: crashed: KASAN: use-after-free Read in em28xx_release_resources run #4: crashed: KASAN: use-after-free Read in v4l2_fh_init run #5: crashed: KASAN: use-after-free Read in v4l2_fh_init run #6: crashed: KASAN: use-after-free Read in v4l2_fh_init run #7: crashed: KASAN: use-after-free Read in v4l2_fh_init run #8: crashed: KASAN: use-after-free Read in v4l2_fh_init run #9: crashed: KASAN: use-after-free Read in v4l2_fh_init run #10: crashed: KASAN: use-after-free Read in v4l2_fh_init run #11: crashed: KASAN: use-after-free Read in v4l2_fh_init run #12: crashed: KASAN: use-after-free Read in v4l2_fh_init run #13: crashed: KASAN: use-after-free Read in v4l2_fh_init run #14: crashed: KASAN: use-after-free Read in v4l2_fh_init run #15: crashed: KASAN: use-after-free Read in em28xx_release_resources run #16: crashed: KASAN: use-after-free Read in v4l2_fh_init run #17: crashed: KASAN: use-after-free Read in v4l2_fh_init run #18: crashed: KASAN: use-after-free Read in v4l2_fh_init run #19: crashed: KASAN: use-after-free Read in v4l2_fh_init testing current HEAD d4439a1189f93d0ac1eaf0197db8e6b3e197d5c7 testing commit d4439a1189f93d0ac1eaf0197db8e6b3e197d5c7 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: c2f0afee81ef2bac324dd582b64376042341a972a0e2c56a641b6c82fd679e01 run #0: crashed: KASAN: use-after-free Read in v4l2_fh_init run #1: crashed: KASAN: use-after-free Read in v4l2_fh_init run #2: crashed: KASAN: use-after-free Read in v4l2_fh_init run #3: crashed: KASAN: use-after-free Read in v4l2_fh_init run #4: crashed: KASAN: use-after-free Read in v4l2_fh_init run #5: crashed: KASAN: use-after-free Read in v4l2_fh_init run #6: crashed: KASAN: use-after-free Read in v4l2_fh_init run #7: crashed: KASAN: use-after-free Read in v4l2_fh_init run #8: crashed: KASAN: use-after-free Read in v4l2_fh_init run #9: crashed: KASAN: use-after-free Read in em28xx_release_resources revisions tested: 2, total time: 24m16.268501236s (build: 13m9.231518548s, test: 10m23.570245296s) the crash still happens on HEAD commit msg: Merge tag 'hsi-for-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-hsi crash: KASAN: use-after-free Read in em28xx_release_resources em28xx 6-1:0.192: Closing input extension ================================================================== BUG: KASAN: use-after-free in media_device_unregister drivers/media/mc/mc-device.c:823 [inline] BUG: KASAN: use-after-free in media_device_unregister+0x547/0x5a0 drivers/media/mc/mc-device.c:801 Read of size 8 at addr ffff888067318210 by task kworker/1:6/9001 CPU: 1 PID: 9001 Comm: kworker/1:6 Not tainted 5.15.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: usb_hub_wq hub_event Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x57/0x7d lib/dump_stack.c:106 print_address_description.constprop.0.cold+0x6c/0x2d6 mm/kasan/report.c:256 __kasan_report mm/kasan/report.c:442 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:459 media_device_unregister drivers/media/mc/mc-device.c:823 [inline] media_device_unregister+0x547/0x5a0 drivers/media/mc/mc-device.c:801 em28xx_unregister_media_device drivers/media/usb/em28xx/em28xx-cards.c:3469 [inline] em28xx_release_resources+0xa0/0x216 drivers/media/usb/em28xx/em28xx-cards.c:3490 em28xx_usb_disconnect.cold+0x11c/0x23a drivers/media/usb/em28xx/em28xx-cards.c:4152 usb_unbind_interface+0x183/0x7e0 drivers/usb/core/driver.c:458 __device_release_driver+0x523/0x660 drivers/base/dd.c:1205 device_release_driver_internal drivers/base/dd.c:1236 [inline] device_release_driver+0x21/0x30 drivers/base/dd.c:1259 bus_remove_device+0x295/0x550 drivers/base/bus.c:529 device_del+0x494/0xc20 drivers/base/core.c:3581 usb_disable_device+0x29c/0x660 drivers/usb/core/message.c:1419 usb_disconnect.cold+0x209/0x67e drivers/usb/core/hub.c:2225 hub_port_connect drivers/usb/core/hub.c:5199 [inline] hub_port_connect_change drivers/usb/core/hub.c:5488 [inline] port_event drivers/usb/core/hub.c:5634 [inline] hub_event+0xb22/0x36c0 drivers/usb/core/hub.c:5716 process_one_work+0x87f/0x1450 kernel/workqueue.c:2298 process_scheduled_works kernel/workqueue.c:2361 [inline] worker_thread+0x74b/0x1040 kernel/workqueue.c:2447 kthread+0x3ab/0x480 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Allocated by task 20: kasan_save_stack+0x1b/0x40 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+0xa1/0xd0 mm/kasan/common.c:522 kasan_kmalloc include/linux/kasan.h:269 [inline] kmem_cache_alloc_trace+0x1e4/0x480 mm/slab.c:3575 kmalloc include/linux/slab.h:591 [inline] kzalloc include/linux/slab.h:721 [inline] em28xx_v4l2_init drivers/media/usb/em28xx/em28xx-video.c:2542 [inline] em28xx_v4l2_init.cold+0x91/0x2d6d drivers/media/usb/em28xx/em28xx-video.c:2520 em28xx_init_extension+0x106/0x1c0 drivers/media/usb/em28xx/em28xx-core.c:1126 process_one_work+0x87f/0x1450 kernel/workqueue.c:2298 worker_thread+0x598/0x1040 kernel/workqueue.c:2445 kthread+0x3ab/0x480 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Freed by task 20: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_set_track+0x1c/0x30 mm/kasan/common.c:46 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:360 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free mm/kasan/common.c:328 [inline] __kasan_slab_free+0xd1/0x110 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:235 [inline] __cache_free mm/slab.c:3445 [inline] kfree+0x10a/0x2c0 mm/slab.c:3803 em28xx_v4l2_init drivers/media/usb/em28xx/em28xx-video.c:2911 [inline] em28xx_v4l2_init.cold+0x24a/0x2d6d drivers/media/usb/em28xx/em28xx-video.c:2520 em28xx_init_extension+0x106/0x1c0 drivers/media/usb/em28xx/em28xx-core.c:1126 process_one_work+0x87f/0x1450 kernel/workqueue.c:2298 worker_thread+0x598/0x1040 kernel/workqueue.c:2445 kthread+0x3ab/0x480 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Last potentially related work creation: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_record_aux_stack+0xa7/0xd0 mm/kasan/generic.c:348 insert_work+0x42/0x300 kernel/workqueue.c:1354 __queue_work+0x4a5/0xc80 kernel/workqueue.c:1520 queue_work_on+0x70/0x80 kernel/workqueue.c:1547 queue_work include/linux/workqueue.h:502 [inline] schedule_work include/linux/workqueue.h:563 [inline] request_modules drivers/media/usb/em28xx/em28xx-cards.c:3435 [inline] em28xx_usb_probe.cold+0x1226/0x2282 drivers/media/usb/em28xx/em28xx-cards.c:4093 usb_probe_interface+0x274/0x6a0 drivers/usb/core/driver.c:396 call_driver_probe drivers/base/dd.c:517 [inline] really_probe+0x1c2/0xb60 drivers/base/dd.c:596 __driver_probe_device+0x2a6/0x460 drivers/base/dd.c:751 driver_probe_device+0x44/0x110 drivers/base/dd.c:781 __device_attach_driver+0x185/0x250 drivers/base/dd.c:898 bus_for_each_drv+0x11e/0x1a0 drivers/base/bus.c:427 __device_attach+0x1db/0x410 drivers/base/dd.c:969 bus_probe_device+0x19d/0x250 drivers/base/bus.c:487 device_add+0xa57/0x1b90 drivers/base/core.c:3394 usb_set_configuration+0xc1d/0x1710 drivers/usb/core/message.c:2170 usb_generic_driver_probe+0x74/0xa0 drivers/usb/core/generic.c:238 usb_probe_device+0x95/0x240 drivers/usb/core/driver.c:293 call_driver_probe drivers/base/dd.c:517 [inline] really_probe+0x1c2/0xb60 drivers/base/dd.c:596 __driver_probe_device+0x2a6/0x460 drivers/base/dd.c:751 driver_probe_device+0x44/0x110 drivers/base/dd.c:781 __device_attach_driver+0x185/0x250 drivers/base/dd.c:898 bus_for_each_drv+0x11e/0x1a0 drivers/base/bus.c:427 __device_attach+0x1db/0x410 drivers/base/dd.c:969 bus_probe_device+0x19d/0x250 drivers/base/bus.c:487 device_add+0xa57/0x1b90 drivers/base/core.c:3394 usb_new_device.cold+0x5cf/0xee8 drivers/usb/core/hub.c:2563 hub_port_connect drivers/usb/core/hub.c:5348 [inline] hub_port_connect_change drivers/usb/core/hub.c:5488 [inline] port_event drivers/usb/core/hub.c:5634 [inline] hub_event+0x10a3/0x36c0 drivers/usb/core/hub.c:5716 process_one_work+0x87f/0x1450 kernel/workqueue.c:2298 process_scheduled_works kernel/workqueue.c:2361 [inline] worker_thread+0x74b/0x1040 kernel/workqueue.c:2447 kthread+0x3ab/0x480 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Second to last potentially related work creation: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_record_aux_stack+0xa7/0xd0 mm/kasan/generic.c:348 insert_work+0x42/0x300 kernel/workqueue.c:1354 __queue_work+0x4a5/0xc80 kernel/workqueue.c:1520 queue_work_on+0x70/0x80 kernel/workqueue.c:1547 queue_work include/linux/workqueue.h:502 [inline] schedule_work include/linux/workqueue.h:563 [inline] request_modules drivers/media/usb/em28xx/em28xx-cards.c:3435 [inline] em28xx_usb_probe.cold+0x1226/0x2282 drivers/media/usb/em28xx/em28xx-cards.c:4093 usb_probe_interface+0x274/0x6a0 drivers/usb/core/driver.c:396 call_driver_probe drivers/base/dd.c:517 [inline] really_probe+0x1c2/0xb60 drivers/base/dd.c:596 __driver_probe_device+0x2a6/0x460 drivers/base/dd.c:751 driver_probe_device+0x44/0x110 drivers/base/dd.c:781 __device_attach_driver+0x185/0x250 drivers/base/dd.c:898 bus_for_each_drv+0x11e/0x1a0 drivers/base/bus.c:427 __device_attach+0x1db/0x410 drivers/base/dd.c:969 bus_probe_device+0x19d/0x250 drivers/base/bus.c:487 device_add+0xa57/0x1b90 drivers/base/core.c:3394 usb_set_configuration+0xc1d/0x1710 drivers/usb/core/message.c:2170 usb_generic_driver_probe+0x74/0xa0 drivers/usb/core/generic.c:238 usb_probe_device+0x95/0x240 drivers/usb/core/driver.c:293 call_driver_probe drivers/base/dd.c:517 [inline] really_probe+0x1c2/0xb60 drivers/base/dd.c:596 __driver_probe_device+0x2a6/0x460 drivers/base/dd.c:751 driver_probe_device+0x44/0x110 drivers/base/dd.c:781 __device_attach_driver+0x185/0x250 drivers/base/dd.c:898 bus_for_each_drv+0x11e/0x1a0 drivers/base/bus.c:427 __device_attach+0x1db/0x410 drivers/base/dd.c:969 bus_probe_device+0x19d/0x250 drivers/base/bus.c:487 device_add+0xa57/0x1b90 drivers/base/core.c:3394 usb_new_device.cold+0x5cf/0xee8 drivers/usb/core/hub.c:2563 hub_port_connect drivers/usb/core/hub.c:5348 [inline] hub_port_connect_change drivers/usb/core/hub.c:5488 [inline] port_event drivers/usb/core/hub.c:5634 [inline] hub_event+0x10a3/0x36c0 drivers/usb/core/hub.c:5716 process_one_work+0x87f/0x1450 kernel/workqueue.c:2298 process_scheduled_works kernel/workqueue.c:2361 [inline] worker_thread+0x74b/0x1040 kernel/workqueue.c:2447 kthread+0x3ab/0x480 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 The buggy address belongs to the object at ffff888067318000 which belongs to the cache kmalloc-16k of size 16384 The buggy address is located 528 bytes inside of 16384-byte region [ffff888067318000, ffff88806731c000) The buggy address belongs to the page: page:ffffea00019cc600 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x67318 head:ffffea00019cc600 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffffea00015e9808 ffffea00015ee408 ffff88800fc40b00 raw: 0000000000000000 ffff888067318000 0000000100000001 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 0x2420c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_COMP|__GFP_THISNODE), pid 9001, ts 69211476516, free_ts 66543180104 prep_new_page mm/page_alloc.c:2426 [inline] get_page_from_freelist+0xa6f/0x2f50 mm/page_alloc.c:4155 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5381 __alloc_pages_node include/linux/gfp.h:566 [inline] kmem_getpages mm/slab.c:1377 [inline] cache_grow_begin+0x75/0x460 mm/slab.c:2593 cache_alloc_refill+0x27f/0x380 mm/slab.c:2965 ____cache_alloc mm/slab.c:3048 [inline] ____cache_alloc mm/slab.c:3031 [inline] __do_cache_alloc mm/slab.c:3275 [inline] slab_alloc mm/slab.c:3316 [inline] kmem_cache_alloc_trace+0x388/0x480 mm/slab.c:3573 kmalloc include/linux/slab.h:591 [inline] kzalloc include/linux/slab.h:721 [inline] em28xx_usb_probe+0x198/0xfc0 drivers/media/usb/em28xx/em28xx-cards.c:3860 usb_probe_interface+0x274/0x6a0 drivers/usb/core/driver.c:396 call_driver_probe drivers/base/dd.c:517 [inline] really_probe+0x1c2/0xb60 drivers/base/dd.c:596 __driver_probe_device+0x2a6/0x460 drivers/base/dd.c:751 driver_probe_device+0x44/0x110 drivers/base/dd.c:781 __device_attach_driver+0x185/0x250 drivers/base/dd.c:898 bus_for_each_drv+0x11e/0x1a0 drivers/base/bus.c:427 __device_attach+0x1db/0x410 drivers/base/dd.c:969 bus_probe_device+0x19d/0x250 drivers/base/bus.c:487 device_add+0xa57/0x1b90 drivers/base/core.c:3394 usb_set_configuration+0xc1d/0x1710 drivers/usb/core/message.c:2170 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1340 [inline] __free_pages_ok+0x54b/0xca0 mm/page_alloc.c:1643 slab_destroy mm/slab.c:1627 [inline] drain_freelist.isra.0+0xc6/0x120 mm/slab.c:2219 cache_reap+0x1ba/0x290 mm/slab.c:4037 process_one_work+0x87f/0x1450 kernel/workqueue.c:2298 worker_thread+0x598/0x1040 kernel/workqueue.c:2445 kthread+0x3ab/0x480 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Memory state around the buggy address: ffff888067318100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888067318180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888067318200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888067318280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888067318300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================