syzbot


KASAN: use-after-free Read in em28xx_release_resources

Status: upstream: reported on 2024/10/02 04:18
Reported-by: syzbot+7ce6b85e06fcfbee066b@syzkaller.appspotmail.com
First crash: 62d, last: 62d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in em28xx_release_resources media 1 1659d 1659d 0/28 auto-closed as invalid on 2020/09/15 20:41
upstream KASAN: slab-use-after-free Read in em28xx_release_resources media 85 22h43m 123d 0/28 upstream: reported on 2024/08/02 07:49

Sample crash report:
em28xx 2-1:0.0: Closing input extension
==================================================================
BUG: KASAN: use-after-free in media_device_unregister+0x132/0x3f0
Read of size 8 at addr ffff888024674210 by task kworker/1:6/3676

CPU: 1 PID: 3676 Comm: kworker/1:6 Not tainted 5.15.167-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Workqueue: usb_hub_wq hub_event
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106
 print_address_description+0x63/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
 media_device_unregister+0x132/0x3f0
 em28xx_unregister_media_device drivers/media/usb/em28xx/em28xx-cards.c:3464 [inline]
 em28xx_release_resources+0xa6/0x230 drivers/media/usb/em28xx/em28xx-cards.c:3485
 em28xx_usb_disconnect+0x1c4/0x520 drivers/media/usb/em28xx/em28xx-cards.c:4154
 usb_unbind_interface+0x1cd/0x840 drivers/usb/core/driver.c:458
 __device_release_driver drivers/base/dd.c:1229 [inline]
 device_release_driver_internal+0x50e/0x7f0 drivers/base/dd.c:1262
 bus_remove_device+0x2e5/0x400 drivers/base/bus.c:529
 device_del+0x6e2/0xbd0 drivers/base/core.c:3603
 usb_disable_device+0x3b8/0x840 drivers/usb/core/message.c:1414
 usb_disconnect+0x33c/0x8c0 drivers/usb/core/hub.c:2248
 hub_port_connect drivers/usb/core/hub.c:5299 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5595 [inline]
 port_event drivers/usb/core/hub.c:5741 [inline]
 hub_event+0x1d58/0x54c0 drivers/usb/core/hub.c:5823
 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
 process_scheduled_works kernel/workqueue.c:2373 [inline]
 worker_thread+0xdcf/0x1280 kernel/workqueue.c:2459
 kthread+0x3f6/0x4f0 kernel/kthread.c:334
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
 </TASK>

The buggy address belongs to the page:
page:ffffea0000919d00 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x24674
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 ffffea0001d6e008 ffff8880b91409b0 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 3564, ts 66757927960, free_ts 67298392923
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
 __alloc_pages+0x272/0x700 mm/page_alloc.c:5423
 kmalloc_order+0x41/0x150 mm/slab_common.c:966
 kmalloc_order_trace+0x15/0xe0 mm/slab_common.c:982
 kmalloc_large include/linux/slab.h:520 [inline]
 kmalloc include/linux/slab.h:584 [inline]
 kzalloc include/linux/slab.h:721 [inline]
 em28xx_v4l2_init+0xe2/0x2d50 drivers/media/usb/em28xx/em28xx-video.c:2542
 em28xx_init_extension+0x11b/0x1c0 drivers/media/usb/em28xx/em28xx-core.c:1126
 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
 worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
 kthread+0x3f6/0x4f0 kernel/kthread.c:334
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
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_pcp_prepare mm/page_alloc.c:1391 [inline]
 free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
 free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396
 free_nonslab_page+0xe4/0x150 mm/slub.c:3535
 kfree+0x1cf/0x270 mm/slub.c:4556
 em28xx_free_v4l2 drivers/media/usb/em28xx/em28xx-video.c:2128 [inline]
 kref_put include/linux/kref.h:65 [inline]
 em28xx_v4l2_init+0x15d7/0x2d50 drivers/media/usb/em28xx/em28xx-video.c:2911
 em28xx_init_extension+0x11b/0x1c0 drivers/media/usb/em28xx/em28xx-core.c:1126
 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
 worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
 kthread+0x3f6/0x4f0 kernel/kthread.c:334
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

Memory state around the buggy address:
 ffff888024674100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff888024674180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff888024674200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                         ^
 ffff888024674280: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff888024674300: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/10/02 04:17 linux-5.15.y 3a5928702e71 ea2b66a6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in em28xx_release_resources
* Struck through repros no longer work on HEAD.