syzbot


KASAN: slab-use-after-free Read in load_firmware_cb (2)

Status: upstream: reported C repro on 2025/03/30 07:21
Subsystems: media usb
[Documentation on labels]
Reported-by: syzbot+db4326df1b9af04f68fc@syzkaller.appspotmail.com
First crash: 8d15h, last: 5d15h
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [media?] [usb?] KASAN: slab-use-after-free Read in load_firmware_cb (2) 0 (1) 2025/03/30 07:21
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-use-after-free Read in load_firmware_cb media 4 190d 245d 0/28 auto-obsoleted due to no activity on 2024/12/23 23:36
upstream KASAN: use-after-free Read in load_firmware_cb usb media C 12 946d 1862d 0/28 auto-obsoleted due to no activity on 2023/11/09 13:12
linux-6.1 KASAN: use-after-free Read in load_firmware_cb 2 244d 245d 0/3 auto-obsoleted due to no activity on 2024/11/10 09:01

Sample crash report:
==================================================================
BUG: KASAN: slab-use-after-free in load_firmware_cb+0xbc/0x1638 drivers/media/tuners/xc2028.c:1372
Read of size 8 at addr ffff0000dccc7318 by task kworker/0:58/6836

CPU: 0 UID: 0 PID: 6836 Comm: kworker/0:58 Not tainted 6.14.0-rc7-syzkaller-ga2392f333575 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Workqueue: events request_firmware_work_func
Call trace:
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:466 (C)
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0xe4/0x150 lib/dump_stack.c:120
 print_address_description mm/kasan/report.c:408 [inline]
 print_report+0x198/0x550 mm/kasan/report.c:521
 kasan_report+0xd8/0x138 mm/kasan/report.c:634
 __asan_report_load8_noabort+0x20/0x2c mm/kasan/report_generic.c:381
 load_firmware_cb+0xbc/0x1638 drivers/media/tuners/xc2028.c:1372
 request_firmware_work_func+0x150/0x214 drivers/base/firmware_loader/main.c:1196
 process_one_work+0x810/0x1638 kernel/workqueue.c:3238
 process_scheduled_works kernel/workqueue.c:3319 [inline]
 worker_thread+0x97c/0xeec kernel/workqueue.c:3400
 kthread+0x65c/0x7b0 kernel/kthread.c:464
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:862

Allocated by task 6850:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x40/0x78 mm/kasan/common.c:68
 kasan_save_alloc_info+0x40/0x50 mm/kasan/generic.c:562
 poison_kmalloc_redzone mm/kasan/common.c:377 [inline]
 __kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:394
 kasan_kmalloc include/linux/kasan.h:260 [inline]
 __kmalloc_cache_noprof+0x2cc/0x428 mm/slub.c:4325
 kmalloc_noprof include/linux/slab.h:901 [inline]
 kzalloc_noprof include/linux/slab.h:1037 [inline]
 tuner_probe+0x108/0x1798 drivers/media/v4l2-core/tuner-core.c:636
 i2c_device_probe+0x700/0x9bc drivers/i2c/i2c-core-base.c:590
 call_driver_probe drivers/base/dd.c:-1 [inline]
 really_probe+0x38c/0x8fc drivers/base/dd.c:658
 __driver_probe_device+0x194/0x374 drivers/base/dd.c:800
 driver_probe_device+0x78/0x330 drivers/base/dd.c:830
 __device_attach_driver+0x2a8/0x4f4 drivers/base/dd.c:958
 bus_for_each_drv+0x228/0x2bc drivers/base/bus.c:462
 __device_attach+0x2b4/0x434 drivers/base/dd.c:1030
 device_initial_probe+0x24/0x34 drivers/base/dd.c:1079
 bus_probe_device+0x178/0x240 drivers/base/bus.c:537
 device_add+0x728/0xa6c drivers/base/core.c:3666
 device_register+0x28/0x38 drivers/base/core.c:3748
 i2c_new_client_device+0x8d0/0xf3c drivers/i2c/i2c-core-base.c:1020
 v4l2_i2c_new_subdev_board+0xb0/0x224 drivers/media/v4l2-core/v4l2-i2c.c:80
 v4l2_i2c_new_subdev+0x144/0x1e4 drivers/media/v4l2-core/v4l2-i2c.c:135
 em28xx_v4l2_init+0x6c8/0x28d4 drivers/media/usb/em28xx/em28xx-video.c:2617
 em28xx_init_extension+0x10c/0x1b4 drivers/media/usb/em28xx/em28xx-core.c:1117
 request_module_async+0x68/0x98 drivers/media/usb/em28xx/em28xx-cards.c:3457
 process_one_work+0x810/0x1638 kernel/workqueue.c:3238
 process_scheduled_works kernel/workqueue.c:3319 [inline]
 worker_thread+0x97c/0xeec kernel/workqueue.c:3400
 kthread+0x65c/0x7b0 kernel/kthread.c:464
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:862

Freed by task 6850:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x40/0x78 mm/kasan/common.c:68
 kasan_save_free_info+0x54/0x6c mm/kasan/generic.c:576
 poison_slab_object mm/kasan/common.c:247 [inline]
 __kasan_slab_free+0x64/0x8c mm/kasan/common.c:264
 kasan_slab_free include/linux/kasan.h:233 [inline]
 slab_free_hook mm/slub.c:2353 [inline]
 slab_free mm/slub.c:4609 [inline]
 kfree+0x180/0x478 mm/slub.c:4757
 tuner_remove+0x1d8/0x1f4 drivers/media/v4l2-core/tuner-core.c:789
 i2c_device_remove+0x8c/0x1dc drivers/i2c/i2c-core-base.c:631
 device_remove drivers/base/dd.c:567 [inline]
 __device_release_driver drivers/base/dd.c:1273 [inline]
 device_release_driver_internal+0x3e4/0x698 drivers/base/dd.c:1296
 device_release_driver+0x28/0x38 drivers/base/dd.c:1319
 bus_remove_device+0x314/0x3b4 drivers/base/bus.c:579
 device_del+0x480/0x828 drivers/base/core.c:3855
 device_unregister+0x2c/0xcc drivers/base/core.c:3896
 i2c_unregister_device+0x130/0x190 drivers/i2c/i2c-core-base.c:1069
 v4l2_i2c_subdev_unregister+0xa8/0xbc drivers/media/v4l2-core/v4l2-i2c.c:28
 v4l2_device_unregister+0x17c/0x248 drivers/media/v4l2-core/v4l2-device.c:102
 em28xx_v4l2_init+0x1300/0x28d4 drivers/media/usb/em28xx/em28xx-video.c:2898
 em28xx_init_extension+0x10c/0x1b4 drivers/media/usb/em28xx/em28xx-core.c:1117
 request_module_async+0x68/0x98 drivers/media/usb/em28xx/em28xx-cards.c:3457
 process_one_work+0x810/0x1638 kernel/workqueue.c:3238
 process_scheduled_works kernel/workqueue.c:3319 [inline]
 worker_thread+0x97c/0xeec kernel/workqueue.c:3400
 kthread+0x65c/0x7b0 kernel/kthread.c:464
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:862

The buggy address belongs to the object at ffff0000dccc7000
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 792 bytes inside of
 freed 2048-byte region [ffff0000dccc7000, ffff0000dccc7800)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11ccc0
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
anon flags: 0x5ffc00000000040(head|node=0|zone=2|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 05ffc00000000040 ffff0000c0002000 0000000000000000 dead000000000001
raw: 0000000000000000 0000000000080008 00000000f5000000 0000000000000000
head: 05ffc00000000040 ffff0000c0002000 0000000000000000 dead000000000001
head: 0000000000000000 0000000000080008 00000000f5000000 0000000000000000
head: 05ffc00000000003 fffffdffc3733001 ffffffffffffffff 0000000000000000
head: 0000000000000008 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff0000dccc7200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000dccc7280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff0000dccc7300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                            ^
 ffff0000dccc7380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000dccc7400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/03/29 07:32 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci a2392f333575 cf25e2c2 .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: slab-use-after-free Read in load_firmware_cb
2025/03/26 07:13 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci a2392f333575 89d30d73 .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: slab-use-after-free Read in load_firmware_cb
* Struck through repros no longer work on HEAD.