[v5.15] KASAN: use-after-free Read in em28xx_release_resources

6 views
Skip to first unread message

syzbot

unread,
Oct 2, 2024, 12:18:23 AM10/2/24
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 3a5928702e71 Linux 5.15.167
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=176a7dd0580000
kernel config: https://syzkaller.appspot.com/x/.config?x=4d3fd5cca89ae935
dashboard link: https://syzkaller.appspot.com/bug?extid=7ce6b85e06fcfbee066b
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/ef5025f3d708/disk-3a592870.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/776fbdad3aa8/vmlinux-3a592870.xz
kernel image: https://storage.googleapis.com/syzbot-assets/79541db5bd16/bzImage-3a592870.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+7ce6b8...@syzkaller.appspotmail.com

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
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

syzbot

unread,
Jan 9, 2025, 11:18:13 PM1/9/25
to syzkaller...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.

syzbot

unread,
Jan 18, 2025, 10:56:31 PM1/18/25
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 60ceadf9247e Linux 6.1.125
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=13d5fa18580000
kernel config: https://syzkaller.appspot.com/x/.config?x=88577595fd4e0c57
dashboard link: https://syzkaller.appspot.com/bug?extid=95458ff3f4c07f8e7915
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/6fb6a3b019f4/disk-60ceadf9.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/103b4ca81c3b/vmlinux-60ceadf9.xz
kernel image: https://storage.googleapis.com/syzbot-assets/c14a532047fc/bzImage-60ceadf9.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+95458f...@syzkaller.appspotmail.com

em28xx 5-1:0.132: Closing input extension
==================================================================
BUG: KASAN: use-after-free in media_device_unregister+0x132/0x3f0
Read of size 8 at addr ffff8880589fc210 by task kworker/0:0/7

CPU: 0 PID: 7 Comm: kworker/0:0 Not tainted 6.1.125-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024
Workqueue: usb_hub_wq hub_event
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
print_address_description mm/kasan/report.c:316 [inline]
print_report+0x15f/0x4f0 mm/kasan/report.c:427
kasan_report+0x136/0x160 mm/kasan/report.c:531
media_device_unregister+0x132/0x3f0
em28xx_unregister_media_device drivers/media/usb/em28xx/em28xx-cards.c:3459 [inline]
em28xx_release_resources+0xa6/0x230 drivers/media/usb/em28xx/em28xx-cards.c:3480
em28xx_usb_disconnect+0x1c4/0x520 drivers/media/usb/em28xx/em28xx-cards.c:4149
usb_unbind_interface+0x1cd/0x840 drivers/usb/core/driver.c:458
device_remove drivers/base/dd.c:550 [inline]
__device_release_driver drivers/base/dd.c:1260 [inline]
device_release_driver_internal+0x59e/0x880 drivers/base/dd.c:1286
bus_remove_device+0x2e5/0x400 drivers/base/bus.c:531
device_del+0x6e2/0xbd0 drivers/base/core.c:3884
usb_disable_device+0x3b8/0x840 drivers/usb/core/message.c:1414
usb_disconnect+0x33c/0x8c0 drivers/usb/core/hub.c:2275
hub_port_connect drivers/usb/core/hub.c:5323 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5619 [inline]
port_event drivers/usb/core/hub.c:5775 [inline]
hub_event+0x1f78/0x5730 drivers/usb/core/hub.c:5857
process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292
process_scheduled_works kernel/workqueue.c:2355 [inline]
worker_thread+0xd04/0x1200 kernel/workqueue.c:2441
kthread+0x28d/0x320 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
</TASK>

Allocated by task 4249:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
____kasan_kmalloc mm/kasan/common.c:374 [inline]
__kasan_kmalloc+0x97/0xb0 mm/kasan/common.c:383
kmalloc include/linux/slab.h:563 [inline]
kzalloc include/linux/slab.h:699 [inline]
em28xx_v4l2_init+0x103/0x2db0 drivers/media/usb/em28xx/em28xx-video.c:2532
em28xx_init_extension+0x11b/0x1c0 drivers/media/usb/em28xx/em28xx-core.c:1116
process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292
process_scheduled_works kernel/workqueue.c:2355 [inline]
worker_thread+0xcb2/0x1200 kernel/workqueue.c:2444
kthread+0x28d/0x320 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Freed by task 4249:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
kasan_save_free_info+0x27/0x40 mm/kasan/generic.c:516
____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236
kasan_slab_free include/linux/kasan.h:177 [inline]
slab_free_hook mm/slub.c:1724 [inline]
slab_free_freelist_hook mm/slub.c:1750 [inline]
slab_free mm/slub.c:3661 [inline]
__kmem_cache_free+0x25c/0x3c0 mm/slub.c:3674
em28xx_free_v4l2 drivers/media/usb/em28xx/em28xx-video.c:2118 [inline]
kref_put include/linux/kref.h:65 [inline]
em28xx_v4l2_init+0x1604/0x2db0 drivers/media/usb/em28xx/em28xx-video.c:2901
em28xx_init_extension+0x11b/0x1c0 drivers/media/usb/em28xx/em28xx-core.c:1116
process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292
process_scheduled_works kernel/workqueue.c:2355 [inline]
worker_thread+0xcb2/0x1200 kernel/workqueue.c:2444
kthread+0x28d/0x320 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

The buggy address belongs to the object at ffff8880589fc000
which belongs to the cache kmalloc-8k of size 8192
The buggy address is located 528 bytes inside of
8192-byte region [ffff8880589fc000, ffff8880589fe000)

The buggy address belongs to the physical page:
page:ffffea0001627e00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x589f8
head:ffffea0001627e00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 dead000000000122 ffff888017c42280
raw: 0000000000000000 0000000080020002 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 0x1d2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 19303, tgid 19300 (syz.0.4570), ts 1274614985504, free_ts 1274545020997
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2532
prep_new_page mm/page_alloc.c:2539 [inline]
get_page_from_freelist+0x3731/0x38d0 mm/page_alloc.c:4328
__alloc_pages+0x28d/0x770 mm/page_alloc.c:5605
alloc_slab_page+0x6a/0x150 mm/slub.c:1794
allocate_slab mm/slub.c:1939 [inline]
new_slab+0x84/0x2d0 mm/slub.c:1992
___slab_alloc+0xc20/0x1270 mm/slub.c:3180
__slab_alloc mm/slub.c:3279 [inline]
slab_alloc_node mm/slub.c:3364 [inline]
__kmem_cache_alloc_node+0x19f/0x260 mm/slub.c:3437
__do_kmalloc_node mm/slab_common.c:935 [inline]
__kmalloc+0xa1/0x230 mm/slab_common.c:949
kmalloc include/linux/slab.h:568 [inline]
kzalloc include/linux/slab.h:699 [inline]
tomoyo_encode2 security/tomoyo/realpath.c:45 [inline]
tomoyo_encode+0x26b/0x530 security/tomoyo/realpath.c:80
tomoyo_realpath_from_path+0x594/0x5d0 security/tomoyo/realpath.c:283
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_path_number_perm+0x21f/0x7f0 security/tomoyo/file.c:723
tomoyo_path_mknod+0x172/0x1b0 security/tomoyo/tomoyo.c:239
security_path_mknod+0xf1/0x150 security/security.c:1166
may_o_create fs/namei.c:3304 [inline]
lookup_open fs/namei.c:3445 [inline]
open_last_lookups fs/namei.c:3550 [inline]
path_openat+0xc29/0x2e60 fs/namei.c:3780
do_filp_open+0x230/0x480 fs/namei.c:3810
do_sys_openat2+0x13b/0x4f0 fs/open.c:1318
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1459 [inline]
free_pcp_prepare mm/page_alloc.c:1509 [inline]
free_unref_page_prepare+0x12a6/0x15b0 mm/page_alloc.c:3384
free_unref_page+0x33/0x3e0 mm/page_alloc.c:3479
free_slab mm/slub.c:2031 [inline]
discard_slab mm/slub.c:2037 [inline]
__unfreeze_partials+0x1b7/0x210 mm/slub.c:2586
put_cpu_partial+0x17b/0x250 mm/slub.c:2662
qlink_free mm/kasan/quarantine.c:168 [inline]
qlist_free_all+0x76/0xe0 mm/kasan/quarantine.c:187
kasan_quarantine_reduce+0x156/0x170 mm/kasan/quarantine.c:294
__kasan_slab_alloc+0x1f/0x70 mm/kasan/common.c:305
kasan_slab_alloc include/linux/kasan.h:201 [inline]
slab_post_alloc_hook+0x52/0x3a0 mm/slab.h:737
slab_alloc_node mm/slub.c:3398 [inline]
slab_alloc mm/slub.c:3406 [inline]
__kmem_cache_alloc_lru mm/slub.c:3413 [inline]
kmem_cache_alloc+0x10c/0x2d0 mm/slub.c:3422
kmem_cache_zalloc include/linux/slab.h:689 [inline]
jbd2_alloc_handle include/linux/jbd2.h:1602 [inline]
new_handle fs/jbd2/transaction.c:476 [inline]
jbd2__journal_start+0x144/0x5c0 fs/jbd2/transaction.c:503
__ext4_journal_start_sb+0x19b/0x410 fs/ext4/ext4_jbd2.c:105
__ext4_journal_start fs/ext4/ext4_jbd2.h:326 [inline]
ext4_dirty_inode+0x8b/0x100 fs/ext4/inode.c:6086
__mark_inode_dirty+0x331/0xf80 fs/fs-writeback.c:2433
generic_update_time fs/inode.c:1946 [inline]
inode_update_time fs/inode.c:1959 [inline]
__file_update_time+0x221/0x240 fs/inode.c:2147
file_update_time+0x34c/0x3c0 fs/inode.c:2178
ext4_page_mkwrite+0x1c4/0x10d0 fs/ext4/inode.c:6207

Memory state around the buggy address:
ffff8880589fc100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880589fc180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880589fc200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880589fc280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880589fc300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb

syzbot

unread,
Apr 28, 2025, 11:56:18 PM4/28/25
to syzkaller...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages