| 0/0 |
2026/05/19 14:08 |
flow |
repro |
54m
Results: map[OtherCrashReports:<nil> ReproOpts:{"threaded":true,"collide":true,"repeat":true,"procs":6} ReproSyz:r0 = syz_usb_connect(0x3, 0x2b, &(0x7f0000000040)=ANY=[@ANYBLOB="12010002ffffff401aeb00280001000000010902190001010080fa0904000001ffffff0007058202000200"], &(0x7f0000000080)={0x0, 0x0, 0x0, 0x0})
poll(0x0, 0x0, 0x3e8)
syz_usb_disconnect(r0) (async)
openat(0xffffffffffffff9c, &(0x7f00000000c0)='./dev/video0\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &(0x7f0000000100)='./dev/video1\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &(0x7f0000000140)='./dev/video2\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &(0x7f0000000180)='./dev/video3\x00', 0x2, 0x0) (async)
Reproduced:false ReproducedCrashReport:==================================================================
BUG: KASAN: slab-use-after-free in v4l2_fh_init drivers/media/v4l2-core/v4l2-fh.c:25 [inline]
BUG: KASAN: slab-use-after-free in v4l2_fh_open+0xac/0x420 drivers/media/v4l2-core/v4l2-fh.c:64
Read of size 8 at addr ffff88812ede0740 by task v4l_id/7317
CPU: 0 UID: 0 PID: 7317 Comm: v4l_id Not tainted syzkaller #1 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:378 [inline]
print_report+0xba/0x230 mm/kasan/report.c:482
kasan_report+0x117/0x150 mm/kasan/report.c:595
v4l2_fh_init drivers/media/v4l2-core/v4l2-fh.c:25 [inline]
v4l2_fh_open+0xac/0x420 drivers/media/v4l2-core/v4l2-fh.c:64
em28xx_v4l2_open+0x157/0x9a0 drivers/media/usb/em28xx/em28xx-video.c:2153
v4l2_open+0x1bf/0x3a0 drivers/media/v4l2-core/v4l2-dev.c:433
chrdev_open+0x4cd/0x5e0 fs/char_dev.c:411
do_dentry_open+0x805/0x1380 fs/open.c:949
vfs_open+0x3b/0x340 fs/open.c:1081
do_open fs/namei.c:4671 [inline]
path_openat+0x2e08/0x3860 fs/namei.c:4830
do_file_open+0x23e/0x4a0 fs/namei.c:4859
do_sys_openat2+0x113/0x200 fs/open.c:1366
do_sys_open fs/open.c:1372 [inline]
__do_sys_openat fs/open.c:1388 [inline]
__se_sys_openat fs/open.c:1383 [inline]
__x64_sys_openat+0x138/0x170 fs/open.c:1383
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x14d/0x500 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f7bb5487407
Code: 48 89 fa 4c 89 df e8 38 aa 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
RSP: 002b:00007ffc71d4f770 EFLAGS: 00000202 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f7bb5399880 RCX: 00007f7bb5487407
RDX: 0000000000000000 RSI: 00007ffc71d50f27 RDI: ffffffffffffff9c
RBP: 0000000000000002 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000000
R13: 00007ffc71d4f9c0 R14: 00007f7bb5c1d000 R15: 0000563d0ded04d8
</TASK>
Allocated by task 7278:
kasan_save_stack mm/kasan/common.c:57 [inline]
kasan_save_track+0x3e/0x80 mm/kasan/common.c:78
poison_kmalloc_redzone mm/kasan/common.c:398 [inline]
__kasan_kmalloc+0x72/0x90 mm/kasan/common.c:415
kasan_kmalloc include/linux/kasan.h:263 [inline]
__kmalloc_cache_noprof+0x317/0x630 mm/slub.c:5380
kmalloc_noprof include/linux/slab.h:950 [inline]
kzalloc_noprof include/linux/slab.h:1188 [inline]
em28xx_v4l2_init+0x10b/0x2e70 drivers/media/usb/em28xx/em28xx-video.c:2532
em28xx_init_extension+0x120/0x1c0 drivers/media/usb/em28xx/em28xx-core.c:1117
process_one_work kernel/workqueue.c:3276 [inline]
process_scheduled_works+0xb6e/0x18c0 kernel/workqueue.c:3359
worker_thread+0x8a2/0xda0 kernel/workqueue.c:3440
kthread+0x388/0x470 kernel/kthread.c:436
ret_from_fork+0x49b/0xb00 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
Freed by task 7278:
kasan_save_stack mm/kasan/common.c:57 [inline]
kasan_save_track+0x3e/0x80 mm/kasan/common.c:78
kasan_save_free_info+0x46/0x50 mm/kasan/generic.c:584
poison_slab_object mm/kasan/common.c:253 [inline]
__kasan_slab_free+0x3a/0x60 mm/kasan/common.c:285
kasan_slab_free include/linux/kasan.h:235 [inline]
slab_free_hook mm/slub.c:2685 [inline]
slab_free mm/slub.c:6165 [inline]
kfree+0x1c3/0x630 mm/slub.c:6483
em28xx_free_v4l2 drivers/media/usb/em28xx/em28xx-video.c:2118 [inline]
kref_put include/linux/kref.h:65 [inline]
em28xx_v4l2_init+0x1683/0x2e70 drivers/media/usb/em28xx/em28xx-video.c:2901
em28xx_init_extension+0x120/0x1c0 drivers/media/usb/em28xx/em28xx-core.c:1117
process_one_work kernel/workqueue.c:3276 [inline]
process_scheduled_works+0xb6e/0x18c0 kernel/workqueue.c:3359
worker_thread+0x8a2/0xda0 kernel/workqueue.c:3440
kthread+0x388/0x470 kernel/kthread.c:436
ret_from_fork+0x49b/0xb00 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
The buggy address belongs to the object at ffff88812ede0000
which belongs to the cache kmalloc-8k of size 8192
The buggy address is located 1856 bytes inside of
freed 8192-byte region [ffff88812ede0000, ffff88812ede2000)
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x12ede0
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0x200000000000040(head|node=0|zone=2)
page_type: f5(slab)
raw: 0200000000000040 ffff888100042280 dead000000000100 dead000000000122
raw: 0000000000000000 0000000800020002 00000000f5000000 0000000000000000
head: 0200000000000040 ffff888100042280 dead000000000100 dead000000000122
head: 0000000000000000 0000000800020002 00000000f5000000 0000000000000000
head: 0200000000000003 ffffea0004bb7801 00000000ffffffff 00000000ffffffff
head: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000008
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 3023, tgid 3023 (syz-executor), ts 32623573289, free_ts 31659308077
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x231/0x280 mm/page_alloc.c:1889
prep_new_page mm/page_alloc.c:1897 [inline]
get_page_from_freelist+0x230c/0x2430 mm/page_alloc.c:3962
__alloc_frozen_pages_noprof+0x18d/0x380 mm/page_alloc.c:5250
alloc_slab_page mm/slub.c:3292 [inline]
allocate_slab+0x77/0x660 mm/slub.c:3481
new_slab mm/slub.c:3539 [inline]
refill_objects+0x331/0x3c0 mm/slub.c:7175
refill_sheaf mm/slub.c:2812 [inline]
__pcs_replace_empty_main+0x2e6/0x6f0 mm/slub.c:4615
alloc_from_pcs mm/slub.c:4717 [inline]
slab_alloc_node mm/slub.c:4851 [inline]
__kmalloc_cache_noprof+0x38d/0x630 mm/slub.c:5375
kmalloc_noprof include/linux/slab.h:950 [inline]
kzalloc_noprof include/linux/slab.h:1188 [inline]
ipv4_sysctl_init_net+0x2af/0x3e0 net/ipv4/sysctl_net_ipv4.c:1680
ops_init+0x35c/0x5c0 net/core/net_namespace.c:137
setup_net+0x118/0x340 net/core/net_namespace.c:446
copy_net_ns+0x3e9/0x5c0 net/core/net_namespace.c:581
create_new_namespaces+0x404/0x790 kernel/nsproxy.c:130
unshare_nsproxy_namespaces+0x11a/0x160 kernel/nsproxy.c:226
ksys_unshare+0x51d/0x930 kernel/fork.c:3173
__do_sys_unshare kernel/fork.c:3244 [inline]
__se_sys_unshare kernel/fork.c:3242 [inline]
__x64_sys_unshare+0x38/0x50 kernel/fork.c:3242
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x14d/0x500 arch/x86/entry/syscall_64.c:94
page last free pid 3009 tgid 3009 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
__free_pages_prepare mm/page_alloc.c:1433 [inline]
__free_frozen_pages+0x9d9/0xb30 mm/page_alloc.c:2978
__folio_put+0x22a/0x2c0 mm/swap.c:112
put_netmem include/net/netmem.h:420 [inline]
skb_page_unref include/linux/skbuff_ref.h:43 [inline]
__skb_frag_unref include/linux/skbuff_ref.h:56 [inline]
skb_release_data+0x51b/0x810 net/core/skbuff.c:1122
skb_release_all net/core/skbuff.c:1203 [inline]
__kfree_skb net/core/skbuff.c:1217 [inline]
napi_consume_skb+0x1aa/0x2a0 net/core/skbuff.c:1546
skb_defer_free_flush+0x191/0x260 net/core/dev.c:6820
net_rx_action+0x4a6/0xe30 net/core/dev.c:7893
handle_softirqs+0x21b/0x850 kernel/softirq.c:622
do_softirq+0x76/0xd0 kernel/softirq.c:523
__local_bh_enable_ip+0xf8/0x130 kernel/softirq.c:450
local_bh_enable include/linux/bottom_half.h:33 [inline]
rcu_read_unlock_bh include/linux/rcupdate.h:924 [inline]
__dev_queue_xmit+0x1a05/0x31e0 net/core/dev.c:4873
dev_queue_xmit include/linux/netdevice.h:3384 [inline]
neigh_hh_output include/net/neighbour.h:540 [inline]
neigh_output include/net/neighbour.h:554 [inline]
ip_finish_output2+0xc13/0x1000 net/ipv4/ip_output.c:237
NF_HOOK_COND include/linux/netfilter.h:307 [inline]
ip_output+0x29f/0x450 net/ipv4/ip_output.c:438
__ip_queue_xmit+0x1112/0x1c10 net/ipv4/ip_output.c:534
__tcp_transmit_skb+0x2b17/0x43d0 net/ipv4/tcp_output.c:1693
tcp_transmit_skb net/ipv4/tcp_output.c:1711 [inline]
tcp_write_xmit+0x15bd/0x66c0 net/ipv4/tcp_output.c:3064
tcp_sendmsg_locked+0x2c04/0x5440 net/ipv4/tcp.c:1408
Memory state around the buggy address:
ffff88812ede0600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88812ede0680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88812ede0700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88812ede0780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88812ede0800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
SyzkallerCommit:1d9407ad5a662c921fc0d659cf022b438c0bde91]
|
| 1/1 |
2026/05/19 14:08 |
action |
kernel-checkouter |
0m
Results: map[KernelSrc:/app/workdir/cache/src/b3d9b1554ea1f0801df75efb500c870bb105ae26]
|
| 2/1 |
2026/05/19 14:08 |
action |
kernel-builder |
0m
Results: map[KernelObj:/app/workdir/cache/build/2e1668d81c7b7a83b4d8252fd6aa37cb0a69a537]
|
| 3/1 |
2026/05/19 14:08 |
action |
codesearch-prepare |
0m
Results: map[Index:codesearch-index]
|
| 4/1 |
2026/05/19 14:08 |
agent |
crash-repro-finder |
51m
Model:
Results: map[CandidateReproSyz:r0 = syz_usb_connect(3, 0x2b, &AUTO=ANY=[@ANYBLOB='\x12\x01\x00\x02\xff\xff\xff\x40\x1a\xeb\x00\x28\x00\x01\x00\x00\x00\x01\x09\x02\x19\x00\x01\x01\x00\x80\xfa\x09\x04\x00\x00\x01\xff\xff\xff\x00\x07\x05\x82\x02\x00\x02\x00'], &AUTO={0, 0, 0, 0, 0, []})
poll(0x0, 0x0, 0x3e8)
syz_usb_disconnect(r0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video0\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video1\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video2\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video3\x00', 0x2, 0x0) (async)
ReproOpts:{"threaded":true,"collide":true,"repeat":true,"procs":6}]
Instruction:
You are an expert in the Linux kernel fuzzing. Your goal is to write a syzkaller program to trigger a specific bug.
Don't make assumptions about the kernel source code, use the provided codesearch tools
to examine the kernel code instead.
Document about syzkaller program syntax:
===
# Program syntax
Syzkaller uses a compact domain-specific language (DSL) for programs
to log executed programs, test its code, and persist programs in the
corpus. This page provides a brief description of the corresponding
syntax. Some useful information can also be found in the
[existing examples](/sys/linux/test) and in the program
[deserialization code](/prog/encoding.go).
Together with execution options, the DSL provides everything that
syz-executor needs to run a program.
For example, consider the program:
```
r0 = syz_open_dev$loop(&(0x7f00000011c0), 0x0, 0x0)
r1 = openat$6lowpan_control(0xffffffffffffff9c, &(0x7f00000000c0), 0x2, 0x0)
ioctl$LOOP_SET_FD(r0, 0x4c00, r1)
```
Each line in this program describes a particular syscall invocation,
with the first two calls saving the result in temporary variables `r0`
and `r1`, which are passed to the third call.
```
line = assignment | call
assignment = variable " = " call
call = syscall-name "(" [arg ["," arg]*] ")" ["(" [call-prop ["," call-prop*] ")"]
arg = "nil" | "AUTO" | const-arg | resource-arg | result-arg | pointer-arg | string-arg | struct-arg | array-arg | union-arg
const-arg = integer
resource-arg = variable ["/" hex-integer] ["+" hex-integer]
result-arg = "<" variable "=>" arg
pointer-arg = "&" pointer-arg-addr ["=ANY"] "=" arg
pointer-arg-addr = "AUTO" | "(" pointer-addr ["/" region-size] ")"
string-arg = "'" escaped-string "'" | "\"" escaped-string "\"" | "\"$" escaped-string "\""
struct-arg = "{" [arg ["," arg]*] "}"
array-arg = "[" [arg ["," arg]*] "]"
union-arg = "@" field-name ["=" arg]
call-prop = prop-name ": " prop-value
variable = "r" dec-integer
pointer-addr = integer
region-size = integer
integer = dec-integer | oct-integer | "0x" hex-integer
```
Programs may also contain blank lines and comments.
```
# Obtain a file handle
r0 = openat(0xffffffffffffff9c, &AUTO='./file1\x00', 0x42, 0x1ff)
# Perform a write operation
write(r0, &AUTO="01010101", 0x4)
```
### Memory management
Memory management is performed by syzkaller itself. It will allocate
virtual memory regions of the necessary size and set the final values
of pointer arguments.
By using the `AUTO` keyword, programs can give syzkaller the full
control over storing the data. This may be convenient e.g. when a
parameter must be passed by reference, but the exact location of its
value is not of particular importance.
```
r1 = syz_genetlink_get_family_id$nl80211(&AUTO='nl80211\x00', 0xffffffffffffffff)
ioctl$sock_SIOCGIFINDEX_80211(r0, 0x8933, &AUTO={'wlan0\x00', <r2=>0x0})
```
Alternatively, some data can be "anchored" to specific addresses. It
may be especially important when a memory region must be shared
between multiple calls. In this case, pointer addresses must be given
at the 0x7f0000000000 offset. Before the actual execution, syzkaller
will adjust pointers to the start of the actual mmap'ed region.
### Call properties
Call properties specify extra information about how a specific call
must be executed. Each call within a program has its own set of call
properties. If no properties are provided, syzkaller takes the default
ones.
Currently, syzkaller supports the following call properties.
#### Fault injection
Syntax: `fail_nth: N`.
It takes an integer (base 10) argument `N`. If the argument is
non-negative, a fault will be injected into the `N`-th occasion.
```
r0 = openat$6lowpan_control(0xffffffffffffff9c, &(0x7f00000000c0), 0x2, 0x0)
ioctl$LOOP_SET_FD(r0, 0x4c00, r0) (fail_nth: 5)
```
#### Async
Syntax: `async`.
Instructs `syz-executor` not to wait until the call completes and
to proceed immediately to the next call.
```
r0 = openat(0xffffffffffffff9c, &AUTO='./file1\x00', 0x42, 0x1ff)
write(r0, &AUTO="01010101", 0x4) (async)
read(r0, &AUTO=""/4, 0x4)
close(r0)
```
When setting `async` flags be aware of the following considerations:
* Such programs should only be executed in threaded mode (i.e. `-threaded`
flag must be passed to `syz-executor`.
* Each `async` call is executed in a separate thread and there's a
limited number of available threads (`kMaxThreads = 16`).
* If an `async` call produces a resource, keep in mind that some other call
might take it as input and `syz-executor` will just pass 0 if the resource-
producing call has not finished by that time.
===
Document about syzlang system call descriptions syntax:
===
# Syscall description language
aka `syzlang` (`[siːzˈlæŋg]`)
Pseudo-formal grammar of syscall description:
```
syscallname "(" [arg ["," arg]*] ")" [type] ["(" attribute* ")"]
arg = argname type
argname = identifier
type = typename [ "[" type-options "]" ]
typename = "const" | "intN" | "intptr" | "flags" | "array" | "ptr" |
"string" | "filename" | "glob" | "len" |
"bytesize" | "bytesizeN" | "bitsize" | "vma" | "proc" |
"compressed_image"
type-options = [type-opt ["," type-opt]]
```
common type-options include:
```
"opt" - the argument is optional (like mmap fd argument, or accept peer argument)
```
rest of the type-options are type-specific:
```
"const": integer constant, type-options:
value, underlying type (one of "intN", "intptr")
"intN"/"intptr": an integer without a particular meaning, type-options:
either an optional range of values (e.g. "5:10", or "100:200")
or a reference to flags description (see below),
or a single value
optionally followed by an alignment parameter if using a range
"flags": a set of values, type-options:
reference to flags description (see below), underlying int type (e.g. "int32")
"array": a variable/fixed-length array, type-options:
type of elements, optional size (fixed "5", or ranged "5:10", boundaries inclusive)
"ptr"/"ptr64": a pointer to an object, type-options:
direction (in/out/inout); type of the object
ptr64 has size of 8 bytes regardless of target pointer size
"string": a zero-terminated memory buffer (no pointer indirection implied), type-options:
either a string value in quotes for constant strings (e.g. "foo" or `deadbeef` for hex literal),
or a reference to string flags (special value `filename` produces file names),
optionally followed by a buffer size (string values will be padded with \x00 to that size)
"stringnoz": a non-zero-terminated memory buffer (no pointer indirection implied), type-options:
either a string value in quotes for constant strings (e.g. "foo" or `deadbeef` for hex literal),
or a reference to string flags,
"glob": glob pattern to match on the target files, type-options:
a pattern string in quotes (syntax: https://golang.org/pkg/path/filepath/#Match)
(e.g. "/sys/" or "/sys/**/*"),
or include exclude glob too (e.g. "/sys/**/*:-/sys/power/state")
"fmt": a string representation of an integer (not zero-terminated), type-options:
format (one of "dec", "hex", "oct") and the value (a resource, int, flags or proc)
the resulting data is always fixed-size (formatted as "%020llu", "0x%016llx" or "%023llo", respectively)
"len": length of another field (for array it is number of elements), type-options:
argname of the object
"bytesize": similar to "len", but always denotes the size in bytes, type-options:
argname of the object
"bitsize": similar to "len", but always denotes the size in bits, type-options:
argname of the object
"offsetof": offset of the field from the beginning of the parent struct, type-options:
field
"vma"/"vma64": a pointer to a set of pages (used as input for mmap/munmap/mremap/madvise), type-options:
optional number of pages (e.g. vma[7]), or a range of pages (e.g. vma[2-4])
vma64 has size of 8 bytes regardless of target pointer size
"proc": per process int (see description below), type-options:
value range start, how many values per process, underlying type
"compressed_image": zlib-compressed disk image
syscalls accepting compressed images must be marked with `no_generate`
and `no_minimize` call attributes. if the content of the decompressed image
can be checked by a `fsck`-like command, use the `fsck` syscall attribute
"text": machine code of the specified type, type-options:
text type (x86_real, x86_16, x86_32, x86_64, arm64)
"void": type with static size 0
mostly useful inside of templates and varlen unions, can't be syscall argument
```
flags/len/flags also have trailing underlying type type-option when used in structs/unions/pointers.
Flags are described as:
```
flagname = const ["," const]*
```
or for string flags as:
```
flagname = "\"" literal "\"" ["," "\"" literal "\""]*
```
Call attributes are:
```
"disabled": the call will not be used in fuzzing; useful to temporary disable some calls
or prohibit particular argument combinations.
"timeout[N]": additional execution timeout (in ms) for the call on top of some default value.
"prog_timeout[N]": additional execution timeout (in ms) for the whole program if it contains this call;
if a program contains several such calls, the max value is used.
"ignore_return": ignore return value of this syscall in fallback feedback; need to be used for calls
that don't return fixed error codes but rather something else (e.g. the current time).
"breaks_returns": ignore return values of all subsequent calls in the program in fallback feedback (can't be trusted).
"no_generate": do not try to generate this syscall, i.e. use only seed descriptions to produce it.
"no_minimize": do not modify instances of this syscall when trying to minimize a crashing program.
"no_squash": do not attempt to pass squashed arguments to this syscall.
Without that, the fuzzer will sometimes attempt to replace complex structures with arrays of bytes,
possibly triggering interesting mutations, but also making programs hard to reason about.
"fsck": the content of the compressed buffer argument for this syscall is a file system and the
string argument is a fsck-like command that will be called to verify the filesystem.
"remote_cover": wait longer to collect remote coverage for this call.
"kfuzz_test": the call is a kfuzztest target.
"snapshot": the call is enabled by default only in snapshot fuzzing mode, but can also be enabled in
the non-snasphot mode when listed in "enable_syscalls" with its full name (as opposed to a wildcard match).
It can also always be disabled via "disable_syscalls".
The attribute is generally used to mark calls that are not safe to execute in non-snapshot mode
(can lead to false positives, or lost connections to test machines.
```
## Ints
`int8`, `int16`, `int32` and `int64` denote an integer of the corresponding size.
`intptr` denotes a pointer-sized integer, i.e. C `long` type.
By appending `be` suffix (e.g. `int16be`) integers become big-endian.
It's possible to specify a range of values for an integer in the format of `int32[0:100]` or `int32[0:4096, 512]` for a 512-aligned int.
Integers can also take a reference to flags description or a value as its first type-option.
In that case, the alignment parameter is not supported.
To denote a bitfield of size N use `int64:N`.
It's possible to use these various kinds of ints as base types for `const`, `flags`, `len` and `proc`.
```
example_struct {
f0 int8 # random 1-byte integer
f1 const[0x42, int16be] # const 2-byte integer with value 0x4200 (big-endian 0x42)
f2 int32[0:100] # random 4-byte integer with values from 0 to 100 inclusive
f3 int32[1:10, 2] # random 4-byte integer with values {1, 3, 5, 7, 9}
f4 int64:20 # random 20-bit bitfield
f5 int8[10] # const 1-byte integer with value 10
f6 int32[flagname] # random 4-byte integer from the set of values referenced by flagname
}
```
## Structs
Structs are described as:
```
structname "{" "\n"
(fieldname type ("(" fieldattribute* ")")? (if[expression])? "\n")+
"}" ("[" attribute* "]")?
```
Fields can have attributes specified in parentheses after the field, independent
of their type. `in/out/inout` attribute specify per-field direction, for example:
```
foo {
field0 const[1, int32] (in)
field1 int32 (inout)
field2 fd (out)
}
```
You may specify conditions that determine whether a field will be included:
```
foo {
field0 int32
field1 int32 (if[value[field0] == 0x1])
}
```
See [the corresponding section](syscall_descriptions_syntax.md#conditional-fields)
for more details.
`out_overlay` attribute allows to have separate input and output layouts for the struct.
Fields before the `out_overlay` field are input, fields starting from `out_overlay` are output.
Input and output fields overlap in memory (both start from the beginning of the struct in memory).
For example:
```
foo {
in0 const[1, int32]
in1 flags[bar, int8]
in2 ptr[in, string]
out0 fd (out_overlay)
out1 int32
}
```
Structs can have attributes specified in square brackets after the struct.
Attributes are:
- `packed`: the struct does not have paddings between fields and has alignment 1; this is similar to GNU C `__attribute__((packed))`; struct alignment can be overridden with `align` attribute
- `align[N]`: the struct has alignment N and padded up to multiple of `N`; contents of the padding are unspecified (though, frequently are zeros); similar to GNU C `__attribute__((aligned(N)))`
- `size[N]`: the struct is padded up to the specified size `N`; contents of the padding are unspecified (though, frequently are zeros)
## Unions
Unions are described as:
```
unionname "[" "\n"
(fieldname type (if[expression])? "\n")+
"]" ("[" attribute* "]")?
```
During fuzzing, syzkaller randomly picks one of the union options.
You may also specify conditions that determine whether the corresponding
option may or may not be selected, depending on values of other fields. See
[the corresponding section](syscall_descriptions_syntax.md#conditional-fields)
for more details.
Unions can have attributes specified in square brackets after the union.
Attributes are:
- `varlen`: union size is the size of the particular chosen option (not statically known); without this attribute unions are statically sized as maximum of all options (similar to C unions)
- `size[N]`: the union is padded up to the specified size `N`; contents of the padding are unspecified (though, frequently are zeros)
## Resources
Resources represent values that need to be passed from output of one syscall to input of another syscall. For example, `close` syscall requires an input value (fd) previously returned by `open` or `pipe` syscall. To achieve this, `fd` is declared as a resource. This is a way of modelling dependencies between syscalls, as defining a syscall as the producer of a resource and another syscall as the consumer defines a loose sense of ordering between them. Resources are described as:
```
"resource" identifier "[" underlying_type "]" [ ":" const ("," const)* ]
```
`underlying_type` is either one of `int8`, `int16`, `int32`, `int64`, `intptr` or another resource (which models inheritance, for example, a socket is a subtype of fd). The optional set of constants represent resource special values, for example, `0xffffffffffffffff` (-1) for "no fd", or `AT_FDCWD` for "the current dir". Special values are used once in a while as resource values. If no special values specified, special value of `0` is used. Resources can then be used as types, for example:
```
resource fd[int32]: 0xffffffffffffffff, AT_FDCWD, 1000000
resource sock[fd]
resource sock_unix[sock]
socket(...) sock
accept(fd sock, ...) sock
listen(fd sock, backlog int32)
```
Resources don't have to be necessarily returned by a syscall. They can be used as any other data type. For example:
```
resource my_resource[int32]
request_producer(..., arg ptr[out, my_resource])
request_consumer(..., arg ptr[inout, test_struct])
test_struct {
...
attr my_resource
}
```
For more complex producer/consumer scenarios, field attributes can be utilized.
For example:
```
resource my_resource_1[int32]
resource my_resource_2[int32]
request_produce1_consume2(..., arg ptr[inout, test_struct])
test_struct {
...
field0 my_resource_1 (out)
field1 my_resource_2 (in)
}
```
Each resource type must be "produced" (used as an output) by at least one syscall
(outside of unions and optional pointers) and "consumed" (used as an input)
by at least one syscall.
## Type Aliases
Complex types that are often repeated can be given short type aliases using the
following syntax:
```
type identifier underlying_type
```
For example:
```
type signalno int32[0:65]
type net_port proc[20000, 4, int16be]
```
Then, type alias can be used instead of the underlying type in any contexts.
Underlying type needs to be described as if it's a struct field, that is,
with the base type if it's required. However, type alias can be used as syscall
arguments as well. Underlying types are currently restricted to integer types,
`ptr`, `ptr64`, `const`, `flags` and `proc` types.
There are some builtin type aliases:
```
type bool8 int8[0:1]
type bool16 int16[0:1]
type bool32 int32[0:1]
type bool64 int64[0:1]
type boolptr intptr[0:1]
type fileoff[BASE] BASE
type filename string[filename]
type buffer[DIR] ptr[DIR, array[int8]]
```
## Type Templates
Type templates can be declared as follows:
```
type buffer[DIR] ptr[DIR, array[int8]]
type fileoff[BASE] BASE
type nlattr[TYPE, PAYLOAD] {
nla_len len[parent, int16]
nla_type const[TYPE, int16]
payload PAYLOAD
} [align_4]
```
and later used as follows:
```
syscall(a buffer[in], b fileoff[int64], c ptr[in, nlattr[FOO, int32]])
```
There is builtin type template `optional` defined as:
```
type optional[T] [
val T
void void
] [varlen]
```
## Length
You can specify length of a particular field in struct or a named argument by
using `len`, `bytesize` and `bitsize` types, for example:
```
write(fd fd, buf ptr[in, array[int8]], count len[buf])
sock_fprog {
len len[filter, int16]
filter ptr[in, array[sock_filter]]
}
```
If `len`'s argument is a pointer, then the length of the pointee argument is used.
To denote the length of a field in N-byte words use `bytesizeN`, possible values
for N are 1, 2, 4 and 8.
To denote the length of the parent struct, you can use `len[parent, int8]`.
To denote the length of the higher level parent when structs are embedded into
one another, you can specify the type name of the particular parent:
```
s1 {
f0 len[s2] # length of s2
}
s2 {
f0 s1
f1 array[int32]
f2 len[parent, int32]
}
```
`len` argument can also be a path expression which allows more complex
addressing. Path expressions are similar to C field references, but also allow
referencing parent and sibling elements. A special reference `syscall` used
in the beginning of the path allows to refer directly to the syscall arguments.
For example:
```
s1 {
a ptr[in, s2]
b ptr[in, s3]
c array[int8]
}
s2 {
d array[int8]
}
s3 {
# This refers to the array c in the parent s1.
e len[s1:c, int32]
# This refers to the array d in the sibling s2.
f len[s1:a:d, int32]
# This refers to the array k in the child s4.
g len[i:j, int32]
# This refers to syscall argument l.
h len[syscall:l, int32]
i ptr[in, s4]
}
s4 {
j array[int8]
}
foo(k ptr[in, s1], l ptr[in, array[int8]])
```
## Proc
The `proc` type can be used to denote per process integers.
The idea is to have a separate range of values for each executor, so they don't interfere.
The simplest example is a port number.
The `proc[20000, 4, int16be]` type means that we want to generate an `int16be`
integer starting from `20000` and assign `4` values for each process.
As a result the executor number `n` will get values in the `[20000 + n * 4, 20000 + (n + 1) * 4)` range.
## Integer Constants
Integer constants can be specified as decimal literals, as `0x`-prefixed
hex literals, as `'`-surrounded char literals, or as symbolic constants
extracted from kernel headers or defined by `define` directives. For example:
```
foo(a const[10], b const[-10])
foo(a const[0xabcd])
foo(a int8['a':'z'])
foo(a const[PATH_MAX])
foo(a int32[PATH_MAX])
foo(a ptr[in, array[int8, MY_PATH_MAX]])
define MY_PATH_MAX PATH_MAX + 2
```
## Conditional fields
### In structures
In syzlang, it's possible to specify a condition for every struct field that
determines whether the field should be included or omitted:
```
header_fields {
magic const[0xabcd, int16]
haveInteger int8
} [packed]
packet {
header header_fields
integer int64 (if[value[header:haveInteger] == 0x1])
body array[int8]
} [packed]
some_call(a ptr[in, packet])
```
In this example, the `packet` structure will include the field `integer` only
if `header.haveInteger == 1`. In memory, `packet` will have the following
layout:
| header.magic = 0xabcd | header.haveInteger = 0x1 | integer | body |
| --------------------- | ------------------------ | ------- | ---- |
That corresponds to e.g. the following program:
```
some_call(&AUTO={{AUTO, 0x1}, @value=0xabcd, []})
```
If `header.haveInteger` is not `1`, syzkaller will just pretend that the field
`integer` does not exist.
```
some_call(&AUTO={{AUTO, 0x0}, @void, []})
```
| header.magic = 0xabcd | header.haveInteger = 0x0 | body |
| --------------------- | ------------------------ | ---- |
Every conditional field is assumed to be of variable length and so is the struct
to which this field belongs.
When a variable length field appears in the middle of a structure, the structure
must be marked with `[packed].`
Conditions on bitfields are prohibited:
```
struct {
f0 int
f1 int:3 (if[value[f0] == 0x1]) # It will not compile.
}
```
But you may reference bitfields in your conditions:
```
struct {
f0 int:1
f1 int:7
f2 int (if[value[f0] == value[f1]])
} [packed]
```
### In unions
Let's consider the following example.
```
struct {
type int
body alternatives
}
alternatives [
int int64 (if[value[struct:type] == 0x1])
arr array[int64, 5] (if[value[struct:type] == 0x2])
default int32
] [varlen]
some_call(a ptr[in, struct])
```
In this case, the union option will be selected depending on the value of the
`type` field. For example, if `type` is `0x1`, then it can be either `int` or
`default`:
```
some_call(&AUTO={0x1, @int=0x123})
some_call(&AUTO={0x1, @default=0x123})
```
If `type` is `0x2`, it can be either `arr` or `default`.
If `type` is neither `0x1` nor `0x2`, syzkaller may only select `default`:
```
some_call(&AUTO={0x0, @default=0xabcd})
```
To ensure that a union can always be constructed, the last union field **must always
have no condition**.
Thus, the following definition would fail to compile:
```
alternatives [
int int64 (if[value[struct:type] == 0x1])
arr array[int64, 5] (if[value[struct:type] == 0x1])
] [varlen]
```
During prog mutation and generation syzkaller will select a random union field
whose condition is satisfied.
### Expression syntax
Currently, only `==`, `!=`, `&` and `||` operators are supported. However, the
functionality was designed in such a way that adding more operators is easy.
Feel free to file a GitHub issue or write us an email in case it's needed.
Expressions are evaluated as `int64` values. If the final result of an
expression is not 0, it's assumed to be satisfied.
If you want to reference a field's value, you can do it via
`value[path:to:field]`, which is similar to the `len[]` argument.
```
sub_struct {
f0 int
# Reference a field in a parent struct.
f1 int (if[value[struct:f2]]) # Same as if[value[struct:f2] != 0].
}
struct {
f2 int
f3 sub_struct
f4 int (if[value[f2] == 0x2]) # Reference a sibling field.
f5 int (if[value[f3:f0] == 0x1]) # Reference a nested field.
f6 int (if[value[f3:f0] == 0x1 || value[f3:f0] == 0x2]) # Reference a nested field which either equals to 0x1 or 0x2.
} [packed]
call(a ptr[in, struct])
```
The referenced field must be of integer type and there must be no
conditional fields in the path to it. For example, the following
descriptions will not compile.
```
struct {
f0 int
f1 int (if[value[f0] == 0x1])
f2 int (if[value[f1] == 0x1])
}
```
You may also reference constants in expressions:
```
struct {
f0 int
f1 int
f2 int (if[value[f0] & SOME_CONST == OTHER_CONST])
}
```
## Meta
Description files can also contain `meta` directives that specify meta-information for the whole file.
```
meta noextract
```
Tells `make extract` to not extract constants for this file.
Though, `syz-extract` can still be invoked manually on this file.
```
meta arches["arch1", "arch2"]
```
Restricts this file only to the given set of architectures.
`make extract` and `make generate` will not use it on other architectures.
## Misc
Description files also contain `include` directives that refer to Linux kernel header files,
`incdir` directives that refer to custom Linux kernel header directories
and `define` directives that define symbolic constant values.
The syzkaller executor defines some [pseudo system calls](./pseudo_syscalls.md)
that can be used as any other syscall in a description file. These pseudo
system calls expand to literal C code and can perform user-defined
custom actions. You can find some examples in
[executor/common_linux.h](../executor/common_linux.h).
Also see [tips](syscall_descriptions.md#tips) on writing good descriptions.
===
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt:
Bug title: general protection fault in em28xx_resolution_set
The bug report to reproduce:
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000354: 0000 [#1] SMP KASAN PTI
KASAN: probably user-memory-access in range [0x0000000000001aa0-0x0000000000001aa7]
CPU: 0 UID: 0 PID: 5637 Comm: v4l_id Not tainted syzkaller #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2026
RIP: 0010:norm_maxh drivers/media/usb/em28xx/em28xx-video.c:149 [inline]
RIP: 0010:em28xx_resolution_set.isra.0+0xe4/0x730 drivers/media/usb/em28xx/em28xx-video.c:317
Code: 0f 85 d5 05 00 00 48 8d bd a0 1a 00 00 44 0f b6 bb 3c 01 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 41 83 e7 10 <80> 3c 02 00 0f 85 e9 05 00 00 31 ff 44 89 fe 4c 8b a5 a0 1a 00 00
RSP: 0018:ffffc90002027798 EFLAGS: 00010246
RAX: dffffc0000000000 RBX: ffff88811f368000 RCX: ffffffff85a50292
RDX: 0000000000000354 RSI: ffffffff85a4f799 RDI: 0000000000001aa0
RBP: 0000000000000000 R08: 0000000000000005 R09: 0000000000000002
R10: 0000000000000000 R11: 0000000000000000 R12: ffff88812bc88000
R13: 1ffff92000404ef7 R14: ffff88811f36813c R15: 0000000000000000
FS: 00007f8c837eb880(0000) GS:ffff8882686f6000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f8c839e455a CR3: 000000010735c000 CR4: 00000000003506f0
Call Trace:
<TASK>
em28xx_v4l2_open+0x457/0x570 drivers/media/usb/em28xx/em28xx-video.c:2166
v4l2_open+0x1d2/0x490 drivers/media/v4l2-core/v4l2-dev.c:433
chrdev_open+0x234/0x6a0 fs/char_dev.c:411
do_dentry_open+0x68b/0x14b0 fs/open.c:949
vfs_open+0x82/0x3f0 fs/open.c:1081
do_open fs/namei.c:4671 [inline]
path_openat+0x208c/0x31a0 fs/namei.c:4830
do_file_open+0x20e/0x430 fs/namei.c:4859
do_sys_openat2+0x10d/0x1e0 fs/open.c:1366
do_sys_open fs/open.c:1372 [inline]
__do_sys_openat fs/open.c:1388 [inline]
__se_sys_openat fs/open.c:1383 [inline]
__x64_sys_openat+0x12d/0x210 fs/open.c:1383
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x106/0x7b0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f8c838d9407
Code: 48 89 fa 4c 89 df e8 38 aa 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
RSP: 002b:00007ffe5cd9fa90 EFLAGS: 00000202
ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f8c837eb880 RCX: 00007f8c838d9407
RDX: 0000000000000000 RSI: 00007ffe5cda0f21 RDI: ffffffffffffff9c
RBP: 0000000000000002 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000000
R13: 00007ffe5cd9fce0 R14: 00007f8c8406f000 R15: 0000555f3c43e4d8
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:norm_maxh drivers/media/usb/em28xx/em28xx-video.c:149 [inline]
RIP: 0010:em28xx_resolution_set.isra.0+0xe4/0x730 drivers/media/usb/em28xx/em28xx-video.c:317
Code: 0f 85 d5 05 00 00 48 8d bd a0 1a 00 00 44 0f b6 bb 3c 01 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 41 83 e7 10 <80> 3c 02 00 0f 85 e9 05 00 00 31 ff 44 89 fe 4c 8b a5 a0 1a 00 00
RSP: 0018:ffffc90002027798 EFLAGS: 00010246
RAX: dffffc0000000000 RBX: ffff88811f368000 RCX: ffffffff85a50292
RDX: 0000000000000354 RSI: ffffffff85a4f799 RDI: 0000000000001aa0
RBP: 0000000000000000 R08: 0000000000000005 R09: 0000000000000002
----------------
Code disassembly (best guess):
0: 0f 85 d5 05 00 00 jne 0x5db
6: 48 8d bd a0 1a 00 00 lea 0x1aa0(%rbp),%rdi
d: 44 0f b6 bb 3c 01 00 movzbl 0x13c(%rbx),%r15d
14: 00
15: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax
1c: fc ff df
1f: 48 89 fa mov %rdi,%rdx
22: 48 c1 ea 03 shr $0x3,%rdx
26: 41 83 e7 10 and $0x10,%r15d
* 2a: 80 3c 02 00 cmpb $0x0,(%rdx,%rax,1) <-- trapping instruction
2e: 0f 85 e9 05 00 00 jne 0x61d
34: 31 ff xor %edi,%edi
36: 44 89 fe mov %r15d,%esi
39: 4c 8b a5 a0 1a 00 00 mov 0x1aa0(%rbp),%r12
The list of existing description files:
acpi_thermal_rel.txt
aio.txt
auto.txt
binfmt.txt
bpf.txt
bpf_prog.txt
bpf_trace.txt
cgroup.txt
damon.txt
dev_ashmem.txt
dev_bifrost.txt
dev_binder.txt
dev_binderfs.txt
dev_block.txt
dev_bsg.txt
dev_bus_usb.txt
dev_camx.txt
dev_cdrom.txt
dev_cec.txt
dev_char_usb.txt
dev_comedi.txt
dev_dma_heap.txt
dev_dri.txt
dev_dsp.txt
dev_dvb_demux.txt
dev_dvb_dvr.txt
dev_dvb_frontend.txt
dev_fb.txt
dev_floppy.txt
dev_hidraw.txt
dev_i2c.txt
dev_i915.txt
dev_img_rogue.txt
dev_infiniband_rdma.txt
dev_infiniband_rdma_cm.txt
dev_input.txt
dev_iommu.txt
dev_kvm.txt
dev_kvm_amd64.txt
dev_kvm_arm64.txt
dev_kvm_extra.txt
dev_kvm_riscv64.txt
dev_loop.txt
dev_mali.txt
dev_media.txt
dev_msm.txt
dev_msr.txt
dev_nbd.txt
dev_net_tun.txt
dev_panthor.txt
dev_ppp.txt
dev_ptmx.txt
dev_ptp.txt
dev_qat_adf_ctl.txt
dev_qrtr_tun.txt
dev_random.txt
dev_rfkill.txt
dev_rtc.txt
dev_sequencer.txt
dev_sg.txt
dev_snapshot.txt
dev_snd_control.txt
dev_snd_hw.txt
dev_snd_midi.txt
dev_snd_pcm.txt
dev_snd_seq.txt
dev_snd_timer.txt
dev_sr.txt
dev_sw_sync.txt
dev_tlk_device.txt
dev_trusty.txt
dev_udmabuf.txt
dev_uhid.txt
dev_uinput.txt
dev_usb_hiddev.txt
dev_usbmon.txt
dev_userio.txt
dev_vfio.txt
dev_vga_arbiter.txt
dev_vhci.txt
dev_video4linux.txt
dev_video4linux_vim2m.txt
dev_virtual_nci.txt
dev_vtpm.txt
fanotify.txt
filesystem.txt
fs_9p.txt
fs_fuse.txt
fs_incfs.txt
fs_ioctl.txt
fs_ioctl_autofs.txt
fs_ioctl_btrfs.txt
fs_ioctl_ext4.txt
fs_ioctl_f2fs.txt
fs_ioctl_fat.txt
fs_ioctl_fscrypt.txt
fs_ioctl_fsverity.txt
fs_ioctl_nilfs2.txt
fs_ioctl_ocfs2.txt
fs_ioctl_xfs.txt
futex.txt
hafnium.txt
inotify.txt
io_uring.txt
ipc.txt
key.txt
kfuzztest.txt
l2cap.txt
landlock.txt
lsm.txt
namespaces.txt
net_80211.txt
netfilter.txt
netfilter_arp.txt
netfilter_bridge.txt
netfilter_ipv4.txt
netfilter_ipv6.txt
netfilter_ipvs.txt
netfilter_targets.txt
pagemap_ioctl.txt
perf.txt
prctl.txt
quotactl.txt
seccomp.txt
security_apparmor.txt
security_selinux.txt
security_smack.txt
socket.txt
socket_alg.txt
socket_ax25.txt
socket_bluetooth.txt
socket_caif.txt
socket_can.txt
socket_ieee802154.txt
socket_inet.txt
socket_inet6.txt
socket_inet_dccp.txt
socket_inet_icmp.txt
socket_inet_igmp.txt
socket_inet_l2tp.txt
socket_inet_sctp.txt
socket_inet_tcp.txt
socket_inet_udp.txt
socket_ip_tunnel.txt
socket_isdn.txt
socket_kcm.txt
socket_key.txt
socket_llc.txt
socket_netlink.txt
socket_netlink_audit.txt
socket_netlink_crypto.txt
socket_netlink_generic.txt
socket_netlink_generic_80211.txt
socket_netlink_generic_batadv.txt
socket_netlink_generic_devlink.txt
socket_netlink_generic_ethtool.txt
socket_netlink_generic_fou.txt
socket_netlink_generic_gtp.txt
socket_netlink_generic_mptcp.txt
socket_netlink_generic_net_dm.txt
socket_netlink_generic_netlabel.txt
socket_netlink_generic_nfc.txt
socket_netlink_generic_seg6.txt
socket_netlink_generic_smc.txt
socket_netlink_generic_team.txt
socket_netlink_generic_wireguard.txt
socket_netlink_netfilter.txt
socket_netlink_netfilter_acct.txt
socket_netlink_netfilter_conntrack.txt
socket_netlink_netfilter_conntrack_exp.txt
socket_netlink_netfilter_conntrack_helper.txt
socket_netlink_netfilter_ipset.txt
socket_netlink_netfilter_log.txt
socket_netlink_netfilter_nft_compat.txt
socket_netlink_netfilter_nftables.txt
socket_netlink_netfilter_osf.txt
socket_netlink_netfilter_queue.txt
socket_netlink_netfilter_timeout.txt
socket_netlink_rdma.txt
socket_netlink_route.txt
socket_netlink_route_sched.txt
socket_netlink_route_sched_retired.txt
socket_netlink_sock_diag.txt
socket_netlink_xfrm.txt
socket_netrom.txt
socket_nfc.txt
socket_nvme_of_tcp.txt
socket_packet.txt
socket_phonet.txt
socket_pppox.txt
socket_qipcrtr.txt
socket_rds.txt
socket_rose.txt
socket_rxrpc.txt
socket_tipc.txt
socket_tipc_netlink.txt
socket_unix.txt
socket_vnet.txt
socket_x25.txt
socket_xdp.txt
sys.txt
ublk.txt
uffd.txt
usbip.txt
vmw_vmci.txt
vnet.txt
vnet_mptcp.txt
vusb.txt
watch_queue.txt
xattr.txt
|
| 5/2 |
2026/05/19 14:08 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 15538
output: 59
thoughts: 278
Thoughts: **Debugging a Potential USB Video Driver Issue**
Okay, so I've got a general protection fault, which is never fun. It seems to be happening within `em28xx_resolution_set` in the `em28xx-video.c` driver, specifically within the USB media subsystem. The annoying part is that this occurs when opening a v4l2 device – classic!
Let's see what the stack trace is telling us. It looks like the fault is originating from `em28xx_v4l2_open` and working its way up through the standard v4l2 device opening process: `v4l2_open`, then `chrdev_open`, finally hitting `do_dentry_open` and `vfs_open`. That's a pretty standard call chain for opening a character device.
Now I need to dive into the code. My immediate focus is on `drivers/media/usb/em28xx/em28xx-video.c`. I'll start by checking around line 2166 where `em28xx_v4l2_open` is called, and also near line 317, which might be a related context, possibly where the resolution setting or configuration is actually happening. Time to get my hands dirty and see what's actually going on. I'll need to figure out what data is being passed in, and where it is going.
|
| 6/2 |
2026/05/19 14:08 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/media/usb/em28xx/em28xx-video.c IncludeLines:true Name:em28xx_v4l2_open]
Results: map[SourceCode:2121: /*
2122: * em28xx_v4l2_open()
2123: * inits the device and starts isoc transfer
2124: */
2125: static int em28xx_v4l2_open(struct file *filp)
2126: {
2127: struct video_device *vdev = video_devdata(filp);
2128: struct em28xx *dev = video_drvdata(filp);
2129: struct em28xx_v4l2 *v4l2 = dev->v4l2;
2130: enum v4l2_buf_type fh_type = 0;
2131: int ret;
2132:
2133: switch (vdev->vfl_type) {
2134: case VFL_TYPE_VIDEO:
2135: fh_type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
2136: break;
2137: case VFL_TYPE_VBI:
2138: fh_type = V4L2_BUF_TYPE_VBI_CAPTURE;
2139: break;
2140: case VFL_TYPE_RADIO:
2141: break;
2142: default:
2143: return -EINVAL;
2144: }
2145:
2146: em28xx_videodbg("open dev=%s type=%s users=%d\n",
2147: video_device_node_name(vdev), v4l2_type_names[fh_type],
2148: v4l2->users);
2149:
2150: if (mutex_lock_interruptible(&dev->lock))
2151: return -ERESTARTSYS;
2152:
2153: ret = v4l2_fh_open(filp);
2154: if (ret) {
2155: dev_err(&dev->intf->dev,
2156: "%s: v4l2_fh_open() returned error %d\n",
2157: __func__, ret);
2158: mutex_unlock(&dev->lock);
2159: return ret;
2160: }
2161:
2162: if (v4l2->users == 0) {
2163: em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
2164:
2165: if (vdev->vfl_type != VFL_TYPE_RADIO)
2166: em28xx_resolution_set(dev);
2167:
2168: /*
2169: * Needed, since GPIO might have disabled power
2170: * of some i2c devices
2171: */
2172: em28xx_wake_i2c(dev);
2173: }
2174:
2175: if (vdev->vfl_type == VFL_TYPE_RADIO) {
2176: em28xx_videodbg("video_open: setting radio device\n");
2177: v4l2_device_call_all(&v4l2->v4l2_dev, 0, tuner, s_radio);
2178: }
2179:
2180: kref_get(&dev->ref);
2181: kref_get(&v4l2->ref);
2182: v4l2->users++;
2183:
2184: mutex_unlock(&dev->lock);
2185:
2186: return 0;
2187: }
SourceFile:drivers/media/usb/em28xx/em28xx-video.c]
|
| 7/2 |
2026/05/19 14:08 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 17243
output: 56
thoughts: 14
Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience:
**Analyzing `em28xx_resolution_set`**
Alright, let's dive in. My immediate thought is to zero in on the `em28xx_resolution_set` function. I'm going to run it through my mental checklist. What's the context? Is this the right place for it? Specifically, I'm thinking about the em28xx driver – that's a known quantity, a good starting point. What's this function doing? What parameters is it accepting? Are there any potential gotchas with its implementation, particularly regarding pixel formats, timing constraints, or DMA setup? The efficiency of resolution changes in this driver is something I'll be looking at. I'm wondering if it uses any locking, and if it's atomic in a multi-threaded scenario. I'm also thinking about whether it is correctly error-handling. Any potential memory allocation or deallocation issues need to be checked. Let's see if this aligns with the known hardware limitations and expectations of the em28xx series. I need to refresh my memory on any related errata or quirks I know of within that specific family. This is my chance to check for any obvious red flags before proceeding.
|
| 8/2 |
2026/05/19 14:08 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/media/usb/em28xx/em28xx-video.c IncludeLines:true Name:em28xx_resolution_set]
Results: map[SourceCode: 312: /* FIXME: this only function read values from dev */
313: static int em28xx_resolution_set(struct em28xx *dev)
314: {
315: struct em28xx_v4l2 *v4l2 = dev->v4l2;
316: int width = norm_maxw(dev);
317: int height = norm_maxh(dev);
318:
319: /* Properly setup VBI */
320: v4l2->vbi_width = 720;
321: if (v4l2->norm & V4L2_STD_525_60)
322: v4l2->vbi_height = 12;
323: else
324: v4l2->vbi_height = 18;
325:
326: em28xx_set_outfmt(dev);
327:
328: em28xx_accumulator_set(dev, 1, (width - 4) >> 2, 1, (height - 4) >> 2);
329:
330: /*
331: * If we don't set the start position to 2 in VBI mode, we end up
332: * with line 20/21 being YUYV encoded instead of being in 8-bit
333: * greyscale. The core of the issue is that line 21 (and line 23 for
334: * PAL WSS) are inside of active video region, and as a result they
335: * get the pixelformatting associated with that area. So by cropping
336: * it out, we end up with the same format as the rest of the VBI
337: * region
338: */
339: if (em28xx_vbi_supported(dev) == 1)
340: em28xx_capture_area_set(dev, 0, 2, width, height);
341: else
342: em28xx_capture_area_set(dev, 0, 0, width, height);
343:
344: return em28xx_scaler_set(dev, v4l2->hscale, v4l2->vscale);
345: }
SourceFile:drivers/media/usb/em28xx/em28xx-video.c]
|
| 9/2 |
2026/05/19 14:08 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 18275
output: 52
thoughts: 10
Thoughts: Okay, here's my interpretation of that thought process, assuming I'm deep in my domain of expertise:
**Checking `norm_maxh`**
Alright, time to focus. I'm hitting a point where I need to take a step back and examine a crucial variable. Specifically, I need to check the value of `norm_maxh`. It's a key parameter in this whole process, so I want to make sure it's behaving as expected. A quick inspection of `norm_maxh` will likely immediately illuminate any potential issues in the current state or workflow, and verify that the assumptions I've made regarding this parameter remain valid. It could be that some other code has modified it and I need to check how it will impact the next steps. I need to make sure this value is what I anticipate it to be. This check will provide confidence to proceed.
|
| 10/2 |
2026/05/19 14:08 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/media/usb/em28xx/em28xx-video.c IncludeLines:true Name:norm_maxh]
Results: map[SourceCode: 139: static inline unsigned int norm_maxh(struct em28xx *dev)
140: {
141: struct em28xx_v4l2 *v4l2 = dev->v4l2;
142:
143: if (dev->is_webcam)
144: return v4l2->sensor_yres;
145:
146: if (dev->board.max_range_640_480)
147: return 480;
148:
149: return (v4l2->norm & V4L2_STD_625_50) ? 576 : 480;
150: }
SourceFile:drivers/media/usb/em28xx/em28xx-video.c]
|
| 11/2 |
2026/05/19 14:08 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 18768
output: 56
thoughts: 275
Thoughts: **Debugging a Potential NULL Pointer Dereference**
Okay, so I'm looking at this crash, and it seems to be happening at `norm_maxh`, specifically line 149. It's a simple ternary operation, returning either 576 or 480 based on a bitwise AND with `V4L2_STD_625_50`. The thing that immediately jumps out is that the code is dereferencing `v4l2->norm`. I need to figure out how `v4l2` is getting set.
Right, `v4l2` is `dev->v4l2`. Okay, so `v4l2` is initialized in `em28xx_v4l2_open`. Let me check out how `v4l2` is used.
Here's the crucial point: I see that `v4l2` is checked in `em28xx_v4l2_open`, but it's dereferenced *before* any null check:
```c
struct em28xx_v4l2 *v4l2 = dev->v4l2;
...
em28xx_videodbg("open dev=%s type=%s users=%d\n",
video_device_node_name(vdev), v4l2_type_names[fh_type],
v4l2->users);
```
So, if `dev->v4l2` is NULL or corrupted, this is where the crash *must* be coming from. This means that a NULL `v4l2` is possible. However, `em28xx_videodbg` is a macro. If debugging isn't enabled, then the arguments to the macro might not be evaluated. So maybe the program is crashing in a subsequent line.
This is a classic NULL pointer dereference situation. The code assumes `dev->v4l2` is a valid pointer when it might not be. I need to trace back and figure out when `dev->v4l2` is initialized and ensure it's always assigned a valid pointer before being used. I'll have to investigate how `dev->v4l2` is being set and initialized.
|
| 12/2 |
2026/05/19 14:08 |
tool |
codesearch-definition-source |
0m
Error:
Args: map[ContextFile:drivers/media/usb/em28xx/em28xx-video.c IncludeLines:true Name:em28xx_videodbg]
Results: map[SourceCode: SourceFile:]
|
| 13/2 |
2026/05/19 14:08 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 19610
output: 23
thoughts: 14
Thoughts: Okay, here's my attempt at summarizing that thought process, tailored for an expert audience:
**Hunting Down `em28xx_videodbg`**
Right, let's get down to brass tacks. The objective here is clearly to locate this thing: `em28xx_videodbg`. That's the starting point. My initial thought process? It's all about efficient searching. I need to be precise, I can't waste time going down rabbit holes. I'm going to leverage my existing knowledge of the `em28xx` family; is this a module, a header, a debugging utility? Is it part of the kernel source, or potentially a user-space tool? The context is the key, and given this command, I'm expecting some kind of debug file or function.
My brain is immediately working on the most effective search strategies. I'm thinking, "Where would *I* put a debug tool for that driver?" Kernel source trees are often structured logically, so a quick `find` or `grep` within the relevant directories is my first port of call. Perhaps `drivers/media/usb/em28xx/`, maybe `drivers/media/` generally, or even a broader search if my initial assumptions don't pan out. I need to keep my search parameters as narrow as possible, but with enough breadth to avoid missing something tucked away in an unexpected place. I might consider using `-iname` for case-insensitive matching or thinking about possible variations on the name.
If it's a kernel module, I'll investigate the load order dependencies; maybe `modinfo` will give me some clues. And if it's user space, I'll check my typical system paths. If this driver is not standard, I'll need to do some more digging. Is this part of a specific distribution or build? Where are the custom builds on this system? If I come up short, I'll consider looking at upstream sources, git logs, bug trackers, and mailing list archives. It's a chase, but with a systematic approach and relevant knowledge, it should be simple to find. The key is going to be the context in which I'm seeing this reference.
|
| 14/2 |
2026/05/19 14:08 |
tool |
grepper |
0m
Args: map[Expression:define em28xx_videodbg]
Results: map[Output:drivers/media/usb/em28xx/em28xx-video.c=50=MODULE_PARM_DESC(alt, "alternate setting to use for video endpoint");
drivers/media/usb/em28xx/em28xx-video.c-51-
drivers/media/usb/em28xx/em28xx-video.c:52:#define em28xx_videodbg(fmt, arg...) do { \
drivers/media/usb/em28xx/em28xx-video.c-53- if (video_debug) \
]
|
| 15/2 |
2026/05/19 14:09 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 20269
output: 50
thoughts: 244
Thoughts: **Analyzing a Potential Kernel Crash**
Okay, so I'm looking at this `em28xx_videodbg` macro and immediately, I see the conditional debugging statement. Good. My concern is that if `video_debug` is zero, we're not even bothering with evaluating `v4l2->users`. That's important. I know where that happens, it's checked at line 2162 with an `if (v4l2->users == 0)`.
Aha! If `v4l2` turns out to be a bad pointer, then that's where we'd crash. It should try to dereference it. And if this did happen, I want to confirm what the crash address is: `0xdffffc0000000354`. Wait, that address is a KASAN shadow address! That's a huge clue.
I need to confirm what `v4l2` is. Looks like it's `dev->v4l2`. So I really need to check `struct em28xx` now. The issue is likely there.
|
| 16/2 |
2026/05/19 14:09 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/media/usb/em28xx/em28xx.h IncludeLines:true Name:em28xx]
Results: map[SourceCode: 635: /* main device struct */
636: struct em28xx {
637: struct kref ref;
638:
639: // Sub-module data
640: struct em28xx_v4l2 *v4l2;
641: struct em28xx_dvb *dvb;
642: struct em28xx_audio adev;
643: struct em28xx_IR *ir;
644:
645: // generic device properties
646: int model; // index in the device_data struct
647: int devno; // marks the number of this device
648: enum em28xx_chip_id chip_id;
649:
650: unsigned int is_em25xx:1; // em25xx/em276x/7x/8x family bridge
651: unsigned int disconnected:1; // device has been disconnected
652: unsigned int has_video:1;
653: unsigned int is_audio_only:1;
654: unsigned int is_webcam:1;
655: unsigned int has_msp34xx:1;
656: unsigned int i2c_speed:2;
657: enum em28xx_int_audio_type int_audio_type;
658: enum em28xx_usb_audio_type usb_audio_type;
659: unsigned char name[32];
660:
661: struct em28xx_board board;
662:
663: enum em28xx_sensor em28xx_sensor; // camera specific
664:
665: // Some older em28xx chips needs a waiting time after writing
666: unsigned int wait_after_write;
667:
668: struct list_head devlist;
669:
670: u32 i2s_speed; // I2S speed for audio digital stream
671:
672: struct em28xx_audio_mode audio_mode;
673:
674: int tuner_type; // type of the tuner
675:
676: // i2c i/o
677: struct i2c_adapter i2c_adap[NUM_I2C_BUSES];
678: struct i2c_client i2c_client[NUM_I2C_BUSES];
679: struct em28xx_i2c_bus i2c_bus[NUM_I2C_BUSES];
680:
681: unsigned char eeprom_addrwidth_16bit:1;
682: unsigned int def_i2c_bus; // Default I2C bus
683: unsigned int cur_i2c_bus; // Current I2C bus
684: struct rt_mutex i2c_bus_lock;
685:
686: // video for linux
687: unsigned int ctl_input; // selected input
688: unsigned int ctl_ainput;// selected audio input
689: unsigned int ctl_aoutput;// selected audio output
690: enum em28xx_amux amux_map[MAX_EM28XX_INPUT];
691:
692: int mute;
693: int volume;
694:
695: unsigned long hash; // eeprom hash - for boards with generic ID
696: unsigned long i2c_hash; // i2c devicelist hash -
697: // for boards with generic ID
698:
699: struct work_struct request_module_wk;
700:
701: // locks
702: struct mutex lock; /* protects em28xx struct */
703: struct mutex ctrl_urb_lock; /* protects urb_buf */
704:
705: // resources in use
706: unsigned int resources;
707:
708: // eeprom content
709: u8 *eedata;
710: u16 eedata_len;
711:
712: // Isoc control struct
713: struct em28xx_dmaqueue vidq;
714: struct em28xx_dmaqueue vbiq;
715: struct em28xx_usb_ctl usb_ctl;
716:
717: spinlock_t slock; /* Protects em28xx video/vbi/dvb IRQ stream data */
718:
719: // usb transfer
720: struct usb_interface *intf; // the usb interface
721: u8 ifnum; // number of the assigned usb interface
722: u8 analog_ep_isoc; // address of isoc endpoint for analog
723: u8 analog_ep_bulk; // address of bulk endpoint for analog
724: u8 dvb_ep_isoc_ts2; // address of isoc endpoint for DVB TS2
725: u8 dvb_ep_bulk_ts2; // address of bulk endpoint for DVB TS2
726: u8 dvb_ep_isoc; // address of isoc endpoint for DVB
727: u8 dvb_ep_bulk; // address of bulk endpoint for DVB
728: int alt; // alternate setting
729: int max_pkt_size; // max packet size of the selected ep at alt
730: int packet_multiplier; // multiplier for wMaxPacketSize, used for
731: // URB buffer size definition
732: int num_alt; // number of alternative settings
733: unsigned int *alt_max_pkt_size_isoc; // array of isoc wMaxPacketSize
734: unsigned int analog_xfer_bulk:1; // use bulk instead of isoc
735: // transfers for analog
736: int dvb_alt_isoc; // alternate setting for DVB isoc transfers
737: unsigned int dvb_max_pkt_size_isoc; // isoc max packet size of the
738: // selected DVB ep at dvb_alt
739: unsigned int dvb_max_pkt_size_isoc_ts2; // isoc max packet size of the
740: // selected DVB ep at dvb_alt
741: unsigned int dvb_xfer_bulk:1; // use bulk instead of isoc
742: // transfers for DVB
743: char urb_buf[URB_MAX_CTRL_SIZE]; // urb control msg buffer
744:
745: // helper funcs that call usb_control_msg
746: int (*em28xx_write_regs)(struct em28xx *dev, u16 reg,
747: char *buf, int len);
748: int (*em28xx_read_reg)(struct em28xx *dev, u16 reg);
749: int (*em28xx_read_reg_req_len)(struct em28xx *dev, u8 req, u16 reg,
750: char *buf, int len);
751: int (*em28xx_write_regs_req)(struct em28xx *dev, u8 req, u16 reg,
752: char *buf, int len);
753: int (*em28xx_read_reg_req)(struct em28xx *dev, u8 req, u16 reg);
754:
755: enum em28xx_mode mode;
756:
757: // Button state polling
758: struct delayed_work buttons_query_work;
759: u8 button_polling_addresses[EM28XX_NUM_BUTTON_ADDRESSES_MAX];
760: u8 button_polling_last_values[EM28XX_NUM_BUTTON_ADDRESSES_MAX];
761: u8 num_button_polling_addresses;
762: u16 button_polling_interval; // [ms]
763: // Snapshot button input device
764: char snapshot_button_path[30]; // path of the input dev
765: struct input_dev *sbutton_input_dev;
766:
767: #ifdef CONFIG_MEDIA_CONTROLLER
768: struct media_device *media_dev;
769: struct media_entity input_ent[MAX_EM28XX_INPUT];
770: struct media_pad input_pad[MAX_EM28XX_INPUT];
771: #endif
772:
773: struct em28xx *dev_next;
774: int ts;
775: };
SourceFile:drivers/media/usb/em28xx/em28xx.h]
|
| 17/2 |
2026/05/19 14:09 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 23307
output: 55
thoughts: 577
Thoughts: **Debugging a NULL Pointer Dereference in the em28xx Driver**
Okay, so I'm looking at this crash in the `em28xx` driver and trying to figure out what's going on. The backtrace points to `norm_maxh`, which is called within `em28xx_resolution_set`. I see that `v4l2` is a pointer to `struct em28xx_v4l2`, and the code *should* be checking for a NULL `dev->v4l2` before dereferencing it. If `dev->v4l2` *were* NULL, then accessing `v4l2->users` should have caused a crash in `em28xx_v4l2_open`, because that function dereferences the same pointer.
However, the crash happens in `norm_maxh`, specifically at `v4l2->sensor_yres` (or one of the following lines, depending on the `if` conditions). The issue *seems* to be that `v4l2` is getting dereferenced within `norm_maxh` which is called from `em28xx_resolution_set`.
But wait, hold on, `v4l2` is dereferenced in `em28xx_v4l2_open`, specifically when checking `v4l2->users`. So, if `v4l2` were NULL, shouldn't we have crashed *there*? The code looks like this:
```c
if (v4l2->users == 0) {
```
That would be a crash on NULL pointer dereference, right?
Alright, let's look at the crash address: `0xdffffc0000000354`. This looks like a KASAN shadow address... let me convert that... ah, the actual address is `0x0000000000001aa0`. Okay, `0x1aa0` in decimal is `6816`.
Now, if `dev->v4l2` is NULL, which is what I'm suspecting, then the dereference will lead to the crash. Let's look at the offset of `v4l2` within the `struct em28xx`. It *should* be a pointer. The struct definition shows that it's offset by 640... but it's *a pointer*.
Hang on… that makes sense now! `0x1aa0` is the actual address being accessed. That's the problem. I need to look closer at what's happening to the `dev->v4l2` pointer, and determine why that pointer is being set to NULL, or not initialized properly. I'll need to double check the initialization and assignment of `v4l2` to make sure it's valid. This may require stepping through the code to trace the values of `v4l2`. I need to review `struct em28xx_v4l2` again to fully understand.
|
| 18/2 |
2026/05/19 14:09 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/media/usb/em28xx/em28xx.h IncludeLines:true Name:em28xx_v4l2]
Results: map[SourceCode: 542: struct em28xx_v4l2 {
543: struct kref ref;
544: struct em28xx *dev;
545:
546: struct v4l2_device v4l2_dev;
547: struct v4l2_ctrl_handler ctrl_handler;
548:
549: struct video_device vdev;
550: struct video_device vbi_dev;
551: struct video_device radio_dev;
552:
553: /* Videobuf2 */
554: struct vb2_queue vb_vidq;
555: struct vb2_queue vb_vbiq;
556: struct mutex vb_queue_lock; /* Protects vb_vidq */
557: struct mutex vb_vbi_queue_lock; /* Protects vb_vbiq */
558:
559: u8 vinmode;
560: u8 vinctl;
561:
562: /* Camera specific fields */
563: int sensor_xres;
564: int sensor_yres;
565: int sensor_xtal;
566:
567: int users; /* user count for exclusive use */
568: int streaming_users; /* number of actively streaming users */
569:
570: u32 frequency; /* selected tuner frequency */
571:
572: struct em28xx_fmt *format;
573: v4l2_std_id norm; /* selected tv norm */
574:
575: /* Progressive/interlaced mode */
576: bool progressive;
577: int interlaced_fieldmode; /* 1=interlaced fields, 0=just top fields */
578: /* FIXME: everything else than interlaced_fieldmode=1 doesn't work */
579:
580: /* Frame properties */
581: int width; /* current frame width */
582: int height; /* current frame height */
583: unsigned int hscale; /* horizontal scale factor (see datasheet) */
584: unsigned int vscale; /* vertical scale factor (see datasheet) */
585: unsigned int vbi_width;
586: unsigned int vbi_height; /* lines per field */
587:
588: /* Capture state tracking */
589: int capture_type;
590: bool top_field;
591: int vbi_read;
592: unsigned int field_count;
593:
594: #ifdef CONFIG_MEDIA_CONTROLLER
595: struct media_pad video_pad, vbi_pad;
596: struct media_entity *decoder;
597: #endif
598: };
SourceFile:drivers/media/usb/em28xx/em28xx.h]
|
| 19/2 |
2026/05/19 14:09 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 25459
output: 50
thoughts: 69
Thoughts: **Investigating the `norm` Field Offset**
Okay, let's get down to brass tacks. I need to pinpoint the memory offset of the `norm` field within the `struct em28xx_v4l2`. I recall seeing that structure definition – it's around line 573 in the relevant source file. My primary aim is to ascertain its exact position within the structure's layout.
To expedite this, I'll leverage `codesearch-struct-layout`. It's the most reliable tool in my arsenal for these sorts of precise inquiries. That tool should give me the exact byte offset I need, making this a quick and painless diagnostic.
|
| 20/2 |
2026/05/19 14:09 |
tool |
codesearch-struct-layout |
0m
Args: map[ContextFile:drivers/media/usb/em28xx/em28xx.h Name:em28xx_v4l2]
Results: map[Fields:[map[Name:ref OffsetBits:0 SizeBits:32] map[Name:dev OffsetBits:64 SizeBits:64] map[Name:v4l2_dev OffsetBits:128 SizeBits:1472] map[Name:ctrl_handler OffsetBits:1600 SizeBits:2560] map[Name:vdev OffsetBits:4160 SizeBits:12800] map[Name:vbi_dev OffsetBits:16960 SizeBits:12800] map[Name:radio_dev OffsetBits:29760 SizeBits:12800] map[Name:vb_vidq OffsetBits:42560 SizeBits:4672] map[Name:vb_vbiq OffsetBits:47232 SizeBits:4672] map[Name:vb_queue_lock OffsetBits:51904 SizeBits:1152] map[Name:vb_vbi_queue_lock OffsetBits:53056 SizeBits:1152] map[Name:vinmode OffsetBits:54208 SizeBits:8] map[Name:vinctl OffsetBits:54216 SizeBits:8] map[Name:sensor_xres OffsetBits:54240 SizeBits:32] map[Name:sensor_yres OffsetBits:54272 SizeBits:32] map[Name:sensor_xtal OffsetBits:54304 SizeBits:32] map[Name:users OffsetBits:54336 SizeBits:32] map[Name:streaming_users OffsetBits:54368 SizeBits:32] map[Name:frequency OffsetBits:54400 SizeBits:32] map[Name:format OffsetBits:54464 SizeBits:64] map[Name:norm OffsetBits:54528 SizeBits:64] map[Name:progressive OffsetBits:54592 SizeBits:8] map[Name:interlaced_fieldmode OffsetBits:54624 SizeBits:32] map[Name:width OffsetBits:54656 SizeBits:32] map[Name:height OffsetBits:54688 SizeBits:32] map[Name:hscale OffsetBits:54720 SizeBits:32] map[Name:vscale OffsetBits:54752 SizeBits:32] map[Name:vbi_width OffsetBits:54784 SizeBits:32] map[Name:vbi_height OffsetBits:54816 SizeBits:32] map[Name:capture_type OffsetBits:54848 SizeBits:32] map[Name:top_field OffsetBits:54880 SizeBits:8] map[Name:vbi_read OffsetBits:54912 SizeBits:32] map[Name:field_count OffsetBits:54944 SizeBits:32] map[Name:video_pad OffsetBits:54976 SizeBits:512] map[Name:vbi_pad OffsetBits:55488 SizeBits:512] map[Name:decoder OffsetBits:56000 SizeBits:64]]]
|
| 21/2 |
2026/05/19 14:09 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 26571
output: 56
thoughts: 1609
Thoughts: **Debugging a Potential NULL Pointer Dereference**
Okay, so I'm looking at this crash in `em28xx_resolution_set`, specifically around the `norm_maxh` line, which seems to be the culprit. I see that the offset of `norm` is 0x1aa0 bytes, which is 6816 bytes, and I'm immediately thinking that if `v4l2` is NULL, then `v4l2->norm` would be at that offset. Initially I'm confused because `v4l2->users` should be at 0x1a88, but this wasn't the trapping instruction.
I quickly check the assembly and confirm that `%rbp` is being used, and it's being loaded with the address where `v4l2` would be. I see that the assembly instruction `lea 0x1aa0(%rbp),%rdi` is the culprit. Wait, `%rbp` is 0, so `v4l2` is NULL! But why didn't it crash at `v4l2->users`? I'm puzzled because I know in the code, `em28xx_v4l2_open` checks `v4l2->users == 0`. It should have crashed there if `v4l2` were NULL.
I considered whether `v4l2` was potentially not NULL within `em28xx_v4l2_open`, but became NULL later, but this did not align with the code. I check the assembly again. I'm seeing that `%rbp` is definitively zero. Then, the crash is at the `norm_maxh` line. The code is inlined, so that's helpful. But, `em28xx_v4l2_open` calls `em28xx_resolution_set` which should have checked `v4l2`. I check the assembly and see `lea 0x1aa0(%rbp),%rdi`. So `rbp` is being used as `v4l2`. It is null. So why did it not crash at `v4l2->users`?
Okay, maybe there's a bad pointer in play here. But then I remember `%rbp` is indeed 0, which means the pointer `v4l2` is zero as well. Then, I wonder about optimization, but the `v4l2->users` check in `if (v4l2->users == 0)` should have prevented that. I have a hunch... I check the `em28xx_videodbg` call. It's using `v4l2->users` but, if video debugging is off, that line is not evaluated. `v4l2_fh_open` is called after and does not use `v4l2`. But, the `v4l2->users` check *is* used, right after! So I should be crashing there. But, I am not. I need to check `v4l2_fh_open`. Something is wrong.
|
| 22/2 |
2026/05/19 14:09 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/media/v4l2-core/v4l2-fh.c IncludeLines:true Name:v4l2_fh_open]
Results: map[SourceCode: 57: int v4l2_fh_open(struct file *filp)
58: {
59: struct video_device *vdev = video_devdata(filp);
60: struct v4l2_fh *fh = kzalloc_obj(*fh);
61:
62: if (fh == NULL)
63: return -ENOMEM;
64: v4l2_fh_init(fh, vdev);
65: v4l2_fh_add(fh, filp);
66: return 0;
67: }
SourceFile:drivers/media/v4l2-core/v4l2-fh.c]
|
| 23/2 |
2026/05/19 14:09 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 29112
output: 53
thoughts: 1734
Thoughts: **Analyzing a Kernel Crash in em28xx-video.c**
Okay, so I've got this crash that's happening, and the initial address of `v4l2->users` is at `0x1a88`. The crash seems to be happening at `0x1aa0`. At first, I was worried about instruction reordering but it now seems the crash is in a separate function. I'm looking at the assembly code, specifically the instruction at address `0x2a`, which is a `cmpb` instruction that's causing a trap. This is a KASAN shadow check for `0x1aa0(%rbp)`. The fact that `%rbp` is `0x0000000000000000` is what is throwing me off. Why is it checking `0x1aa0` and not `0x1a88` as I initially expected, specifically `v4l2->users`?
I realized that `em28xx_resolution_set` is a separate function, but it's being inlined as `em28xx_resolution_set.isra.0`. This specialization means the compiler has optimized it, possibly with constant arguments or partial inlining. The stack trace confirms the crash is inside `em28xx_resolution_set.isra.0`. It's not fully inlined!
Looking at the code, `em28xx_resolution_set` is called from `em28xx_v4l2_open`. Specifically:
```c
if (v4l2->users == 0) {
em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
if (vdev->vfl_type != VFL_TYPE_RADIO)
em28xx_resolution_set(dev);
```
So `v4l2->users` *should* have been evaluated in `em28xx_v4l2_open` and should have crashed there if `v4l2` were NULL. Why didn't it? Is it possible that `v4l2` isn't NULL in the open function but becomes NULL between there and the call to `em28xx_resolution_set`? No, because `v4l2` is a local variable, initialized from `dev->v4l2`:
```c
struct em28xx_v4l2 *v4l2 = dev->v4l2;
```
And `em28xx_resolution_set` *also* does this:
```c
static int em28xx_resolution_set(struct em28xx *dev)
{
struct em28xx_v4l2 *v4l2 = dev->v4l2;
```
I'm thinking, could `dev->v4l2` have become NULL? But `dev->lock` is held. So, no. Wait! Could `dev` be NULL? If `dev` is NULL, then `dev->v4l2` would crash! `dev` is `video_drvdata(filp)`.
Hold on! What if `v4l2` isn't NULL, but `%rbp` in `em28xx_resolution_set.isra.0` is *not* what I think it is? Let me check `em28xx_resolution_set` again:
```c
static int em28xx_resolution_set(struct em28xx *dev)
{
struct em28xx_v4l2 *v4l2 = dev->v4l2;
int width = norm_maxw(dev);
int height = norm_maxh(dev);
```
Okay, `norm_maxh` does:
```c
static inline unsigned int norm_maxh(struct em28xx *dev)
{
struct em28xx_v4l2 *v4l2 = dev->v4l2;
if (dev->is_webcam)
return v4l2->sensor_yres;
if (dev->board.max_range_640_480)
return 480;
return (v4l2->norm & V4L2_STD_625_50) ? 576 : 480;
}
```
Aha! If `v4l2` is NULL inside `norm_maxh`, it *will* crash at `v4l2
|
| 24/2 |
2026/05/19 14:09 |
tool |
codesearch-find-references |
0m
Error:
Args: map[ContextFile:drivers/media/usb/em28xx/em28xx-video.c IncludeSnippetLines:0 Name:v4l2]
Results: map[References:<nil> TruncatedOutput:false]
|
| 25/2 |
2026/05/19 14:09 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 31945
output: 21
thoughts: 14
Thoughts: Here's my thought process, summarized as you requested:
**Searching for a Key Kernel Pointer**
Okay, so I need to find something specific within this code, and the best way to do that is to start with a targeted search. I'm going to look for the pattern `dev->v4l2 =`. This suggests I'm after code that's assigning something to a `v4l2` member within a `dev` structure. That `->` notation is a classic C pointer dereference, a strong indicator I am in the right ballpark. This pointer is almost certainly part of the Linux kernel's Video4Linux2 subsystem, since `v4l2` is explicitly mentioned. The fact that I'm specifically looking for an *assignment* to that member tells me I'm probably trying to understand how this particular `dev` structure is *initialized* or *configured* in relation to Video4Linux2. The goal is likely to trace how a device driver integrates with the V4L2 framework.
|
| 26/2 |
2026/05/19 14:09 |
tool |
grepper |
0m
Args: map[Expression:dev->v4l2 =]
Results: map[Output:drivers/media/usb/em28xx/em28xx-video.c=2113=static void em28xx_free_v4l2(struct kref *ref)
--
drivers/media/usb/em28xx/em28xx-video.c-2116-
drivers/media/usb/em28xx/em28xx-video.c:2117: v4l2->dev->v4l2 = NULL;
drivers/media/usb/em28xx/em28xx-video.c-2118- kfree(v4l2);
--
drivers/media/usb/em28xx/em28xx-video.c=2510=static int em28xx_v4l2_init(struct em28xx *dev)
--
drivers/media/usb/em28xx/em28xx-video.c-2538- v4l2->dev = dev;
drivers/media/usb/em28xx/em28xx-video.c:2539: dev->v4l2 = v4l2;
drivers/media/usb/em28xx/em28xx-video.c-2540-
--
drivers/media/usb/em28xx/em28xx-video.c-2899-err:
drivers/media/usb/em28xx/em28xx-video.c:2900: dev->v4l2 = NULL;
drivers/media/usb/em28xx/em28xx-video.c-2901- kref_put(&v4l2->ref, em28xx_free_v4l2);
]
|
| 27/2 |
2026/05/19 14:09 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 32628
output: 59
thoughts: 46
Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience:
**Memory Management Deep Dive: `em28xx_free_v4l2`**
Right, so that `dev->v4l2 = NULL;` assignment caught my eye. It's in `em28xx_free_v4l2`, meaning we're explicitly zeroing out the `v4l2` pointer. That's good practice, especially in a driver. It tells me we're likely releasing V4L2-specific resources here. Now, I need to understand *exactly* what's being cleaned up during this call. Let's dig into `em28xx_free_v4l2` and see the complete picture. I'm assuming, given the context of a video device, it's dealing with buffers, controls, potentially even memory mappings. I need to make sure this deallocation is robust. I want to know if there is a use-after-free vulnerability, potential memory leaks, or missed resource releases here. Let's see if this function is protecting itself from double frees. I'll need to look at who is calling `em28xx_free_v4l2` and under what conditions.
|
| 28/2 |
2026/05/19 14:09 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/media/usb/em28xx/em28xx-video.c IncludeLines:true Name:em28xx_free_v4l2]
Results: map[SourceCode:2106: /*
2107: * em28xx_free_v4l2() - Free struct em28xx_v4l2
2108: *
2109: * @ref: struct kref for struct em28xx_v4l2
2110: *
2111: * Called when all users of struct em28xx_v4l2 are gone
2112: */
2113: static void em28xx_free_v4l2(struct kref *ref)
2114: {
2115: struct em28xx_v4l2 *v4l2 = container_of(ref, struct em28xx_v4l2, ref);
2116:
2117: v4l2->dev->v4l2 = NULL;
2118: kfree(v4l2);
2119: }
SourceFile:drivers/media/usb/em28xx/em28xx-video.c]
|
| 29/2 |
2026/05/19 14:09 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 33287
output: 59
thoughts: 806
Thoughts: **Analyzing a Potential NULL Pointer Dereference in `em28xx_v4l2_open`**
Okay, let's break this down. The code in `em28xx_v4l2_open` looks like this: `struct em28xx_v4l2 *v4l2 = dev->v4l2;`. So, if `dev->v4l2` is NULL, then `v4l2` is also NULL. The interesting thing is that `v4l2` is used *before* the mutex lock:
```c
struct em28xx_v4l2 *v4l2 = dev->v4l2;
enum v4l2_buf_type fh_type = 0;
int ret;
switch (vdev->vfl_type) {
...
}
em28xx_videodbg("open dev=%s type=%s users=%d\n",
video_device_node_name(vdev), v4l2_type_names[fh_type],
v4l2->users);
if (mutex_lock_interruptible(&dev->lock))
return -ERESTARTSYS;
```
If `v4l2` is NULL, then the access to `v4l2->users` within `em28xx_videodbg` should cause a crash if `video_debug` is non-zero, right? However, `video_debug` is probably zero by default and the code does not dereference `v4l2->users` if `video_debug` is zero, so this explains why we may not see a crash immediately.
But wait, look at this:
```c
ret = v4l2_fh_open(filp);
if (ret) {
...
}
if (v4l2->users == 0) {
```
*Here* is the problem. If `v4l2` is NULL, then `v4l2->users == 0` *will* crash! That's a classic NULL pointer dereference. So, why didn't the bug report show the crash here?
Let's look at the assembly to see what's really happening:
```assembly
0: 0f 85 d5 05 00 00 jne 0x5db
6: 48 8d bd a0 1a 00 00 lea 0x1aa0(%rbp),%rdi
d: 44 0f b6 bb 3c 01 00 movzbl 0x13c(%rbx),%r15d
```
The key here is the address `0x1aa0(%rbp)`. If `%rbp` is zero, then we're accessing a very low memory address, which would likely trigger a KASAN (Kernel Address Sanitizer) error, right?
The bug report says:
```
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000354: 0000 [#1] SMP KASAN PTI
KASAN: probably user-memory-access in range [0x0000000000001aa0-0x0000000000001aa7]
```
This confirms the access to `0x1aa0`. And the report says, "If `%rbp` is `0`, then `v4l2` is `NULL`."
So, `%rbp` is 0, which means `v4l2` is NULL. Why didn't the crash happen where I expected it in `if (v4l2->users == 0)`? Let me check `em28xx_v4l2_open` one more time...
|
| 30/2 |
2026/05/19 14:09 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/media/usb/em28xx/em28xx-video.c IncludeLines:true Name:em28xx_v4l2_open]
Results: map[SourceCode:2121: /*
2122: * em28xx_v4l2_open()
2123: * inits the device and starts isoc transfer
2124: */
2125: static int em28xx_v4l2_open(struct file *filp)
2126: {
2127: struct video_device *vdev = video_devdata(filp);
2128: struct em28xx *dev = video_drvdata(filp);
2129: struct em28xx_v4l2 *v4l2 = dev->v4l2;
2130: enum v4l2_buf_type fh_type = 0;
2131: int ret;
2132:
2133: switch (vdev->vfl_type) {
2134: case VFL_TYPE_VIDEO:
2135: fh_type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
2136: break;
2137: case VFL_TYPE_VBI:
2138: fh_type = V4L2_BUF_TYPE_VBI_CAPTURE;
2139: break;
2140: case VFL_TYPE_RADIO:
2141: break;
2142: default:
2143: return -EINVAL;
2144: }
2145:
2146: em28xx_videodbg("open dev=%s type=%s users=%d\n",
2147: video_device_node_name(vdev), v4l2_type_names[fh_type],
2148: v4l2->users);
2149:
2150: if (mutex_lock_interruptible(&dev->lock))
2151: return -ERESTARTSYS;
2152:
2153: ret = v4l2_fh_open(filp);
2154: if (ret) {
2155: dev_err(&dev->intf->dev,
2156: "%s: v4l2_fh_open() returned error %d\n",
2157: __func__, ret);
2158: mutex_unlock(&dev->lock);
2159: return ret;
2160: }
2161:
2162: if (v4l2->users == 0) {
2163: em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
2164:
2165: if (vdev->vfl_type != VFL_TYPE_RADIO)
2166: em28xx_resolution_set(dev);
2167:
2168: /*
2169: * Needed, since GPIO might have disabled power
2170: * of some i2c devices
2171: */
2172: em28xx_wake_i2c(dev);
2173: }
2174:
2175: if (vdev->vfl_type == VFL_TYPE_RADIO) {
2176: em28xx_videodbg("video_open: setting radio device\n");
2177: v4l2_device_call_all(&v4l2->v4l2_dev, 0, tuner, s_radio);
2178: }
2179:
2180: kref_get(&dev->ref);
2181: kref_get(&v4l2->ref);
2182: v4l2->users++;
2183:
2184: mutex_unlock(&dev->lock);
2185:
2186: return 0;
2187: }
SourceFile:drivers/media/usb/em28xx/em28xx-video.c]
|
| 31/2 |
2026/05/19 14:09 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 36100
output: 56
thoughts: 2232
Thoughts: **Crash Analysis: KASAN and a Mysterious Null Pointer**
Okay, here's the breakdown of my thought process regarding this crash report. Initially, I was thrown off by the `v4l2` pointer. I see that if `v4l2` were null, then accessing `v4l2->users` should have crashed immediately, at `0x1a88`. But the KASAN report pointed to `0x1aa0` and a non-canonical address, which is very strange. My initial thinking was that if `v4l2` was null, that the KASAN shadow for `0x1a88` or `0x1aa0` would cause the crash. I also considered, but discarded the possibility that `dev` was null, which would mean that `v4l2` was being read from an invalid memory region via `dev->v4l2`. That path was quickly blocked since the lock `dev->lock` was being accessed and would have caused an earlier crash.
The critical piece was realizing that the crash, reported at `0x1aa0`, and the KASAN shadow address were related to a user-space address. KASAN is reporting the non-canonical address and trapping on the `cmpb` instruction, which is checking the KASAN shadow. I then recognized that the KASAN shadow address for an *attempt* to read the address *0x1aa0* in user-space, IS a non-canonical address in the kernel. This means that the kernel *is* trying to read from address `0x1aa0`.
Thus, `v4l2` must be `0` (NULL), because that's the only way we end up reading from address 0x1aa0 in the kernel. But, I had to explain why it didn't crash earlier with the `v4l2->users` access. After a quick look at the assembly, it *should* have crashed when `v4l2->users` was being read, before `v4l2->norm`. However, it looked like `em28xx_resolution_set` *re-reads* `dev->v4l2`. This led me to consider a race condition, where `dev->v4l2` might change to NULL between accesses. But the `dev->lock` mutex *should* protect against that... unless it's within a function called while the mutex is held.
And then it hit me: the code re-reads `dev->v4l2`. So, in the `em28xx_v4l2_open` function, a local variable `v4l2` is assigned to `dev->v4l2`. But, the `em28xx_resolution_set` function *also* reads `dev->v4l2`. If `dev->v4l2` is changed to `NULL` between those two reads, then the first access would work, and the second access would be `NULL`, which is when the crash would occur at address `0x1aa0` when `v4l2->norm` is accessed, leading to the crash report. The culprit is the double read from the same `dev->v4l2` variable, but this is protected by `dev->lock`! So no, something else must be happening.
|
| 32/2 |
2026/05/19 14:09 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/media/usb/em28xx/em28xx-video.c IncludeLines:true Name:em28xx_set_mode]
Results: map[SourceCode: 741: int em28xx_set_mode(struct em28xx *dev, enum em28xx_mode set_mode)
742: {
743: if (dev->mode == set_mode)
744: return 0;
745:
746: if (set_mode == EM28XX_SUSPEND) {
747: dev->mode = set_mode;
748:
749: /* FIXME: add suspend support for ac97 */
750:
751: return em28xx_gpio_set(dev, dev->board.suspend_gpio);
752: }
753:
754: dev->mode = set_mode;
755:
756: if (dev->mode == EM28XX_DIGITAL_MODE)
757: return em28xx_gpio_set(dev, dev->board.dvb_gpio);
758: else
759: return em28xx_gpio_set(dev, INPUT(dev->ctl_input)->gpio);
760: }
SourceFile:drivers/media/usb/em28xx/em28xx-core.c]
|
| 33/2 |
2026/05/19 14:09 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 39461
output: 45
thoughts: 1842
Thoughts: **Debugging a Potential NULL Pointer Dereference in em28xx Driver**
Okay, so I'm diving into this crash report from the em28xx driver, and it's a bit of a head-scratcher. The crash is happening in `em28xx_resolution_set`, but the initial thought was that a potential `NULL` `v4l2` pointer was the culprit. The `em28xx_set_mode` and `v4l2_fh_open` paths don't seem to touch `dev->v4l2` in a way that would introduce a `NULL`.
The first thing that caught my eye was the possibility that `dev->v4l2` was already `NULL` upon entering `em28xx_v4l2_open`. However, this didn't seem likely because `v4l2` should then also be `NULL`, and dereferencing `v4l2->users` should have led to an immediate crash. But it didn't; the crash happened later.
The reported crash address was 0x1aa0, and I realized that if `v4l2` *wasn't* `NULL`, but was a small offset like 0x18, then 0x1a88 + 0x18 = 0x1aa0. I went back and checked the assembly again, and it did indeed look like `0x1aa0(%rbp)` was being used, which seemed to support that hypothesis. But the stack trace reports `RBP: 0000000000000000`. This means `%rbp` *is* `0`, so `v4l2` is `NULL`!
The problem, then, is that the crash happened *after* the `if (v4l2->users == 0)` check. If `v4l2` is `NULL`, it *should* have crashed immediately in `em28xx_v4l2_open`, but it didn't. I then started thinking that maybe the `v4l2` might be `NULL` by the time it gets to the second function where it is accessed; that maybe something in the middle caused it to change. However, since the driver is holding `dev->lock`, other threads should be blocked. `v4l2_fh_open` and interrupts couldn't change it. The only way it could change is through `em28xx_free_v4l2` or `em28xx_v4l2_fini`, which are only called when the reference count drops to zero. But within `em28xx_v4l2_open`, we get the reference count by using `kref_get`, which happens before any use. So this shouldn't be possible.
Another thought was that the `dev` pointer itself was dangling. If `dev` was freed, the `video_drvdata(filp)` might return a bad pointer. But `dev` is a pointer stored on `vdev`, which should prevent it from being freed. If `dev` was freed, then `dev->lock` should be a dangling pointer, but the use of `mutex_lock_interruptible(&dev->lock)` should have been caught by KASAN.
Let's circle back to the first point of the problem: why didn't the `v4l2->users` dereference crash immediately? Could it be that `users` isn't at offset 0x1a88? No, `codesearch-struct-layout` confirms that it is.
Okay, let's step back and look at the assembly of `em28xx_resolution_set.isra.0` again. `movzbl 0x13c(%rbx),%r15d` looked like a possible culprit. I noticed that it uses `rbx` and `norm_maxh` which uses `dev->is_webcam`, which is a bitfield! This may give me another clue to the problem.
This suggests that maybe the problem doesn't have anything to do with `v4l2` being `NULL`, and instead is related to `dev->is_webcam`.
|
| 34/2 |
2026/05/19 14:09 |
tool |
codesearch-struct-layout |
0m
Args: map[ContextFile:drivers/media/usb/em28xx/em28xx.h Name:em28xx]
Results: map[Fields:[map[Name:ref OffsetBits:0 SizeBits:32] map[Name:v4l2 OffsetBits:64 SizeBits:64] map[Name:dvb OffsetBits:128 SizeBits:64] map[Name:adev OffsetBits:192 SizeBits:2176] map[Name:ir OffsetBits:2368 SizeBits:64] map[Name:model OffsetBits:2432 SizeBits:32] map[Name:devno OffsetBits:2464 SizeBits:32] map[Name:chip_id OffsetBits:2496 SizeBits:32] map[Name:is_em25xx OffsetBits:2528 SizeBits:1] map[Name:disconnected OffsetBits:2529 SizeBits:1] map[Name:has_video OffsetBits:2530 SizeBits:1] map[Name:is_audio_only OffsetBits:2531 SizeBits:1] map[Name:is_webcam OffsetBits:2532 SizeBits:1] map[Name:has_msp34xx OffsetBits:2533 SizeBits:1] map[Name:i2c_speed OffsetBits:2534 SizeBits:2] map[Name:int_audio_type OffsetBits:2560 SizeBits:32] map[Name:usb_audio_type OffsetBits:2592 SizeBits:32] map[Name:name OffsetBits:2624 SizeBits:256] map[Name:board OffsetBits:2880 SizeBits:1792] map[Name:em28xx_sensor OffsetBits:4672 SizeBits:32] map[Name:wait_after_write OffsetBits:4704 SizeBits:32] map[Name:devlist OffsetBits:4736 SizeBits:128] map[Name:i2s_speed OffsetBits:4864 SizeBits:32] map[Name:audio_mode OffsetBits:4896 SizeBits:32] map[Name:tuner_type OffsetBits:4928 SizeBits:32] map[Name:i2c_adap OffsetBits:4992 SizeBits:28800] map[Name:i2c_client OffsetBits:33792 SizeBits:19200] map[Name:i2c_bus OffsetBits:52992 SizeBits:256] map[Name:eeprom_addrwidth_16bit OffsetBits:53248 SizeBits:1] map[Name:def_i2c_bus OffsetBits:53280 SizeBits:32] map[Name:cur_i2c_bus OffsetBits:53312 SizeBits:32] map[Name:i2c_bus_lock OffsetBits:53376 SizeBits:1024] map[Name:ctl_input OffsetBits:54400 SizeBits:32] map[Name:ctl_ainput OffsetBits:54432 SizeBits:32] map[Name:ctl_aoutput OffsetBits:54464 SizeBits:32] map[Name:amux_map OffsetBits:54496 SizeBits:128] map[Name:mute OffsetBits:54624 SizeBits:32] map[Name:volume OffsetBits:54656 SizeBits:32] map[Name:hash OffsetBits:54720 SizeBits:64] map[Name:i2c_hash OffsetBits:54784 SizeBits:64] map[Name:request_module_wk OffsetBits:54848 SizeBits:576] map[Name:lock OffsetBits:55424 SizeBits:1152] map[Name:ctrl_urb_lock OffsetBits:56576 SizeBits:1152] map[Name:resources OffsetBits:57728 SizeBits:32] map[Name:eedata OffsetBits:57792 SizeBits:64] map[Name:eedata_len OffsetBits:57856 SizeBits:16] map[Name:vidq OffsetBits:57920 SizeBits:768] map[Name:vbiq OffsetBits:58688 SizeBits:768] map[Name:usb_ctl OffsetBits:59456 SizeBits:704] map[Name:slock OffsetBits:60160 SizeBits:512] map[Name:intf OffsetBits:60672 SizeBits:64] map[Name:ifnum OffsetBits:60736 SizeBits:8] map[Name:analog_ep_isoc OffsetBits:60744 SizeBits:8] map[Name:analog_ep_bulk OffsetBits:60752 SizeBits:8] map[Name:dvb_ep_isoc_ts2 OffsetBits:60760 SizeBits:8] map[Name:dvb_ep_bulk_ts2 OffsetBits:60768 SizeBits:8] map[Name:dvb_ep_isoc OffsetBits:60776 SizeBits:8] map[Name:dvb_ep_bulk OffsetBits:60784 SizeBits:8] map[Name:alt OffsetBits:60800 SizeBits:32] map[Name:max_pkt_size OffsetBits:60832 SizeBits:32] map[Name:packet_multiplier OffsetBits:60864 SizeBits:32] map[Name:num_alt OffsetBits:60896 SizeBits:32] map[Name:alt_max_pkt_size_isoc OffsetBits:60928 SizeBits:64] map[Name:analog_xfer_bulk OffsetBits:60992 SizeBits:1] map[Name:dvb_alt_isoc OffsetBits:61024 SizeBits:32] map[Name:dvb_max_pkt_size_isoc OffsetBits:61056 SizeBits:32] map[Name:dvb_max_pkt_size_isoc_ts2 OffsetBits:61088 SizeBits:32] map[Name:dvb_xfer_bulk OffsetBits:61120 SizeBits:1] map[Name:urb_buf OffsetBits:61128 SizeBits:640] map[Name:em28xx_write_regs OffsetBits:61824 SizeBits:64] map[Name:em28xx_read_reg OffsetBits:61888 SizeBits:64] map[Name:em28xx_read_reg_req_len OffsetBits:61952 SizeBits:64] map[Name:em28xx_write_regs_req OffsetBits:62016 SizeBits:64] map[Name:em28xx_read_reg_req OffsetBits:62080 SizeBits:64] map[Name:mode OffsetBits:62144 SizeBits:32] map[Name:buttons_query_work OffsetBits:62208 SizeBits:1344] map[Name:button_polling_addresses OffsetBits:63552 SizeBits:40] map[Name:button_polling_last_values OffsetBits:63592 SizeBits:40] map[Name:num_button_polling_addresses OffsetBits:63632 SizeBits:8] map[Name:button_polling_interval OffsetBits:63648 SizeBits:16] map[Name:snapshot_button_path OffsetBits:63664 SizeBits:240] map[Name:sbutton_input_dev OffsetBits:63936 SizeBits:64] map[Name:media_dev OffsetBits:64000 SizeBits:64] map[Name:input_ent OffsetBits:64064 SizeBits:3840] map[Name:input_pad OffsetBits:67904 SizeBits:2048] map[Name:dev_next OffsetBits:69952 SizeBits:64] map[Name:ts OffsetBits:70016 SizeBits:32]]]
|
| 35/2 |
2026/05/19 14:09 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 44404
output: 60
thoughts: 861
Thoughts: **Deconstructing the `em28xx` Driver Issue**
Okay, let's break this down. We've got a read of `dev->is_webcam` at offset `0x13c`, which confirms `%rbx` is `dev` and that `dev` is, thankfully, not NULL. The `lea 0x1aa0(%rbp), %rdi` instruction follows, which is where things start to get interesting. We check the KASAN shadow for `%rdi`, and `%rbp` is unexpectedly `0`. The fact `%rbp` is `0` gives us some context. It suggests `rbp` represents `v4l2`, the Video4Linux context for this device.
The immediate question is, how did we get into `em28xx_resolution_set` if `v4l2` is NULL? Let's re-examine `em28xx_v4l2_open`.
```c
struct em28xx_v4l2 *v4l2 = dev->v4l2;
...
if (v4l2->users == 0) {
```
If `v4l2` is `0`, this would crash! But it seems we're past that. So, is it possible `v4l2` is NOT `0` in `em28xx_v4l2_open`, but *is* `0` in `em28xx_resolution_set`? The fact that `em28xx_resolution_set` is inlined as `em28xx_resolution_set.isra.0` is critical. It's partially inlined. Perhaps the compiler passed `dev` as an argument and `v4l2` is re-read from `dev->v4l2` inside the inlined function? Yes, `em28xx_resolution_set` confirms this:
```c
static int em28xx_resolution_set(struct em28xx *dev)
{
struct em28xx_v4l2 *v4l2 = dev->v4l2;
```
If `dev->v4l2` is `0` when `em28xx_resolution_set` is called, `v4l2` will be `0` inside the function, and we're back to the original problem.
Okay, let's trace it back. `dev->v4l2` is also read in `em28xx_v4l2_open`:
```c
struct em28xx_v4l2 *v4l2 = dev->v4l2;
```
If `dev->v4l2` was *not* `0` in `em28xx_v4l2_open` but *is* `0` in `em28xx_resolution_set`, it means `dev->v4l2` must have been changed *somehow* in between. What could have done that? `v4l2_fh_open` doesn't do it. But `em28xx_v4l2_open` is called when the device is opened...
The key must be a race condition. Could `em28xx_free_v4l2` have changed `dev->v4l2` concurrently? We need to verify the locking. Looking at `em28xx_v4l2_open`:
```c
if (mutex_lock_interruptible(&dev->lock))
return -ERESTARTSYS;
```
Aha! `em28xx_free_v4l2` *does not* hold `dev->lock`! It seems we have a classic race condition where `em28xx_free_v4l2` could be freeing the `v4l2` data at the same time as the resolution set logic is running. This is the root cause.
|
| 36/2 |
2026/05/19 14:09 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:drivers/media/usb/em28xx/em28xx-video.c IncludeSnippetLines:0 Name:em28xx_free_v4l2]
Results: map[References:[map[ReferenceKind:takes-address-of ReferencingEntityKind:function ReferencingEntityName:em28xx_v4l2_close SourceFile:drivers/media/usb/em28xx/em28xx-video.c SourceLine:2316] map[ReferenceKind:takes-address-of ReferencingEntityKind:function ReferencingEntityName:em28xx_v4l2_fini SourceFile:drivers/media/usb/em28xx/em28xx-video.c SourceLine:2240] map[ReferenceKind:takes-address-of ReferencingEntityKind:function ReferencingEntityName:em28xx_v4l2_init SourceFile:drivers/media/usb/em28xx/em28xx-video.c SourceLine:2901]] TruncatedOutput:false]
|
| 37/2 |
2026/05/19 14:09 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 46432
output: 59
thoughts: 17
Thoughts: Okay, let's dive into this. Here's my summary, taking the first-person perspective as requested:
**Deconstructing `em28xx_v4l2_close`**
Alright, time to examine the `em28xx_v4l2_close` function. My initial thought is to run through the code in my head. I need to understand what resources it frees and what cleanup it performs. This is a critical point; a faulty close function is a notorious source of resource leaks and subtle driver errors that are notoriously difficult to track down.
I'm thinking about the standard V4L2 context. I'm expecting to see calls to release buffers, deregister devices, and potentially some synchronization primitives getting released. I know the V4L2 core requires a proper shutdown sequence, so I'm paying particular attention to that. I'll need to confirm that any allocated memory, especially that related to the video buffers (if any exist in this driver's design) is deallocated correctly. If there's hardware state to be reset, that's important too.
Specifically, I'll be looking for calls to `v4l2_device_unregister` or `v4l2_device_release`, if this driver is using a v4l2 device. Buffer deallocation is likely the most vital part. I'll need to know whether the driver uses explicit buffer management (e.g. `v4l2_buf_ops`) or perhaps relies on DMA buffers. If it's DMA, I need to know how the DMA resources are being released. Are there any outstanding requests? Any pending interrupts? Those should be cleaned up.
The overall goal is a clean exit. The driver should leave everything in a known state, ready for another open/close cycle, or for the system to gracefully shut down. I'll be particularly vigilant for race conditions. If there's any sharing of resources between the open and close path, a race here could lead to crashes or corruption. I'll be checking any locks, semaphores or mutexes that may protect this critical region.
|
| 38/2 |
2026/05/19 14:09 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/media/usb/em28xx/em28xx-video.c IncludeLines:true Name:em28xx_v4l2_close]
Results: map[SourceCode:2275: /*
2276: * em28xx_v4l2_close()
2277: * stops streaming and deallocates all resources allocated by the v4l2
2278: * calls and ioctls
2279: */
2280: static int em28xx_v4l2_close(struct file *filp)
2281: {
2282: struct em28xx *dev = video_drvdata(filp);
2283: struct em28xx_v4l2 *v4l2 = dev->v4l2;
2284: struct usb_device *udev = interface_to_usbdev(dev->intf);
2285: int err;
2286:
2287: em28xx_videodbg("users=%d\n", v4l2->users);
2288:
2289: vb2_fop_release(filp);
2290: mutex_lock(&dev->lock);
2291:
2292: if (v4l2->users == 1) {
2293: /* No sense to try to write to the device */
2294: if (dev->disconnected)
2295: goto exit;
2296:
2297: /* Save some power by putting tuner to sleep */
2298: v4l2_device_call_all(&v4l2->v4l2_dev, 0, tuner, standby);
2299:
2300: /* do this before setting alternate! */
2301: em28xx_set_mode(dev, EM28XX_SUSPEND);
2302:
2303: /* set alternate 0 */
2304: dev->alt = 0;
2305: em28xx_videodbg("setting alternate 0\n");
2306: err = usb_set_interface(udev, 0, 0);
2307: if (err < 0) {
2308: dev_err(&dev->intf->dev,
2309: "cannot change alternate number to 0 (error=%i)\n",
2310: err);
2311: }
2312: }
2313:
2314: exit:
2315: v4l2->users--;
2316: kref_put(&v4l2->ref, em28xx_free_v4l2);
2317: mutex_unlock(&dev->lock);
2318: kref_put(&dev->ref, em28xx_free_device);
2319:
2320: return 0;
2321: }
SourceFile:drivers/media/usb/em28xx/em28xx-video.c]
|
| 39/2 |
2026/05/19 14:09 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 47737
output: 59
thoughts: 118
Thoughts: Okay, let me think this through.
**Analyzing the Locking in the em28xx Video4Linux Driver**
Right, so I was looking at `em28xx_v4l2_close`, and the code *does* explicitly hold `dev->lock`. I see the `mutex_lock(&dev->lock);` and later, after the `kref_put` and potential `em28xx_free_v4l2` call, the `mutex_unlock(&dev->lock);` confirms that.
That's important. It means the `em28xx_free_v4l2` function is indeed called with `dev->lock` *already* held. This is critical for understanding any potential race conditions or lock ordering issues.
Now, what about `em28xx_v4l2_fini`? I need to check how that relates, and if it also holds that lock, or uses some other mechanism for synchronization. Gotta keep a holistic view here.
|
| 40/2 |
2026/05/19 14:09 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/media/usb/em28xx/em28xx-video.c IncludeLines:true Name:em28xx_v4l2_fini]
Results: map[SourceCode:2189: /*
2190: * em28xx_v4l2_fini()
2191: * unregisters the v4l2,i2c and usb devices
2192: * called when the device gets disconnected or at module unload
2193: */
2194: static int em28xx_v4l2_fini(struct em28xx *dev)
2195: {
2196: struct em28xx_v4l2 *v4l2 = dev->v4l2;
2197:
2198: if (dev->is_audio_only) {
2199: /* Shouldn't initialize IR for this interface */
2200: return 0;
2201: }
2202:
2203: if (!dev->has_video) {
2204: /* This device does not support the v4l2 extension */
2205: return 0;
2206: }
2207:
2208: if (!v4l2)
2209: return 0;
2210:
2211: dev_info(&dev->intf->dev, "Closing video extension\n");
2212:
2213: mutex_lock(&dev->lock);
2214:
2215: v4l2_device_disconnect(&v4l2->v4l2_dev);
2216:
2217: em28xx_uninit_usb_xfer(dev, EM28XX_ANALOG_MODE);
2218:
2219: em28xx_v4l2_media_release(dev);
2220:
2221: if (video_is_registered(&v4l2->radio_dev)) {
2222: dev_info(&dev->intf->dev, "V4L2 device %s deregistered\n",
2223: video_device_node_name(&v4l2->radio_dev));
2224: video_unregister_device(&v4l2->radio_dev);
2225: }
2226: if (video_is_registered(&v4l2->vbi_dev)) {
2227: dev_info(&dev->intf->dev, "V4L2 device %s deregistered\n",
2228: video_device_node_name(&v4l2->vbi_dev));
2229: video_unregister_device(&v4l2->vbi_dev);
2230: }
2231: if (video_is_registered(&v4l2->vdev)) {
2232: dev_info(&dev->intf->dev, "V4L2 device %s deregistered\n",
2233: video_device_node_name(&v4l2->vdev));
2234: video_unregister_device(&v4l2->vdev);
2235: }
2236:
2237: v4l2_ctrl_handler_free(&v4l2->ctrl_handler);
2238: v4l2_device_unregister(&v4l2->v4l2_dev);
2239:
2240: kref_put(&v4l2->ref, em28xx_free_v4l2);
2241:
2242: mutex_unlock(&dev->lock);
2243:
2244: kref_put(&dev->ref, em28xx_free_device);
2245:
2246: return 0;
2247: }
SourceFile:drivers/media/usb/em28xx/em28xx-video.c]
|
| 41/2 |
2026/05/19 14:09 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 49145
output: 25
thoughts: 470
Thoughts: **Analyzing a Potential Race Condition in the em28xx Driver**
Okay, so I'm looking at this `em28xx` driver code, specifically around the V4L2 initialization and cleanup. I see that `em28xx_v4l2_fini` holds `dev->lock`. That makes sense; it prevents concurrent access. So, `dev->v4l2` *shouldn't* be modified while the lock is held. But I'm starting to see a problem.
In `em28xx_v4l2_open`, there's this line: `struct em28xx_v4l2 *v4l2 = dev->v4l2;`. It reads `dev->v4l2` *before* acquiring the `dev->lock`. Then, after reading, the code does `if (mutex_lock_interruptible(&dev->lock))`.
Now, here's where it gets interesting. If `em28xx_v4l2_fini` (or `em28xx_v4l2_close` for that matter) runs concurrently, it could set `dev->v4l2 = NULL` and free the `v4l2` structure *before* `em28xx_v4l2_open` acquires the lock.
So, `em28xx_v4l2_open` acquires the lock, but now `v4l2` might be a dangling pointer. Then, there's this check: `if (v4l2->users == 0)`. If `v4l2` *was* freed, `v4l2->users` would be a classic use-after-free, right? I expected KASAN to catch this. But it didn't. Instead, it reported a GPF on a non-canonical address. That's strange.
Wait... if `v4l2` was actually freed, it would be a dangling pointer, not necessarily `NULL`.
Okay, but what if `dev->v4l2` *was* already `NULL` when `em28xx_v4l2_open` started? Then, `v4l2` would also be `NULL`. Then `v4l2->users` would be dereferencing a `NULL` pointer. But the code isn't crashing there. It is crashing with a non-canonical address.
But wait. If v4l2 is NULL, the dereference `v4l2->users` would result in a crash at address `0x1a88`.
I'm going to check the assembly of `em28xx_v4l2_open` to see what's happening. I need to understand this non-canonical address, and why this `NULL` check isn't working as I expect. It's gotta be something with how `v4l2` is handled after the potential concurrent freeing.
|
| 42/2 |
2026/05/19 14:09 |
tool |
grepper |
0m
Args: map[Expression:em28xx_v4l2_open]
Results: map[Output:drivers/media/usb/em28xx/em28xx-video.c=2113=static void em28xx_free_v4l2(struct kref *ref)
--
drivers/media/usb/em28xx/em28xx-video.c-2121-/*
drivers/media/usb/em28xx/em28xx-video.c:2122: * em28xx_v4l2_open()
drivers/media/usb/em28xx/em28xx-video.c-2123- * inits the device and starts isoc transfer
drivers/media/usb/em28xx/em28xx-video.c-2124- */
drivers/media/usb/em28xx/em28xx-video.c:2125:static int em28xx_v4l2_open(struct file *filp)
drivers/media/usb/em28xx/em28xx-video.c-2126-{
--
drivers/media/usb/em28xx/em28xx-video.c=2323=static const struct v4l2_file_operations em28xx_v4l_fops = {
drivers/media/usb/em28xx/em28xx-video.c-2324- .owner = THIS_MODULE,
drivers/media/usb/em28xx/em28xx-video.c:2325: .open = em28xx_v4l2_open,
drivers/media/usb/em28xx/em28xx-video.c-2326- .release = em28xx_v4l2_close,
--
drivers/media/usb/em28xx/em28xx-video.c=2384=static const struct v4l2_file_operations radio_fops = {
drivers/media/usb/em28xx/em28xx-video.c-2385- .owner = THIS_MODULE,
drivers/media/usb/em28xx/em28xx-video.c:2386: .open = em28xx_v4l2_open,
drivers/media/usb/em28xx/em28xx-video.c-2387- .release = em28xx_v4l2_close,
]
|
| 43/2 |
2026/05/19 14:09 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 50883
output: 56
thoughts: 1732
Thoughts: **Debugging a Race Condition in the em28xx Driver**
Okay, let's break this down. We've got a crash, and it seems related to the `em28xx_v4l2_open` function. Initially, I thought that if `dev->v4l2` was `NULL`, then `v4l2` would also be `NULL`. But the crash happened at `v4l2->norm`, but not where I would have expected. Why didn't it crash at `v4l2->users` first? Something's fishy.
Let's re-examine `em28xx_v4l2_open`. The `v4l2` pointer is initialized at the beginning by reading `dev->v4l2`. The `v4l2` pointer is checked. Then, `em28xx_resolution_set` is called.
The initial thought was a use-after-free, where `em28xx_v4l2_fini` might be running concurrently, setting `dev->v4l2` to `NULL` and freeing the `v4l2` struct, causing a use-after-free. This *could* explain the crash if `em28xx_v4l2_open` accesses `v4l2` after it's been freed. However, KASAN didn't report a use-after-free, but instead reported a GPF. Furthermore, the address pointed to a non-canonical address, `0xdffffc0000000354`, which corresponds to `0x1aa0`. This must be `0x1aa0` from the `v4l2` pointer. This would mean `v4l2` is `0`! But if `v4l2` *was* `0`, then `v4l2->users` would have crashed.
Let's look at the assembly. The crash happens in a `cmpb` instruction, specifically checking the value at `0x1aa0` offset from some register. That offset corresponds to `v4l2->norm`. The `v4l2->users` check comes before this code block, within `em28xx_v4l2_open`. But if `v4l2` is *zero*, the check for `v4l2->users` should have crashed *first*.
The key is that the code *re-reads* `dev->v4l2`. The `em28xx_resolution_set` function *also* reads `dev->v4l2`. If this function is not fully inlined, or if the compiler reloads the value, there is a race condition.
Within `em28xx_v4l2_open` we have:
```c
struct em28xx_v4l2 *v4l2 = dev->v4l2;
...
if (v4l2->users == 0) {
em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
if (vdev->vfl_type != VFL_TYPE_RADIO)
em28xx_resolution_set(dev);
```
Within `em28xx_resolution_set` we have:
```c
struct em28xx_v4l2 *v4l2 = dev->v4l2;
```
If `em28xx_set_mode` were to set `dev->v4l2` to `NULL`, then the `v4l2` pointer read by `em28xx_resolution_set` would be `NULL`, while the initial read in `em28xx_v4l2_open` would be a valid pointer. This also solves the issue of the race condition, which is a use-after-free, if `dev->lock` is held.
The key question is, does `em28xx_set_mode` actually modify `dev->v4l2`? If so, this would explain the crash. If not, we have another race condition on our hands.
|
| 44/2 |
2026/05/19 14:10 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/media/usb/em28xx/em28xx-core.c IncludeLines:true Name:em28xx_set_mode]
Results: map[SourceCode: 741: int em28xx_set_mode(struct em28xx *dev, enum em28xx_mode set_mode)
742: {
743: if (dev->mode == set_mode)
744: return 0;
745:
746: if (set_mode == EM28XX_SUSPEND) {
747: dev->mode = set_mode;
748:
749: /* FIXME: add suspend support for ac97 */
750:
751: return em28xx_gpio_set(dev, dev->board.suspend_gpio);
752: }
753:
754: dev->mode = set_mode;
755:
756: if (dev->mode == EM28XX_DIGITAL_MODE)
757: return em28xx_gpio_set(dev, dev->board.dvb_gpio);
758: else
759: return em28xx_gpio_set(dev, INPUT(dev->ctl_input)->gpio);
760: }
SourceFile:drivers/media/usb/em28xx/em28xx-core.c]
|
| 45/2 |
2026/05/19 14:10 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 53935
output: 56
thoughts: 35
Thoughts: Okay, here's my interpretation of those thoughts, framed as my own, given my expertise:
**Examining the Driver's State Transitions**
Right, so I'm looking at the `em28xx_set_mode` function and I'm noticing something crucial: it doesn't seem to be touching the `dev->v4l2` structure directly. That's a bit surprising. I'd expect mode changes, especially those relating to video formats or capture parameters, to require updates to the Video4Linux core's state tracking.
This raises a red flag. What's going on with how the driver's handling V4L2 compatibility? Is this intended behavior, or is there some implicit assumption about other parts of the system handling the V4L2 updates? Maybe it’s relying on some event that is triggered?
Now, the question is what's the role of `em28xx_gpio_set`? Does that, perhaps, indirectly influence the video subsystem in a way that *does* affect `dev->v4l2`? Or, maybe it's just dealing with hardware-level settings that don't directly map to the V4L2 framework. I need to investigate the interaction between those two function calls.
|
| 46/2 |
2026/05/19 14:10 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/media/usb/em28xx/em28xx-core.c IncludeLines:true Name:em28xx_gpio_set]
Results: map[SourceCode: 706: int em28xx_gpio_set(struct em28xx *dev, const struct em28xx_reg_seq *gpio)
707: {
708: int rc = 0;
709:
710: if (!gpio)
711: return rc;
712:
713: if (dev->mode != EM28XX_SUSPEND) {
714: em28xx_write_reg(dev, 0x48, 0x00);
715: if (dev->mode == EM28XX_ANALOG_MODE)
716: em28xx_write_reg(dev, EM28XX_R12_VINENABLE, 0x67);
717: else
718: em28xx_write_reg(dev, EM28XX_R12_VINENABLE, 0x37);
719: usleep_range(10000, 11000);
720: }
721:
722: /* Send GPIO reset sequences specified at board entry */
723: while (gpio->sleep >= 0) {
724: if (gpio->reg >= 0) {
725: rc = em28xx_write_reg_bits(dev,
726: gpio->reg,
727: gpio->val,
728: gpio->mask);
729: if (rc < 0)
730: return rc;
731: }
732: if (gpio->sleep > 0)
733: msleep(gpio->sleep);
734:
735: gpio++;
736: }
737: return rc;
738: }
SourceFile:drivers/media/usb/em28xx/em28xx-core.c]
|
| 47/2 |
2026/05/19 14:10 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 54840
output: 25
thoughts: 843
Thoughts: **Debugging a Potential NULL Pointer Dereference**
Okay, so `em28xx_gpio_set` isn't touching `dev->v4l2`. That's the first thing. But... what if `dev->v4l2` *starts* as `NULL`? If that's the case, then in `em28xx_v4l2_open`, the `v4l2` pointer is also `NULL`. Right, okay, so if `v4l2` is `NULL`, the very next line is where we access `v4l2->users`. Hmm, but it didn't crash there. Why?
Let's quickly re-examine that `em28xx_v4l2_open` code block again. There's the standard structure assignment, a switch statement, a mutex lock, a call to `v4l2_fh_open`, and then... *that* line: `if (v4l2->users == 0)`.
Aha! Now wait a second. What if `v4l2->users` isn't even evaluated? Could the compiler have somehow optimized it out? No, it's used in an if statement, so that's not possible. Hmm, if `v4l2` is not `NULL`, but is an invalid pointer, `v4l2->users` happens to be in a mapped page? Let's assume that `v4l2` is `0x18`, and so `v4l2->users` is at `0x1aa0`. Let's assume that `0x1a88 + 0x18 = 0x1aa0`. If `v4l2` is `0x18`, then `v4l2->users` is at `0x1aa0`. But, wait! The crash is at `0x1aa0` when accessing `v4l2->norm`! So `v4l2->norm` is at offset `0x1aa0`. If `v4l2` is `0`, then `v4l2->norm` is at `0x1aa0`. If `v4l2` is `0x18`, then `v4l2->norm` is at `0x1ab8`. The crash is at `0x1aa0`. That means `v4l2` is `0`! So, `v4l2` is definitely `0`. But, why didn't it crash at `v4l2->users`? That is what I need to check in the assembly code.
|
| 48/2 |
2026/05/19 14:10 |
tool |
grepper |
0m
Args: map[Expression:em28xx_v4l2_open]
Results: map[Output:drivers/media/usb/em28xx/em28xx-video.c=2113=static void em28xx_free_v4l2(struct kref *ref)
--
drivers/media/usb/em28xx/em28xx-video.c-2121-/*
drivers/media/usb/em28xx/em28xx-video.c:2122: * em28xx_v4l2_open()
drivers/media/usb/em28xx/em28xx-video.c-2123- * inits the device and starts isoc transfer
drivers/media/usb/em28xx/em28xx-video.c-2124- */
drivers/media/usb/em28xx/em28xx-video.c:2125:static int em28xx_v4l2_open(struct file *filp)
drivers/media/usb/em28xx/em28xx-video.c-2126-{
--
drivers/media/usb/em28xx/em28xx-video.c=2323=static const struct v4l2_file_operations em28xx_v4l_fops = {
drivers/media/usb/em28xx/em28xx-video.c-2324- .owner = THIS_MODULE,
drivers/media/usb/em28xx/em28xx-video.c:2325: .open = em28xx_v4l2_open,
drivers/media/usb/em28xx/em28xx-video.c-2326- .release = em28xx_v4l2_close,
--
drivers/media/usb/em28xx/em28xx-video.c=2384=static const struct v4l2_file_operations radio_fops = {
drivers/media/usb/em28xx/em28xx-video.c-2385- .owner = THIS_MODULE,
drivers/media/usb/em28xx/em28xx-video.c:2386: .open = em28xx_v4l2_open,
drivers/media/usb/em28xx/em28xx-video.c-2387- .release = em28xx_v4l2_close,
]
|
| 49/2 |
2026/05/19 14:10 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 56883
output: 59
thoughts: 5938
Thoughts: **The Puzzle of the Zero Pointer**
Okay, I'm deep in this kernel crash, and it's a real head-scratcher. I've got this `em28xx_resolution_set` function where things are going sideways, specifically, the infamous "general protection fault" KASAN error. My immediate thought was that a null pointer dereference was at play. I knew from the start `em28xx_v4l2_open` is the open callback. The key offsets of the `em28xx_v4l2` struct, `v4l2->users` at `0x1a88` and `v4l2->norm` at `0x1aa0`, seem correct based on `codesearch-struct-layout`.
Initially, I suspected `v4l2` itself was zero. If that's the case, accessing `v4l2->users` or `v4l2->norm` at the very next memory address within the page should trigger a crash, and I have to find the source. But this is where it got weird. The crash report said a dereference occurred later in `norm_maxh`, and I could see the crash was in the same page. So the first pointer check at `v4l2->users` couldn't have caused the error. But how?
I went back and checked the assembly. It seems to be checking the KASAN shadow memory for `0x1aa0` and there was no check at `0x1a88`. The immediate thought was that `%rbp` was not equivalent to the pointer. But the function `norm_maxh` accesses a variable declared on the stack, which is likely `%rbp`. So `rbp` does equal `v4l2`! But how does `%rbp` end up being 0? If `v4l2` was null at the start, there would have been an error at `v4l2->users`, not the next memory location within the same page.
I started digging into how `v4l2` could change. I checked `em28xx_free_v4l2`, `em28xx_v4l2_init` and their call sites. The code holds `dev->lock`, which means concurrent access should not be the issue, as well as `kref_put`. I could not see any way that `dev->v4l2` could be updated to `NULL` to cause the crash. I kept thinking of `em28xx_resolution_set`, `struct em28xx_v4l2 *v4l2 = dev->v4l2;`. The assembly shows the important dereference. I found that I could not find a place where `dev->v4l2` could change mid-execution of the critical section. So there was no way that `dev->v4l2` can be changed to NULL. Then the program must be starting with it as `NULL`. But the program is clearly checking `v4l2->users`, which should cause a crash if it is null at that point!
I considered that `v4l2->users` was optimized out. No, it is part of an `if` statement. But, SMAP and KASAN were enabled, which *should* trap an invalid address! If the kernel reads user-space memory, that would explain `0`. But that doesn't explain the KASAN report, which specifies the offset of the KASAN shadow memory, which should be within kernel space. It wouldn't crash there.
Then I realized that `v4l2` is NOT necessarily `0`. And `v4l2->users` is not necessarily at `0x1a88` if `v4l2` is not null. It's an instance. The `v4l2_fh_open` function is called and uses `filp`. This `filp` can be cast to `vdev` which is part of the `struct em28xx_v4l2`. I can't dereference `vdev` because it can come from anywhere. The driver registers `vdev`. So `dev` must be valid, and the `v4l2` pointer comes from that driver registration and open. Thus, if `vdev` is valid, `v4l2` must be a valid pointer. So `dev->v4l2` starts valid and is passed. But the crash still occurs within the same page. So `v4l2` cannot be set to NULL.
At this point, I'm stuck. It *looks* like `v4l2` is valid at the start but becomes zero *somehow* before
|
| 50/2 |
2026/05/19 14:11 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/media/usb/em28xx/em28xx-video.c IncludeLines:true Name:em28xx_v4l2_init]
Results: map[SourceCode:2510: static int em28xx_v4l2_init(struct em28xx *dev)
2511: {
2512: u8 val;
2513: int ret;
2514: unsigned int maxw;
2515: struct v4l2_ctrl_handler *hdl;
2516: struct em28xx_v4l2 *v4l2;
2517:
2518: if (dev->is_audio_only) {
2519: /* Shouldn't initialize IR for this interface */
2520: return 0;
2521: }
2522:
2523: if (!dev->has_video) {
2524: /* This device does not support the v4l2 extension */
2525: return 0;
2526: }
2527:
2528: dev_info(&dev->intf->dev, "Registering V4L2 extension\n");
2529:
2530: mutex_lock(&dev->lock);
2531:
2532: v4l2 = kzalloc_obj(*v4l2);
2533: if (!v4l2) {
2534: mutex_unlock(&dev->lock);
2535: return -ENOMEM;
2536: }
2537: kref_init(&v4l2->ref);
2538: v4l2->dev = dev;
2539: dev->v4l2 = v4l2;
2540:
2541: #ifdef CONFIG_MEDIA_CONTROLLER
2542: v4l2->v4l2_dev.mdev = dev->media_dev;
2543: #endif
2544: ret = v4l2_device_register(&dev->intf->dev, &v4l2->v4l2_dev);
2545: if (ret < 0) {
2546: dev_err(&dev->intf->dev,
2547: "Call to v4l2_device_register() failed!\n");
2548: goto err;
2549: }
2550:
2551: hdl = &v4l2->ctrl_handler;
2552: v4l2_ctrl_handler_init(hdl, 8);
2553: v4l2->v4l2_dev.ctrl_handler = hdl;
2554:
2555: if (dev->is_webcam)
2556: v4l2->progressive = true;
2557:
2558: /*
2559: * Default format, used for tvp5150 or saa711x output formats
2560: */
2561: v4l2->vinmode = EM28XX_VINMODE_YUV422_CbYCrY;
2562: v4l2->vinctl = EM28XX_VINCTRL_INTERLACED |
2563: EM28XX_VINCTRL_CCIR656_ENABLE;
2564:
2565: /* request some modules */
2566:
2567: if (dev->has_msp34xx)
2568: v4l2_i2c_new_subdev(&v4l2->v4l2_dev,
2569: &dev->i2c_adap[dev->def_i2c_bus],
2570: "msp3400", 0, msp3400_addrs);
2571:
2572: if (dev->board.decoder == EM28XX_SAA711X)
2573: v4l2_i2c_new_subdev(&v4l2->v4l2_dev,
2574: &dev->i2c_adap[dev->def_i2c_bus],
2575: "saa7115_auto", 0, saa711x_addrs);
2576:
2577: if (dev->board.decoder == EM28XX_TVP5150)
2578: v4l2_i2c_new_subdev(&v4l2->v4l2_dev,
2579: &dev->i2c_adap[dev->def_i2c_bus],
2580: "tvp5150", 0, tvp5150_addrs);
2581:
2582: if (dev->board.adecoder == EM28XX_TVAUDIO)
2583: v4l2_i2c_new_subdev(&v4l2->v4l2_dev,
2584: &dev->i2c_adap[dev->def_i2c_bus],
2585: "tvaudio", dev->board.tvaudio_addr, NULL);
2586:
2587: /* Initialize tuner and camera */
2588:
2589: if (dev->board.tuner_type != TUNER_ABSENT) {
2590: unsigned short tuner_addr = dev->board.tuner_addr;
2591: int has_demod = (dev->board.tda9887_conf & TDA9887_PRESENT);
2592:
2593: if (dev->board.radio.type)
2594: v4l2_i2c_new_subdev(&v4l2->v4l2_dev,
2595: &dev->i2c_adap[dev->def_i2c_bus],
2596: "tuner", dev->board.radio_addr,
2597: NULL);
2598:
2599: if (has_demod)
2600: v4l2_i2c_new_subdev(&v4l2->v4l2_dev,
2601: &dev->i2c_adap[dev->def_i2c_bus],
2602: "tuner", 0,
2603: v4l2_i2c_tuner_addrs(ADDRS_DEMOD));
2604: if (tuner_addr == 0) {
2605: enum v4l2_i2c_tuner_type type =
2606: has_demod ? ADDRS_TV_WITH_DEMOD : ADDRS_TV;
2607: struct v4l2_subdev *sd;
2608:
2609: sd = v4l2_i2c_new_subdev(&v4l2->v4l2_dev,
2610: &dev->i2c_adap[dev->def_i2c_bus],
2611: "tuner", 0,
2612: v4l2_i2c_tuner_addrs(type));
2613:
2614: if (sd)
2615: tuner_addr = v4l2_i2c_subdev_addr(sd);
2616: } else {
2617: v4l2_i2c_new_subdev(&v4l2->v4l2_dev,
2618: &dev->i2c_adap[dev->def_i2c_bus],
2619: "tuner", tuner_addr, NULL);
2620: }
2621:
2622: em28xx_tuner_setup(dev, tuner_addr);
2623: }
2624:
2625: if (dev->em28xx_sensor != EM28XX_NOSENSOR)
2626: em28xx_init_camera(dev);
2627:
2628: /* Configure audio */
2629: ret = em28xx_audio_setup(dev);
2630: if (ret < 0) {
2631: dev_err(&dev->intf->dev,
2632: "%s: Error while setting audio - error [%d]!\n",
2633: __func__, ret);
2634: goto unregister_dev;
2635: }
2636: if (dev->audio_mode.ac97 != EM28XX_NO_AC97) {
2637: v4l2_ctrl_new_std(hdl, &em28xx_ctrl_ops,
2638: V4L2_CID_AUDIO_MUTE, 0, 1, 1, 1);
2639: v4l2_ctrl_new_std(hdl, &em28xx_ctrl_ops,
2640: V4L2_CID_AUDIO_VOLUME, 0, 0x1f, 1, 0x1f);
2641: } else {
2642: /* install the em28xx notify callback */
2643: v4l2_ctrl_notify(v4l2_ctrl_find(hdl, V4L2_CID_AUDIO_MUTE),
2644: em28xx_ctrl_notify, dev);
2645: v4l2_ctrl_notify(v4l2_ctrl_find(hdl, V4L2_CID_AUDIO_VOLUME),
2646: em28xx_ctrl_notify, dev);
2647: }
2648:
2649: /* wake i2c devices */
2650: em28xx_wake_i2c(dev);
2651:
2652: /* init video dma queues */
2653: INIT_LIST_HEAD(&dev->vidq.active);
2654: INIT_LIST_HEAD(&dev->vbiq.active);
2655:
2656: if (dev->has_msp34xx) {
2657: /* Send a reset to other chips via gpio */
2658: ret = em28xx_write_reg(dev, EM2820_R08_GPIO_CTRL, 0xf7);
2659: if (ret < 0) {
2660: dev_err(&dev->intf->dev,
2661: "%s: em28xx_write_reg - msp34xx(1) failed! error [%d]\n",
2662: __func__, ret);
2663: goto unregister_dev;
2664: }
2665: usleep_range(10000, 11000);
2666:
2667: ret = em28xx_write_reg(dev, EM2820_R08_GPIO_CTRL, 0xff);
2668: if (ret < 0) {
2669: dev_err(&dev->intf->dev,
2670: "%s: em28xx_write_reg - msp34xx(2) failed! error [%d]\n",
2671: __func__, ret);
2672: goto unregister_dev;
2673: }
2674: usleep_range(10000, 11000);
2675: }
2676:
2677: /* set default norm */
2678: v4l2->norm = V4L2_STD_PAL;
2679: v4l2_device_call_all(&v4l2->v4l2_dev, 0, video, s_std, v4l2->norm);
2680: v4l2->interlaced_fieldmode = EM28XX_INTERLACED_DEFAULT;
2681:
2682: /* Analog specific initialization */
2683: v4l2->format = &format[0];
2684:
2685: maxw = norm_maxw(dev);
2686: /*
2687: * MaxPacketSize for em2800 is too small to capture at full resolution
2688: * use half of maxw as the scaler can only scale to 50%
2689: */
2690: if (dev->board.is_em2800)
2691: maxw /= 2;
2692:
2693: em28xx_set_video_format(dev, format[0].fourcc,
2694: maxw, norm_maxh(dev));
2695:
2696: video_mux(dev, 0);
2697:
2698: /* Audio defaults */
2699: dev->mute = 1;
2700: dev->volume = 0x1f;
2701:
2702: /* em28xx_write_reg(dev, EM28XX_R0E_AUDIOSRC, 0xc0); audio register */
2703: val = (u8)em28xx_read_reg(dev, EM28XX_R0F_XCLK);
2704: em28xx_write_reg(dev, EM28XX_R0F_XCLK,
2705: (EM28XX_XCLK_AUDIO_UNMUTE | val));
2706:
2707: em28xx_set_outfmt(dev);
2708:
2709: /* Add image controls */
2710:
2711: /*
2712: * NOTE: at this point, the subdevices are already registered, so
2713: * bridge controls are only added/enabled when no subdevice provides
2714: * them
2715: */
2716: if (!v4l2_ctrl_find(hdl, V4L2_CID_CONTRAST))
2717: v4l2_ctrl_new_std(hdl, &em28xx_ctrl_ops,
2718: V4L2_CID_CONTRAST,
2719: 0, 0x1f, 1, CONTRAST_DEFAULT);
2720: if (!v4l2_ctrl_find(hdl, V4L2_CID_BRIGHTNESS))
2721: v4l2_ctrl_new_std(hdl, &em28xx_ctrl_ops,
2722: V4L2_CID_BRIGHTNESS,
2723: -0x80, 0x7f, 1, BRIGHTNESS_DEFAULT);
2724: if (!v4l2_ctrl_find(hdl, V4L2_CID_SATURATION))
2725: v4l2_ctrl_new_std(hdl, &em28xx_ctrl_ops,
2726: V4L2_CID_SATURATION,
2727: 0, 0x1f, 1, SATURATION_DEFAULT);
2728: if (!v4l2_ctrl_find(hdl, V4L2_CID_BLUE_BALANCE))
2729: v4l2_ctrl_new_std(hdl, &em28xx_ctrl_ops,
2730: V4L2_CID_BLUE_BALANCE,
2731: -0x30, 0x30, 1, BLUE_BALANCE_DEFAULT);
2732: if (!v4l2_ctrl_find(hdl, V4L2_CID_RED_BALANCE))
2733: v4l2_ctrl_new_std(hdl, &em28xx_ctrl_ops,
2734: V4L2_CID_RED_BALANCE,
2735: -0x30, 0x30, 1, RED_BALANCE_DEFAULT);
2736: if (!v4l2_ctrl_find(hdl, V4L2_CID_SHARPNESS))
2737: v4l2_ctrl_new_std(hdl, &em28xx_ctrl_ops,
2738: V4L2_CID_SHARPNESS,
2739: 0, 0x0f, 1, SHARPNESS_DEFAULT);
2740:
2741: /* Reset image controls */
2742: em28xx_colorlevels_set_default(dev);
2743: v4l2_ctrl_handler_setup(hdl);
2744: ret = hdl->error;
2745: if (ret)
2746: goto unregister_dev;
2747:
2748: /* allocate and fill video video_device struct */
2749: em28xx_vdev_init(dev, &v4l2->vdev, &em28xx_video_template, "video");
2750: mutex_init(&v4l2->vb_queue_lock);
2751: mutex_init(&v4l2->vb_vbi_queue_lock);
2752: v4l2->vdev.queue = &v4l2->vb_vidq;
2753: v4l2->vdev.queue->lock = &v4l2->vb_queue_lock;
2754: v4l2->vdev.device_caps = V4L2_CAP_READWRITE | V4L2_CAP_VIDEO_CAPTURE |
2755: V4L2_CAP_STREAMING;
2756: if (dev->int_audio_type != EM28XX_INT_AUDIO_NONE)
2757: v4l2->vdev.device_caps |= V4L2_CAP_AUDIO;
2758: if (dev->tuner_type != TUNER_ABSENT)
2759: v4l2->vdev.device_caps |= V4L2_CAP_TUNER;
2760:
2761:
2762: /* disable inapplicable ioctls */
2763: if (dev->is_webcam) {
2764: v4l2_disable_ioctl(&v4l2->vdev, VIDIOC_QUERYSTD);
2765: v4l2_disable_ioctl(&v4l2->vdev, VIDIOC_G_STD);
2766: v4l2_disable_ioctl(&v4l2->vdev, VIDIOC_S_STD);
2767: } else {
2768: v4l2_disable_ioctl(&v4l2->vdev, VIDIOC_S_PARM);
2769: }
2770: if (dev->tuner_type == TUNER_ABSENT) {
2771: v4l2_disable_ioctl(&v4l2->vdev, VIDIOC_G_TUNER);
2772: v4l2_disable_ioctl(&v4l2->vdev, VIDIOC_S_TUNER);
2773: v4l2_disable_ioctl(&v4l2->vdev, VIDIOC_G_FREQUENCY);
2774: v4l2_disable_ioctl(&v4l2->vdev, VIDIOC_S_FREQUENCY);
2775: }
2776: if (dev->int_audio_type == EM28XX_INT_AUDIO_NONE) {
2777: v4l2_disable_ioctl(&v4l2->vdev, VIDIOC_G_AUDIO);
2778: v4l2_disable_ioctl(&v4l2->vdev, VIDIOC_S_AUDIO);
2779: }
2780:
2781: /* register v4l2 video video_device */
2782: ret = video_register_device(&v4l2->vdev, VFL_TYPE_VIDEO,
2783: video_nr[dev->devno]);
2784: if (ret) {
2785: dev_err(&dev->intf->dev,
2786: "unable to register video device (error=%i).\n", ret);
2787: goto unregister_dev;
2788: }
2789:
2790: /* Allocate and fill vbi video_device struct */
2791: if (em28xx_vbi_supported(dev) == 1) {
2792: em28xx_vdev_init(dev, &v4l2->vbi_dev, &em28xx_video_template,
2793: "vbi");
2794:
2795: v4l2->vbi_dev.queue = &v4l2->vb_vbiq;
2796: v4l2->vbi_dev.queue->lock = &v4l2->vb_vbi_queue_lock;
2797: v4l2->vbi_dev.device_caps = V4L2_CAP_STREAMING |
2798: V4L2_CAP_READWRITE | V4L2_CAP_VBI_CAPTURE;
2799: if (dev->tuner_type != TUNER_ABSENT)
2800: v4l2->vbi_dev.device_caps |= V4L2_CAP_TUNER;
2801:
2802: /* disable inapplicable ioctls */
2803: v4l2_disable_ioctl(&v4l2->vbi_dev, VIDIOC_S_PARM);
2804: if (dev->tuner_type == TUNER_ABSENT) {
2805: v4l2_disable_ioctl(&v4l2->vbi_dev, VIDIOC_G_TUNER);
2806: v4l2_disable_ioctl(&v4l2->vbi_dev, VIDIOC_S_TUNER);
2807: v4l2_disable_ioctl(&v4l2->vbi_dev, VIDIOC_G_FREQUENCY);
2808: v4l2_disable_ioctl(&v4l2->vbi_dev, VIDIOC_S_FREQUENCY);
2809: }
2810: if (dev->int_audio_type == EM28XX_INT_AUDIO_NONE) {
2811: v4l2_disable_ioctl(&v4l2->vbi_dev, VIDIOC_G_AUDIO);
2812: v4l2_disable_ioctl(&v4l2->vbi_dev, VIDIOC_S_AUDIO);
2813: }
2814:
2815: /* register v4l2 vbi video_device */
2816: ret = video_register_device(&v4l2->vbi_dev, VFL_TYPE_VBI,
2817: vbi_nr[dev->devno]);
2818: if (ret < 0) {
2819: dev_err(&dev->intf->dev,
2820: "unable to register vbi device\n");
2821: goto unregister_dev;
2822: }
2823: }
2824:
2825: if (em28xx_boards[dev->model].radio.type == EM28XX_RADIO) {
2826: em28xx_vdev_init(dev, &v4l2->radio_dev, &em28xx_radio_template,
2827: "radio");
2828: v4l2->radio_dev.device_caps = V4L2_CAP_RADIO | V4L2_CAP_TUNER;
2829: ret = video_register_device(&v4l2->radio_dev, VFL_TYPE_RADIO,
2830: radio_nr[dev->devno]);
2831: if (ret < 0) {
2832: dev_err(&dev->intf->dev,
2833: "can't register radio device\n");
2834: goto unregister_dev;
2835: }
2836: dev_info(&dev->intf->dev,
2837: "Registered radio device as %s\n",
2838: video_device_node_name(&v4l2->radio_dev));
2839: }
2840:
2841: /* Init entities at the Media Controller */
2842: em28xx_v4l2_create_entities(dev);
2843:
2844: #ifdef CONFIG_MEDIA_CONTROLLER
2845: ret = v4l2_mc_create_media_graph(dev->media_dev);
2846: if (ret) {
2847: dev_err(&dev->intf->dev,
2848: "failed to create media graph\n");
2849: em28xx_v4l2_media_release(dev);
2850: goto unregister_dev;
2851: }
2852: #endif
2853:
2854: dev_info(&dev->intf->dev,
2855: "V4L2 video device registered as %s\n",
2856: video_device_node_name(&v4l2->vdev));
2857:
2858: if (video_is_registered(&v4l2->vbi_dev))
2859: dev_info(&dev->intf->dev,
2860: "V4L2 VBI device registered as %s\n",
2861: video_device_node_name(&v4l2->vbi_dev));
2862:
2863: /* Save some power by putting tuner to sleep */
2864: v4l2_device_call_all(&v4l2->v4l2_dev, 0, tuner, standby);
2865:
2866: /* initialize videobuf2 stuff */
2867: em28xx_vb2_setup(dev);
2868:
2869: dev_info(&dev->intf->dev,
2870: "V4L2 extension successfully initialized\n");
2871:
2872: kref_get(&dev->ref);
2873:
2874: mutex_unlock(&dev->lock);
2875: return 0;
2876:
2877: unregister_dev:
2878: if (video_is_registered(&v4l2->radio_dev)) {
2879: dev_info(&dev->intf->dev,
2880: "V4L2 device %s deregistered\n",
2881: video_device_node_name(&v4l2->radio_dev));
2882: video_unregister_device(&v4l2->radio_dev);
2883: }
2884: if (video_is_registered(&v4l2->vbi_dev)) {
2885: dev_info(&dev->intf->dev,
2886: "V4L2 device %s deregistered\n",
2887: video_device_node_name(&v4l2->vbi_dev));
2888: video_unregister_device(&v4l2->vbi_dev);
2889: }
2890: if (video_is_registered(&v4l2->vdev)) {
2891: dev_info(&dev->intf->dev,
2892: "V4L2 device %s deregistered\n",
2893: video_device_node_name(&v4l2->vdev));
2894: video_unregister_device(&v4l2->vdev);
2895: }
2896:
2897: v4l2_ctrl_handler_free(&v4l2->ctrl_handler);
2898: v4l2_device_unregister(&v4l2->v4l2_dev);
2899: err:
2900: dev->v4l2 = NULL;
2901: kref_put(&v4l2->ref, em28xx_free_v4l2);
2902: mutex_unlock(&dev->lock);
2903: return ret;
2904: }
SourceFile:drivers/media/usb/em28xx/em28xx-video.c]
|
| 51/2 |
2026/05/19 14:11 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 71491
output: 25
thoughts: 3722
Thoughts: **Analysis of a Race Condition in the em28xx Video Driver**
Okay, here's the breakdown of what I've found. This looks like a nasty race condition in the em28xx video driver. The core problem revolves around the lifecycle of the `em28xx_v4l2` structure, its associated video device registration, and the interaction with user-space.
Essentially, `video_register_device` succeeds, creating a `/dev/videoX` node. Then, `em28xx_v4l2_init` attempts to initialize things. If it fails *after* registration but *before* fully initializing, it unregisters the device and frees the `em28xx_v4l2` struct. Crucially, the unregistration process does *not* immediately destroy the file. However, `video_unregister_device` sets `dev->v4l2 = NULL` which is essential to the vulnerability.
Now, a race becomes possible: user-space could potentially open `/dev/videoX` *after* `video_register_device` but *before* the driver cleans up on the error path (the `err:` label). The `open()` syscall attempts to call `em28xx_v4l2_open`.
Here's where it gets interesting:
1. `em28xx_v4l2_open` *reads* `dev->v4l2` (call it `v4l2`), but *before* acquiring `dev->lock`.
2. `em28xx_v4l2_open` acquires `dev->lock`.
3. The *initialization* can fail, freeing `v4l2`, setting `dev->v4l2 = NULL`, and releasing `dev->lock` *before* `em28xx_v4l2_open` is completed.
Now, `em28xx_v4l2_open` wakes up, *still* holding `dev->lock` and proceeds with `v4l2->users == 0`. It checks the now invalid pointer `v4l2`.
Here's the problem: The compiler initially reads `dev->v4l2` into a local variable *once*. However, `em28xx_v4l2_open` calls an *external* function, `em28xx_resolution_set`, which subsequently *re-reads* `dev->v4l2`. So:
1. `em28xx_v4l2_open` reads `dev->v4l2` which is valid at that time.
2. It then calls `em28xx_resolution_set`, which then reads `dev->v4l2`.
3. `em28xx_resolution_set` gets `NULL` for `dev->v4l2` which crashes.
The crash happens in `em28xx_resolution_set` because it's re-reading `dev->v4l2` *after* the cleanup has occurred, therefore it is a `NULL` pointer.
|
| 52/2 |
2026/05/19 14:12 |
tool |
grepper |
0m
Args: map[Expression:kref_put.*v4l2->ref]
Results: map[Output:drivers/media/usb/em28xx/em28xx-video.c=2194=static int em28xx_v4l2_fini(struct em28xx *dev)
--
drivers/media/usb/em28xx/em28xx-video.c-2239-
drivers/media/usb/em28xx/em28xx-video.c:2240: kref_put(&v4l2->ref, em28xx_free_v4l2);
drivers/media/usb/em28xx/em28xx-video.c-2241-
--
drivers/media/usb/em28xx/em28xx-video.c=2280=static int em28xx_v4l2_close(struct file *filp)
--
drivers/media/usb/em28xx/em28xx-video.c-2315- v4l2->users--;
drivers/media/usb/em28xx/em28xx-video.c:2316: kref_put(&v4l2->ref, em28xx_free_v4l2);
drivers/media/usb/em28xx/em28xx-video.c-2317- mutex_unlock(&dev->lock);
--
drivers/media/usb/em28xx/em28xx-video.c=2510=static int em28xx_v4l2_init(struct em28xx *dev)
--
drivers/media/usb/em28xx/em28xx-video.c-2900- dev->v4l2 = NULL;
drivers/media/usb/em28xx/em28xx-video.c:2901: kref_put(&v4l2->ref, em28xx_free_v4l2);
drivers/media/usb/em28xx/em28xx-video.c-2902- mutex_unlock(&dev->lock);
]
|
| 53/2 |
2026/05/19 14:12 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 76422
output: 59
thoughts: 5448
Thoughts: **A Deep Dive into a V4L2 Driver Race Condition**
Okay, so I've been wrestling with this crash report, and it seems like we have a pretty nasty race condition in the `em28xx` V4L2 driver. The core of it revolves around a null pointer dereference, specifically when the driver is initialized, then uninitialized, and concurrently accessed through user-space.
Here's the breakdown: The code attempts to open a V4L2 device, `em28xx_v4l2_open`, but under specific circumstances, the `dev->v4l2` pointer, which should point to a `struct em28xx_v4l2`, ends up as `NULL`. This is the key.
The usual path for this driver involves initialization (`em28xx_v4l2_init`), which involves registering video devices (`vdev`, `vbi_dev`). The crash happens because of the call to VBI registration failing. During VBI registration, the `video_register_device` function returns an error, the code in `em28xx_v4l2_init` will call the `unregister_dev` label and free all related resources. The problem is concurrent access. If the VBI registration fails, the driver calls `video_unregister_device` and sets `dev->v4l2 = NULL` and frees it. However, if user-space calls `open()` at the same time, a race ensues. User-space attempts to open the driver `/dev/videoX`. It finds the cdev, and it calls `em28xx_v4l2_open` function. If it calls `em28xx_v4l2_open` after `dev->v4l2 = NULL` has been set, but before the cdev has been completely removed. It crashes.
Here's where the debugging gets tricky. I initially thought it was a use-after-free, but the KASAN report and crash report points to `0x1aa0` and then `0x1a88`, but not because of freed memory. The report tells the story:
1. **Race Condition:** There's a race between `em28xx_v4l2_init` unregistering the device and user-space attempting to open it via `/dev/videoX`.
2. **`dev->v4l2` is `NULL`:** If user-space `open()`s the device *after* `dev->v4l2` has been set to `NULL` but before unregistration is fully complete, then within `em28xx_v4l2_open`, the read of `struct em28xx_v4l2 *v4l2 = dev->v4l2;` results in `v4l2` being `NULL`.
3. **Null Pointer Dereference:** Later access to `v4l2->users` becomes a null pointer dereference.
4. **KASAN's Role:** The KASAN report reveals that the crash occurred on `0x1aa0` and `0x1a88`. It checks the KASAN shadow memory at the corresponding address to catch the error. But it reports a "non-canonical address" at the shadow memory address.
5. **Fixing the Error:** The driver should serialize access to `dev->v4l2` and should handle errors within `em28xx_v4l2_init` more gracefully to prevent this race.
|
| 54/2 |
2026/05/19 14:12 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/media/usb/em28xx/em28xx-video.c IncludeLines:true Name:em28xx_v4l2_open]
Results: map[SourceCode:2121: /*
2122: * em28xx_v4l2_open()
2123: * inits the device and starts isoc transfer
2124: */
2125: static int em28xx_v4l2_open(struct file *filp)
2126: {
2127: struct video_device *vdev = video_devdata(filp);
2128: struct em28xx *dev = video_drvdata(filp);
2129: struct em28xx_v4l2 *v4l2 = dev->v4l2;
2130: enum v4l2_buf_type fh_type = 0;
2131: int ret;
2132:
2133: switch (vdev->vfl_type) {
2134: case VFL_TYPE_VIDEO:
2135: fh_type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
2136: break;
2137: case VFL_TYPE_VBI:
2138: fh_type = V4L2_BUF_TYPE_VBI_CAPTURE;
2139: break;
2140: case VFL_TYPE_RADIO:
2141: break;
2142: default:
2143: return -EINVAL;
2144: }
2145:
2146: em28xx_videodbg("open dev=%s type=%s users=%d\n",
2147: video_device_node_name(vdev), v4l2_type_names[fh_type],
2148: v4l2->users);
2149:
2150: if (mutex_lock_interruptible(&dev->lock))
2151: return -ERESTARTSYS;
2152:
2153: ret = v4l2_fh_open(filp);
2154: if (ret) {
2155: dev_err(&dev->intf->dev,
2156: "%s: v4l2_fh_open() returned error %d\n",
2157: __func__, ret);
2158: mutex_unlock(&dev->lock);
2159: return ret;
2160: }
2161:
2162: if (v4l2->users == 0) {
2163: em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
2164:
2165: if (vdev->vfl_type != VFL_TYPE_RADIO)
2166: em28xx_resolution_set(dev);
2167:
2168: /*
2169: * Needed, since GPIO might have disabled power
2170: * of some i2c devices
2171: */
2172: em28xx_wake_i2c(dev);
2173: }
2174:
2175: if (vdev->vfl_type == VFL_TYPE_RADIO) {
2176: em28xx_videodbg("video_open: setting radio device\n");
2177: v4l2_device_call_all(&v4l2->v4l2_dev, 0, tuner, s_radio);
2178: }
2179:
2180: kref_get(&dev->ref);
2181: kref_get(&v4l2->ref);
2182: v4l2->users++;
2183:
2184: mutex_unlock(&dev->lock);
2185:
2186: return 0;
2187: }
SourceFile:drivers/media/usb/em28xx/em28xx-video.c]
|
| 55/2 |
2026/05/19 14:12 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 83761
output: 23
thoughts: 4924
Thoughts: **A Deep Dive into a Kernel Crash: The Curious Case of the NULL Pointer Dereference**
Okay, here's the breakdown of my thought process as I've been wrestling with this bug. It seems like we have a really tricky NULL pointer dereference situation. The code is checking a `v4l2` struct, and it *should* crash if `v4l2` is `NULL`. The crash isn't happening in the expected location, and that's what's got me scratching my head.
My initial thought was that somehow `v4l2` could be `NULL` when checked, but that the compiler was re-reading the value and it became `NULL` later. But, the lock in place meant that was unlikely. The core of the problem stems from the fact the code reads the pointer at different times, in different functions, which are protected by a mutex, but the NULL check does not cover all the code.
The crash happens when dereferencing `v4l2->norm`, which means `v4l2` is `NULL` there. However, the code *should* have crashed when accessing `v4l2->users` if it was indeed `NULL`. Then it clicked: the key to understanding this is figuring out *how* `dev->v4l2` becomes `NULL` at the time of dereference.
I went line-by-line in the code to check if any of the function calls inside the mutex could modify `dev->v4l2` without holding the mutex. I carefully examined `em28xx_v4l2_init`, `em28xx_v4l2_fini`, `em28xx_v4l2_close`, and the `kref_put` operations. After thoroughly checking all possible points, nothing could change `dev->v4l2` between the check and use, because it *should* be protected by `dev->lock`.
Then I began to ponder the unlikely: maybe the address isn't NULL, and the crash is happening in a totally unexpected way. But that didn't make sense since the RIP pointed directly to the `norm_maxh` instruction.
Then a crucial realization came: *syzkaller* is used in the crash report. This made me consider how syzkaller maps memory. I started to wonder if the crash *isn't* a classic kernel NULL pointer dereference, but rather an *invalid* pointer dereference, where the memory address is mapped in userspace. Could it be that the crash stems from `v4l2->users` being mapped? If `0x1a88` is mapped in userspace, accessing it doesn't immediately crash. But, the KASAN (Kernel Address Sanitizer) shadow memory should catch this! Shadow memory accesses *should* crash, even if the memory is mapped, but that wasn't happening!
Digging deeper, I examined the assembly of `em28xx_resolution_set`, and it all started to make sense. It *was* the KASAN check for `v4l2->norm` that was triggering the crash.
My hypothesis is now this: There's a race condition between initializing the `v4l2` struct and opening the `/dev/videoX` device. If the initialization fails *after* registering the video device, then `dev->v4l2` is set to NULL. Then the open happens and the access happens. Now that I know the location of the crash, the way to reproduce this bug should be clear. It seems we need to create a race between a disconnect and an open to hit the code when `dev->v4l2` is set to NULL. The KASAN check in `em28xx_resolution_set` is what's exposing the race.
|
| 56/2 |
2026/05/19 14:13 |
tool |
grepper |
0m
Args: map[Expression:USB_DEVICE.*0xeb1a]
Results: map[Output:drivers/media/usb/em28xx/em28xx-cards.c=2637=struct usb_device_id em28xx_id_table[] = {
drivers/media/usb/em28xx/em28xx-cards.c:2638: { USB_DEVICE(0xeb1a, 0x2750),
drivers/media/usb/em28xx/em28xx-cards.c-2639- .driver_info = EM2750_BOARD_UNKNOWN },
drivers/media/usb/em28xx/em28xx-cards.c:2640: { USB_DEVICE(0xeb1a, 0x2751),
drivers/media/usb/em28xx/em28xx-cards.c-2641- .driver_info = EM2750_BOARD_UNKNOWN },
drivers/media/usb/em28xx/em28xx-cards.c:2642: { USB_DEVICE(0xeb1a, 0x2800),
drivers/media/usb/em28xx/em28xx-cards.c-2643- .driver_info = EM2800_BOARD_UNKNOWN },
drivers/media/usb/em28xx/em28xx-cards.c:2644: { USB_DEVICE(0xeb1a, 0x2710),
drivers/media/usb/em28xx/em28xx-cards.c-2645- .driver_info = EM2820_BOARD_UNKNOWN },
drivers/media/usb/em28xx/em28xx-cards.c:2646: { USB_DEVICE(0xeb1a, 0x2820),
drivers/media/usb/em28xx/em28xx-cards.c-2647- .driver_info = EM2820_BOARD_UNKNOWN },
drivers/media/usb/em28xx/em28xx-cards.c:2648: { USB_DEVICE(0xeb1a, 0x2821),
drivers/media/usb/em28xx/em28xx-cards.c-2649- .driver_info = EM2820_BOARD_UNKNOWN },
drivers/media/usb/em28xx/em28xx-cards.c:2650: { USB_DEVICE(0xeb1a, 0x2860),
drivers/media/usb/em28xx/em28xx-cards.c-2651- .driver_info = EM2820_BOARD_UNKNOWN },
drivers/media/usb/em28xx/em28xx-cards.c:2652: { USB_DEVICE(0xeb1a, 0x2861),
drivers/media/usb/em28xx/em28xx-cards.c-2653- .driver_info = EM2820_BOARD_UNKNOWN },
drivers/media/usb/em28xx/em28xx-cards.c:2654: { USB_DEVICE(0xeb1a, 0x2862),
drivers/media/usb/em28xx/em28xx-cards.c-2655- .driver_info = EM2820_BOARD_UNKNOWN },
drivers/media/usb/em28xx/em28xx-cards.c:2656: { USB_DEVICE(0xeb1a, 0x2863),
drivers/media/usb/em28xx/em28xx-cards.c-2657- .driver_info = EM2820_BOARD_UNKNOWN },
drivers/media/usb/em28xx/em28xx-cards.c:2658: { USB_DEVICE(0xeb1a, 0x2870),
drivers/media/usb/em28xx/em28xx-cards.c-2659- .driver_info = EM2820_BOARD_UNKNOWN },
drivers/media/usb/em28xx/em28xx-cards.c:2660: { USB_DEVICE(0xeb1a, 0x2881),
drivers/media/usb/em28xx/em28xx-cards.c-2661- .driver_info = EM2820_BOARD_UNKNOWN },
drivers/media/usb/em28xx/em28xx-cards.c:2662: { USB_DEVICE(0xeb1a, 0x2883), /* used by :Zolid Hybrid Tv Stick */
drivers/media/usb/em28xx/em28xx-cards.c-2663- .driver_info = EM2820_BOARD_UNKNOWN },
drivers/media/usb/em28xx/em28xx-cards.c:2664: { USB_DEVICE(0xeb1a, 0x2868),
drivers/media/usb/em28xx/em28xx-cards.c-2665- .driver_info = EM2820_BOARD_UNKNOWN },
drivers/media/usb/em28xx/em28xx-cards.c:2666: { USB_DEVICE(0xeb1a, 0x2875),
drivers/media/usb/em28xx/em28xx-cards.c-2667- .driver_info = EM2820_BOARD_UNKNOWN },
drivers/media/usb/em28xx/em28xx-cards.c:2668: { USB_DEVICE(0xeb1a, 0x2885), /* MSI Digivox Trio */
drivers/media/usb/em28xx/em28xx-cards.c-2669- .driver_info = EM2884_BOARD_TERRATEC_H5 },
drivers/media/usb/em28xx/em28xx-cards.c:2670: { USB_DEVICE(0xeb1a, 0xe300),
drivers/media/usb/em28xx/em28xx-cards.c-2671- .driver_info = EM2861_BOARD_KWORLD_PVRTV_300U },
drivers/media/usb/em28xx/em28xx-cards.c:2672: { USB_DEVICE(0xeb1a, 0xe303),
drivers/media/usb/em28xx/em28xx-cards.c-2673- .driver_info = EM2860_BOARD_KAIOMY_TVNPC_U2 },
drivers/media/usb/em28xx/em28xx-cards.c:2674: { USB_DEVICE(0xeb1a, 0xe305),
drivers/media/usb/em28xx/em28xx-cards.c-2675- .driver_info = EM2880_BOARD_KWORLD_DVB_305U },
drivers/media/usb/em28xx/em28xx-cards.c:2676: { USB_DEVICE(0xeb1a, 0xe310),
drivers/media/usb/em28xx/em28xx-cards.c-2677- .driver_info = EM2880_BOARD_MSI_DIGIVOX_AD },
drivers/media/usb/em28xx/em28xx-cards.c:2678: { USB_DEVICE(0xeb1a, 0xa313),
drivers/media/usb/em28xx/em28xx-cards.c-2679- .driver_info = EM2882_BOARD_KWORLD_ATSC_315U },
drivers/media/usb/em28xx/em28xx-cards.c:2680: { USB_DEVICE(0xeb1a, 0xa316),
drivers/media/usb/em28xx/em28xx-cards.c-2681- .driver_info = EM2883_BOARD_KWORLD_HYBRID_330U },
drivers/media/usb/em28xx/em28xx-cards.c:2682: { USB_DEVICE(0xeb1a, 0xe320),
drivers/media/usb/em28xx/em28xx-cards.c-2683- .driver_info = EM2880_BOARD_MSI_DIGIVOX_AD_II },
drivers/media/usb/em28xx/em28xx-cards.c:2684: { USB_DEVICE(0xeb1a, 0xe323),
drivers/media/usb/em28xx/em28xx-cards.c-2685- .driver_info = EM2882_BOARD_KWORLD_VS_DVBT },
drivers/media/usb/em28xx/em28xx-cards.c:2686: { USB_DEVICE(0xeb1a, 0xe350),
drivers/media/usb/em28xx/em28xx-cards.c-2687- .driver_info = EM2870_BOARD_KWORLD_350U },
drivers/media/usb/em28xx/em28xx-cards.c:2688: { USB_DEVICE(0xeb1a, 0xe355),
drivers/media/usb/em28xx/em28xx-cards.c-2689- .driver_info = EM2870_BOARD_KWORLD_355U },
drivers/media/usb/em28xx/em28xx-cards.c:2690: { USB_DEVICE(0xeb1a, 0x2801),
drivers/media/usb/em28xx/em28xx-cards.c-2691- .driver_info = EM2800_BOARD_GRABBEEX_USB2800 },
drivers/media/usb/em28xx/em28xx-cards.c:2692: { USB_DEVICE(0xeb1a, 0xe357),
drivers/media/usb/em28xx/em28xx-cards.c-2693- .driver_info = EM2870_BOARD_KWORLD_355U },
drivers/media/usb/em28xx/em28xx-cards.c:2694: { USB_DEVICE(0xeb1a, 0xe359),
drivers/media/usb/em28xx/em28xx-cards.c-2695- .driver_info = EM2870_BOARD_KWORLD_355U },
--
drivers/media/usb/em28xx/em28xx-cards.c-2789- .driver_info = EM2820_BOARD_IODATA_GVMVP_SZ },
drivers/media/usb/em28xx/em28xx-cards.c:2790: { USB_DEVICE(0xeb1a, 0x50a6),
drivers/media/usb/em28xx/em28xx-cards.c-2791- .driver_info = EM2860_BOARD_GADMEI_UTV330 },
--
drivers/media/usb/em28xx/em28xx-cards.c-2805- .driver_info = EM2884_BOARD_C3TECH_DIGITAL_DUO },
drivers/media/usb/em28xx/em28xx-cards.c:2806: { USB_DEVICE(0xeb1a, 0x5006),
drivers/media/usb/em28xx/em28xx-cards.c-2807- .driver_info = EM2860_BOARD_HT_VIDBOX_NW03 },
--
drivers/media/usb/em28xx/em28xx-cards.c-2845- .driver_info = EM2861_BOARD_LEADTEK_VC100 },
drivers/media/usb/em28xx/em28xx-cards.c:2846: { USB_DEVICE(0xeb1a, 0x8179),
drivers/media/usb/em28xx/em28xx-cards.c-2847- .driver_info = EM28178_BOARD_TERRATEC_T2_STICK_HD },
--
drivers/media/usb/em28xx/em28xx-cards.c-2849- .driver_info = EM28178_BOARD_PLEX_PX_BCUD },
drivers/media/usb/em28xx/em28xx-cards.c:2850: { USB_DEVICE(0xeb1a, 0x5051), /* Ion Video 2 PC MKII / Startech svid2usb23 / Raygo R12-41373 */
drivers/media/usb/em28xx/em28xx-cards.c-2851- .driver_info = EM2860_BOARD_TVP5150_REFERENCE_DESIGN },
]
|
| 57/2 |
2026/05/19 14:13 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 92862
output: 20
thoughts: 213
Thoughts: **USB Device Interaction Plan**
Okay, so I'm thinking about how to interact with these USB devices. I've got two interesting addresses, `0xeb1a` and `0x2800`, that I want to utilize. My initial thought is to use `syz_usb_connect` to establish a connection with the device. Then, I'll leverage `openat$video` to try and open either `/dev/video0` or `/dev/video1`, assuming those are the appropriate device nodes.
Now, a key point to remember is how Syzkaller's concurrency works. If I write a program with `syz_usb_connect` and `openat$video` in it, Syzkaller should execute them concurrently, without any explicit `async` keywords, due to the underlying multi-threading capability. That's good, it streamlines the process.
Actually, if that is the case, then I can just structure a program to include `syz_usb_connect`, `openat$video` and `syz_usb_disconnect`. I can include that disconnect to tidy it up.
However, I'm slightly thrown that `syz_usb_disconnect` isn't a *standard* Syzkaller call. The system, theoretically, disconnects USB devices automatically when the program completes, but it would be cleaner to have it explicitly in the code. I need to check to see if `syz_usb_disconnect` is even defined. Let's see if that call exists first.
|
| 58/2 |
2026/05/19 14:13 |
tool |
grepper |
0m
Error:
Args: map[Expression:syz_usb_disconnect]
Results:
|
| 59/2 |
2026/05/19 14:13 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 93437
output: 19
thoughts: 29
Thoughts: Here's my take on the thought process, summarized as you requested:
**Navigating the USB Disconnect Issue**
Okay, so the breadcrumb I have is `syz_usb_disconnect` – interesting. Let's see... the text file that seems relevant here is definitely `vusb.txt`. Seems like a logical starting point to trace this disconnect function. I'll need to open that up and dive in to see what kind of details are included on it. I need to understand exactly where this call fits into the larger picture of the USB system within this context.
|
| 60/2 |
2026/05/19 14:13 |
tool |
read-description |
0m
Args:
Results: map[Output:# Copyright 2019 syzkaller project authors. All rights reserved.
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
include <linux/types.h>
include <linux/byteorder/generic.h>
include <uapi/linux/usb/ch9.h>
include <uapi/linux/usb/ch11.h>
include <uapi/linux/usb/midi.h>
include <uapi/linux/usb/audio.h>
include <linux/usb/audio-v2.h>
include <linux/usb/audio-v3.h>
include <uapi/linux/hid.h>
include <linux/hid.h>
include <uapi/linux/usb/cdc.h>
include <uapi/linux/if_ether.h>
include <linux/interrupt.h>
include <linux/usb/cdc_ncm.h>
include <drivers/net/usb/asix.h>
# This is a special fd for USB fuzzing and should only be used with syz_usb_* pseudo-syscalls.
# We don't inherit it from the fd resource, to discourage syzkaller calling raw ioctls on it.
resource fd_usb[int32]: -1
# These are generic pseudo-syscalls for emulating arbitrary USB devices.
# They are mostly targeted to cover the enumeration process.
syz_usb_connect(speed flags[usb_device_speed], dev_len len[dev], dev ptr[in, usb_device_descriptor], conn_descs ptr[in, vusb_connect_descriptors]) fd_usb (timeout[3000], prog_timeout[3000], remote_cover)
syz_usb_control_io(fd fd_usb, descs ptr[in, vusb_descriptors], resps ptr[in, vusb_responses]) (timeout[300], remote_cover)
syz_usb_ep_write(fd fd_usb, ep int8, len len[data], data ptr[in, array[int8, 0:256]]) (timeout[300], remote_cover)
syz_usb_ep_read(fd fd_usb, ep int8, len len[data], data buffer[out]) (timeout[300], remote_cover)
syz_usb_disconnect(fd fd_usb) (timeout[300], remote_cover)
usb_device_speed = USB_SPEED_UNKNOWN, USB_SPEED_LOW, USB_SPEED_FULL, USB_SPEED_HIGH, USB_SPEED_WIRELESS, USB_SPEED_SUPER, USB_SPEED_SUPER_PLUS
# TODO: consider patching idVendor and idProduct for all class specific descriptions in Go code to cover more drivers.
# TODO: custom syz_usb_ep_write() descriptions for all class specific descriptions.
# TODO: consider adding custom vusb_connect_descriptors definitions to all class specific descriptions.
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
type usb_device_descriptor_verbose_t[USB, CLASS, SUBCLASS, PROTOCOL, PACKET, VENDOR, PRODUCT, DEVICE, CFS] {
bLength const[USB_DT_DEVICE_SIZE, int8]
bDescriptorType const[USB_DT_DEVICE, int8]
bcdUSB USB
bDeviceClass const[CLASS, int8]
bDeviceSubClass const[SUBCLASS, int8]
bDeviceProtocol const[PROTOCOL, int8]
bMaxPacketSize0 PACKET
idVendor const[VENDOR, int16]
idProduct const[PRODUCT, int16]
bcdDevice const[DEVICE, int16]
iManufacturer const[1, int8]
iProduct const[2, int8]
iSerialNumber const[3, int8]
bNumConfigurations len[configs, int8]
configs CFS
} [packed]
type usb_device_descriptor_t[CLASS, SUBCLASS, PROTOCOL, VENDOR, PRODUCT, DEVICE, CFS] usb_device_descriptor_verbose_t[flags[usb_versions, int16], CLASS, SUBCLASS, PROTOCOL, flags[usb_device_max_packet_sizes, int8], VENDOR, PRODUCT, DEVICE, CFS]
type usb_device_descriptor_fixed_t[USB, CLASS, SUBCLASS, PROTOCOL, PACKET, VENDOR, PRODUCT, DEVICE, CFS] usb_device_descriptor_verbose_t[const[USB, int16], CLASS, SUBCLASS, PROTOCOL, const[PACKET, int8], VENDOR, PRODUCT, DEVICE, CFS]
usb_versions = 0x110, 0x200, 0x201, 0x250, 0x300, 0x310
# https://elixir.bootlin.com/linux/v5.1.7/source/drivers/usb/core/hub.c#L4661
usb_device_max_packet_sizes = 8, 16, 32, 64, 255
type usb_config_descriptor_verbose_t[NUM, IFSNUM, ICONFIG, ATTRS, POWER, EXTRA, IFS] {
bLength const[USB_DT_CONFIG_SIZE, int8]
bDescriptorType const[USB_DT_CONFIG, int8]
wTotalLength len[parent, int16]
bNumInterfaces IFSNUM
bConfigurationValue NUM
iConfiguration ICONFIG
bmAttributes ATTRS
bMaxPower POWER
extra EXTRA
interfaces IFS
} [packed]
type usb_config_descriptor_t[NUM, IFSNUM, IFS] usb_config_descriptor_verbose_t[NUM, IFSNUM, int8, flags[usb_config_attributes, int8], int8, void, IFS]
type usb_config_descriptor_ifaces_array_t[NUM, IFS] usb_config_descriptor_t[NUM, len[interfaces, int8], IFS]
type usb_config_descriptor_fixed_t[NUM, IFSNUM, ATTRS, POWER, IFS] usb_config_descriptor_verbose_t[const[NUM, int8], const[IFSNUM, int8], const[0, int8], const[ATTRS, int8], const[POWER, int8], void, IFS]
type usb_config_descriptor_extra_t[NUM, IFSNUM, EXTRA, IFS] usb_config_descriptor_verbose_t[NUM, IFSNUM, int8, flags[usb_config_attributes, int8], int8, EXTRA, IFS]
type usb_interface_descriptor_verbose_t[IFNUM, ALTNUM, EPSNUM, CLASS, SUBCLASS, PROTOCOL, IIF, EXTRA, EPS] {
bLength const[USB_DT_INTERFACE_SIZE, int8]
bDescriptorType const[USB_DT_INTERFACE, int8]
bInterfaceNumber IFNUM
bAlternateSetting ALTNUM
bNumEndpoints EPSNUM
bInterfaceClass CLASS
bInterfaceSubClass SUBCLASS
bInterfaceProtocol PROTOCOL
iInterface IIF
extra EXTRA
endpoints EPS
} [packed]
type usb_interface_descriptor_t[IFNUM, ALTNUM, EPSNUM, CLASS, SUBCLASS, PROTOCOL, EXTRA, EPS] usb_interface_descriptor_verbose_t[IFNUM, ALTNUM, EPSNUM, CLASS, SUBCLASS, PROTOCOL, int8, EXTRA, EPS]
type usb_interface_descriptor_eps_array_t[IFNUM, ALTNUM, CLASS, SUBCLASS, PROTOCOL, EXTRA, EPS] usb_interface_descriptor_t[IFNUM, ALTNUM, len[endpoints, int8], CLASS, SUBCLASS, PROTOCOL, EXTRA, EPS]
type usb_interface_descriptor_fixed_t[IFNUM, ALTNUM, EPSNUM, CLASS, SUBCLASS, PROTOCOL, EXTRA, EPS] usb_interface_descriptor_verbose_t[const[IFNUM, int8], const[ALTNUM, int8], const[EPSNUM, int8], const[CLASS, int8], const[SUBCLASS, int8], const[PROTOCOL, int8], const[0, int8], EXTRA, EPS]
# TODO: non-audio endpoints have USB_DT_ENDPOINT_SIZE.
type usb_endpoint_descriptor_verbose_t[ADDR, ATTRS, PACKET, INTERVAL, REFRESH, SYNCH, EXTRA] {
bLength const[USB_DT_ENDPOINT_AUDIO_SIZE, int8]
bDescriptorType const[USB_DT_ENDPOINT, int8]
bEndpointAddress ADDR
bmAttributes ATTRS
wMaxPacketSize PACKET
bInterval INTERVAL
bRefresh REFRESH
bSynchAddress SYNCH
extra EXTRA
} [packed]
type usb_endpoint_descriptor_t[ADDR, ATTRS, EXTRA] usb_endpoint_descriptor_verbose_t[ADDR, ATTRS, flags[usb_endpoint_max_packet_sizes, int16], int8, int8, int8, EXTRA]
type usb_endpoint_descriptor_fixed_t[ADDR, ATTRS, PACKET, INTERVAL, EXTRA] usb_endpoint_descriptor_verbose_t[const[ADDR, int8], const[ATTRS, int8], const[PACKET, int16], const[INTERVAL, int8], const[0, int8], const[0, int8], EXTRA]
# TODO: dummy driver has complex requirements for packet sizes, account for those:
# https://elixir.bootlin.com/linux/v5.3.6/source/drivers/usb/gadget/udc/dummy_hcd.c#L497
usb_endpoint_max_packet_sizes = 8, 16, 32, 64, 512, 1023, 1024
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Generic USB device, configuration, interface and endpoint descriptors.
# We only support one configuration per device.
# bDeviceClass, bDeviceSubClass, bDeviceProtocol, idVendor, idProduct
# and bcdDevice are patched by Go code, see sys/linux/init_vusb.go.
usb_device_descriptor {
inner usb_device_descriptor_t[0, 0, 0, 0, 0, 0, array[usb_config_descriptor, 1]]
} [packed]
usb_config_descriptor {
inner usb_config_descriptor_ifaces_array_t[int8, array[usb_interface_descriptor, 1:4]]
} [packed]
usb_config_attributes = USB_CONFIG_ATT_ONE, USB_CONFIG_ATT_SELFPOWER, USB_CONFIG_ATT_WAKEUP, USB_CONFIG_ATT_BATTERY
# bInterfaceNumber, bInterfaceClass, bInterfaceSubClass and bInterfaceProtocol
# are patched by Go code, see sys/linux/init_vusb.go.
usb_interface_descriptor {
inner usb_interface_descriptor_eps_array_t[int8, int8, const[0, int8], const[0, int8], const[0, int8], array[usb_interface_extra_descriptor, 0:2], array[usb_endpoint_descriptor, 0:16]]
} [packed]
usb_endpoint_descriptor {
inner usb_endpoint_descriptor_t[flags[usb_endpoint_addresses, int8], flags[usb_endpoint_attributes, int8], array[usb_endpoint_extra_descriptor, 0:2]]
} [packed]
usb_endpoint_addresses = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, USB_DIR_OUT, USB_DIR_IN
usb_endpoint_attributes = USB_ENDPOINT_XFER_CONTROL, USB_ENDPOINT_XFER_ISOC, USB_ENDPOINT_XFER_BULK, USB_ENDPOINT_XFER_INT, USB_ENDPOINT_INTR_PERIODIC, USB_ENDPOINT_INTR_NOTIFICATION, USB_ENDPOINT_SYNC_NONE, USB_ENDPOINT_SYNC_ASYNC, USB_ENDPOINT_SYNC_ADAPTIVE, USB_ENDPOINT_SYNC_SYNC, USB_ENDPOINT_USAGE_DATA, USB_ENDPOINT_USAGE_FEEDBACK, USB_ENDPOINT_USAGE_FEEDBACK
vusb_connect_descriptors {
qual_len len[qual, int32]
qual ptr[in, usb_qualifier_descriptor]
bos_len len[bos, int32]
bos ptr[in, usb_bos_descriptor]
strs_len len[strs, int32]
strs array[vusb_connect_string_descriptor]
} [packed]
vusb_connect_string_descriptor {
len len[str, int32]
str ptr[in, usb_string_descriptor]
} [packed]
vusb_descriptors {
len len[parent, int32]
generic ptr[in, vusb_descriptor_generic]
string ptr[in, vusb_descriptor_t[USB_TYPE_STANDARD, USB_DT_STRING, usb_string_descriptor]]
bos ptr[in, vusb_descriptor_t[USB_TYPE_STANDARD, USB_DT_BOS, usb_bos_descriptor]]
hub_hs ptr[in, vusb_descriptor_t[USB_TYPE_CLASS, USB_DT_HUB, usb_hub_descriptor_hs]]
hub_ss ptr[in, vusb_descriptor_t[USB_TYPE_CLASS, USB_DT_SS_HUB, usb_hub_descriptor_ss]]
} [packed]
vusb_descriptor_generic {
req_type flags[usb_request_types, int8]
desc_type flags[usb_descriptor_types, int8]
len bytesize[data, int32]
data usb_generic_descriptor
} [packed]
usb_request_types = USB_TYPE_STANDARD, USB_TYPE_CLASS, USB_TYPE_VENDOR
type vusb_descriptor_t[CLASS, REQ, DATA] {
type const[CLASS, int8]
req const[REQ, int8]
len bytesize[data, int32]
data DATA
} [packed]
# TODO: consider doing lookups based on USB_RECIP values.
vusb_responses {
len len[parent, int32]
generic ptr[in, vusb_response_generic]
get_interface ptr[in, vusb_response_t[USB_TYPE_STANDARD, USB_REQ_GET_INTERFACE, int8]]
get_configuration ptr[in, vusb_response_t[USB_TYPE_STANDARD, USB_REQ_GET_CONFIGURATION, int8]]
# TODO: move these into custom descriptions for hub class when they are added.
hub_USB_REQ_GET_STATUS_hub ptr[in, vusb_response_t[USB_TYPE_CLASS, USB_REQ_GET_STATUS, usb_hub_status]]
hub_USB_REQ_GET_STATUS_port ptr[in, vusb_response_t[USB_TYPE_CLASS, USB_REQ_GET_STATUS, usb_port_status]]
# TODO: move these into custom descriptions for asix driver when they are added.
asix_AX_CMD_READ_MII_REG ptr[in, vusb_response_t[USB_TYPE_VENDOR, AX_CMD_READ_MII_REG, int16]]
asix_AX_CMD_STATMNGSTS_REG ptr[in, vusb_response_t[USB_TYPE_VENDOR, AX_CMD_STATMNGSTS_REG, int8]]
asix_AX_CMD_READ_EEPROM ptr[in, vusb_response_t[USB_TYPE_VENDOR, AX_CMD_READ_EEPROM, array[int8, 2]]]
asix_AX_CMD_READ_RX_CTL ptr[in, vusb_response_t[USB_TYPE_VENDOR, AX_CMD_READ_RX_CTL, int16]]
asix_AX_CMD_READ_NODE_ID ptr[in, vusb_response_t[USB_TYPE_VENDOR, AX_CMD_READ_NODE_ID, mac_addr]]
asix_AX88172_CMD_READ_NODE_ID ptr[in, vusb_response_t[USB_TYPE_VENDOR, AX88172_CMD_READ_NODE_ID, mac_addr]]
asix_AX_CMD_READ_PHY_ID ptr[in, vusb_response_t[USB_TYPE_VENDOR, AX_CMD_READ_PHY_ID, array[int8, 2]]]
asix_AX_CMD_READ_MEDIUM_STATUS ptr[in, vusb_response_t[USB_TYPE_VENDOR, AX_CMD_READ_MEDIUM_STATUS, int16]]
asix_AX_CMD_READ_MONITOR_MODE ptr[in, vusb_response_t[USB_TYPE_VENDOR, AX_CMD_READ_MONITOR_MODE, int8]]
asix_AX_CMD_READ_GPIOS ptr[in, vusb_response_t[USB_TYPE_VENDOR, AX_CMD_READ_GPIOS, int8]]
asix_AX_CMD_SW_PHY_STATUS ptr[in, vusb_response_t[USB_TYPE_VENDOR, AX_CMD_SW_PHY_STATUS, int8]]
} [packed]
vusb_response_generic {
type flags[usb_request_types, int8]
req flags[usb_requests, int8]
len bytesize[data, int32]
data array[int8, 0:256]
} [packed]
usb_requests = USB_REQ_GET_STATUS, USB_REQ_CLEAR_FEATURE, USB_REQ_SET_FEATURE, USB_REQ_SET_ADDRESS, USB_REQ_GET_DESCRIPTOR, USB_REQ_SET_DESCRIPTOR, USB_REQ_GET_CONFIGURATION, USB_REQ_SET_CONFIGURATION, USB_REQ_GET_INTERFACE, USB_REQ_SET_INTERFACE, USB_REQ_SYNCH_FRAME, USB_REQ_SET_SEL, USB_REQ_SET_ISOCH_DELAY, USB_REQ_SET_ENCRYPTION, USB_REQ_GET_ENCRYPTION, USB_REQ_RPIPE_ABORT, USB_REQ_SET_HANDSHAKE, USB_REQ_RPIPE_RESET, USB_REQ_GET_HANDSHAKE, USB_REQ_SET_CONNECTION, USB_REQ_SET_SECURITY_DATA, USB_REQ_GET_SECURITY_DATA, USB_REQ_SET_WUSB_DATA, USB_REQ_LOOPBACK_DATA_WRITE, USB_REQ_LOOPBACK_DATA_READ, USB_REQ_SET_INTERFACE_DS, USB_REQ_GET_PARTNER_PDO, USB_REQ_GET_BATTERY_STATUS, USB_REQ_SET_PDO, USB_REQ_GET_VDM, USB_REQ_SEND_VDM
type vusb_response_t[CLASS, REQ, DATA] {
type const[CLASS, int8]
req const[REQ, int8]
len bytesize[data, int32]
data DATA
} [packed]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# USB descriptors requested by the kernel before the SET_CONFIGURATION request.
# TODO: figure out when is the USB_DT_OTG descriptor used.
# TODO: figure out when is the USB_DT_INTERFACE_ASSOCIATION descriptor used.
# TODO: figure out when is the USB_DT_BOS descriptor used.
type usb_string_descriptor_t[DATA] {
bLength len[parent, int8]
bDescriptorType const[USB_DT_STRING, int8]
data DATA
} [packed]
usb_string_descriptor [
lang_id usb_string_descriptor_t[flags[usb_lang_ids, int16]]
string usb_string_descriptor_t[array[int8, 0:256]]
] [varlen]
usb_lang_ids = 0x436, 0x41c, 0x401, 0x801, 0xc01, 0x1001, 0x1401, 0x1801, 0x1c01, 0x2001, 0x2401, 0x2801, 0x2c01, 0x3001, 0x3401, 0x3801, 0x3c01, 0x4001, 0x42b, 0x44d, 0x42c, 0x82c, 0x42d, 0x423, 0x445, 0x402, 0x455, 0x403, 0x404, 0x804, 0xc04, 0x1004, 0x1404, 0x41a, 0x405, 0x406, 0x413, 0x813, 0x409, 0x809, 0xc09, 0x1009, 0x1409, 0x1809, 0x1c09, 0x2009, 0x2409, 0x2809, 0x2c09, 0x3009, 0x3409, 0x425, 0x438, 0x429, 0x40b, 0x40c, 0x80c, 0xc0c, 0x100c, 0x140c, 0x180c, 0x437, 0x407, 0x807, 0xc07, 0x1007, 0x1407, 0x408, 0x447, 0x40d, 0x439, 0x40e, 0x40f, 0x421, 0x410, 0x810, 0x411, 0x44b, 0x860, 0x43f, 0x457, 0x412, 0x812, 0x426, 0x427, 0x827, 0x42f, 0x43e, 0x83e, 0x44c, 0x458, 0x44e, 0x861, 0x414, 0x814, 0x448, 0x415, 0x416, 0x816, 0x446, 0x418, 0x419, 0x44f, 0xc1a, 0x81a, 0x459, 0x41b, 0x424, 0x40a, 0x80a, 0xc0a, 0x100a, 0x140a, 0x180a, 0x1c0a, 0x200a, 0x240a, 0x280a, 0x2c0a, 0x300a, 0x340a, 0x380a, 0x3c0a, 0x400a, 0x440a, 0x480a, 0x4c0a, 0x500a, 0x430, 0x441, 0x41d, 0x81d, 0x449, 0x444, 0x44a, 0x41e, 0x41f, 0x422, 0x420, 0x820, 0x443, 0x843, 0x42a, 0x4ff, 0xf0ff, 0xf4ff, 0xf8ff, 0xfcff
usb_qualifier_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_DEVICE_QUALIFIER, int8]
bcdUSB flags[usb_versions, int16]
bDeviceClass int8
bDeviceSubClass int8
bDeviceProtocol int8
bMaxPacketSize0 flags[usb_device_max_packet_sizes, int8]
bNumConfigurations int8
bRESERVED const[0, int8]
} [packed]
usb_bos_descriptor {
bLength const[USB_DT_BOS_SIZE, int8]
bDescriptorType const[USB_DT_BOS, int8]
wTotalLength len[parent, int16]
bNumDeviceCaps len[caps, int8]
caps array[usb_dev_cap, 0:6]
} [packed]
usb_dev_cap [
generic usb_generic_cap_descriptor
wireless usb_wireless_cap_descriptor
ext_cap usb_ext_cap_descriptor
ss_cap usb_ss_cap_descriptor
ss_container_id usb_ss_container_id_descriptor
ssp_cap usb_ssp_cap_descriptor
ptm_cap usb_ptm_cap_descriptor
] [varlen]
usb_generic_cap_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_DEVICE_CAPABILITY, int8]
bDevCapabilityType flags[usb_capability_types, int8]
data array[int8, 0:256]
} [packed]
usb_capability_types = USB_CAP_TYPE_WIRELESS_USB, USB_CAP_TYPE_EXT, USB_SS_CAP_TYPE, USB_SSP_CAP_TYPE, CONTAINER_ID_TYPE, USB_PTM_CAP_TYPE
usb_wireless_cap_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_DEVICE_CAPABILITY, int8]
bDevCapabilityType const[USB_CAP_TYPE_WIRELESS_USB, int8]
bmAttributes flags[usb_wireless_cap_attributes, int8]
wPHYRates flags[usb_wireless_cap_phyrates, int16]
bmTFITXPowerInfo int8
bmFFITXPowerInfo int8
bmBandGroup int16
bReserved int8
} [packed]
usb_wireless_cap_attributes = USB_WIRELESS_P2P_DRD, USB_WIRELESS_BEACON_MASK, USB_WIRELESS_BEACON_SELF, USB_WIRELESS_BEACON_DIRECTED, USB_WIRELESS_BEACON_NONE
usb_wireless_cap_phyrates = USB_WIRELESS_PHY_53, USB_WIRELESS_PHY_80, USB_WIRELESS_PHY_107, USB_WIRELESS_PHY_160, USB_WIRELESS_PHY_200, USB_WIRELESS_PHY_320, USB_WIRELESS_PHY_400, USB_WIRELESS_PHY_480
usb_ext_cap_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_DEVICE_CAPABILITY, int8]
bDevCapabilityType const[USB_CAP_TYPE_EXT, int8]
bmAttributes1 flags[usb_ext_cap_attributes, int32:8]
bmAttributes2 int32:4
bmAttributes3 int32:4
bmAttributes4 int32:16
} [packed]
usb_ext_cap_attributes = USB_LPM_SUPPORT, USB_BESL_SUPPORT, USB_BESL_BASELINE_VALID, USB_BESL_DEEP_VALID
usb_ss_cap_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_DEVICE_CAPABILITY, int8]
bDevCapabilityType const[USB_SS_CAP_TYPE, int8]
bmAttributes flags[usb_ss_cap_attributes, int8]
wSpeedSupported flags[usb_ss_cap_speed, int16]
bFunctionalitySupport int8
bU1devExitLat int8
bU2DevExitLat int16
} [packed]
usb_ss_cap_attributes = USB_LTM_SUPPORT
usb_ss_cap_speed = USB_LOW_SPEED_OPERATION, USB_FULL_SPEED_OPERATION, USB_HIGH_SPEED_OPERATION, USB_5GBPS_OPERATION
usb_ss_container_id_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_DEVICE_CAPABILITY, int8]
bDevCapabilityType const[CONTAINER_ID_TYPE, int8]
bReserved int8
ContainerID array[int8, 16]
} [packed]
usb_ssp_cap_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_DEVICE_CAPABILITY, int8]
bDevCapabilityType const[USB_SSP_CAP_TYPE, int8]
bReserved int8
bmAttributesSublinkSpeeds len[bmSublinkSpeedAttr, int32:5]
bmAttributesSpeedIDs int32:27
wFunctionalitySupport flags[usb_ssp_cap_funcs, int16]
wReserved int16
bmSublinkSpeedAttr array[flags[usb_ssp_cap_sublink_speeds, int32], 0:6]
} [packed]
usb_ssp_cap_funcs = USB_SSP_MIN_SUBLINK_SPEED_ATTRIBUTE_ID, USB_SSP_MIN_RX_LANE_COUNT, USB_SSP_MIN_TX_LANE_COUNT
usb_ssp_cap_sublink_speeds = USB_SSP_SUBLINK_SPEED_SSID, USB_SSP_SUBLINK_SPEED_LSE, USB_SSP_SUBLINK_SPEED_ST, USB_SSP_SUBLINK_SPEED_RSVD, USB_SSP_SUBLINK_SPEED_LP, USB_SSP_SUBLINK_SPEED_LSM
usb_ptm_cap_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_DEVICE_CAPABILITY, int8]
bDevCapabilityType const[USB_PTM_CAP_TYPE, int8]
} [packed]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Extra USB descriptors that come after an interface or an endpoint descriptor.
# TODO: consider removing class specific descriptors here for described classes.
usb_interface_extra_descriptor [
generic usb_generic_descriptor
hid_hid usb_hid_descriptor_hid
cdc_ecm usb_cdc_header_ecm
cdc_ncm usb_cdc_header_ncm
uac_control uac_control_iface_extra_descriptors
uac_as uac_as_iface_extra_descriptors
] [varlen]
usb_endpoint_extra_descriptor [
generic usb_generic_descriptor
uac_iso uac_iso_endpoint_descriptor
] [varlen]
usb_generic_descriptor {
bLength len[parent, int8]
bDescriptorType flags[usb_descriptor_types, int8]
data array[int8, 0:256]
} [packed]
usb_descriptor_types = USB_DT_DEVICE, USB_DT_CONFIG, USB_DT_STRING, USB_DT_INTERFACE, USB_DT_ENDPOINT, USB_DT_DEVICE_QUALIFIER, USB_DT_OTHER_SPEED_CONFIG, USB_DT_INTERFACE_POWER, USB_DT_OTG, USB_DT_DEBUG, USB_DT_INTERFACE_ASSOCIATION, USB_DT_SECURITY, USB_DT_KEY, USB_DT_ENCRYPTION_TYPE, USB_DT_BOS, USB_DT_DEVICE_CAPABILITY, USB_DT_WIRELESS_ENDPOINT_COMP, USB_DT_WIRE_ADAPTER, USB_DT_RPIPE, USB_DT_CS_RADIO_CONTROL, USB_DT_PIPE_USAGE, USB_DT_SS_ENDPOINT_COMP, USB_DT_SSP_ISOC_ENDPOINT_COMP, HID_DT_HID, HID_DT_REPORT, HID_DT_PHYSICAL
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# USB descriptors requested after the SET_CONFIGURATION request.
usb_hub_descriptor_hs {
bDescLength len[parent, int8]
bDescriptorType const[USB_DT_HUB, int8]
bNbrPorts int8
wHubCharacteristics flags[usb_hub_characteristics, int16]
bPwrOn2PwrGood int8
bHubContrCurrent int8
DeviceRemovable array[int8, USB_HUB_PORTS_BITS]
PortPwrCtrlMask array[int8, USB_HUB_PORTS_BITS]
} [packed]
usb_hub_descriptor_ss {
bDescLength len[parent, int8]
bDescriptorType const[USB_DT_SS_HUB, int8]
bNbrPorts int8
wHubCharacteristics flags[usb_hub_characteristics, int16]
bPwrOn2PwrGood int8
bHubContrCurrent int8
bHubHdrDecLat int8
wHubDelay int16
DeviceRemovable int16
} [packed]
define USB_HUB_PORTS_BITS ((USB_MAXCHILDREN + 1 + 7) / 8)
usb_hub_characteristics = HUB_CHAR_LPSM, HUB_CHAR_COMMON_LPSM, HUB_CHAR_INDV_PORT_LPSM, HUB_CHAR_NO_LPSM, HUB_CHAR_COMPOUND, HUB_CHAR_OCPM, HUB_CHAR_COMMON_OCPM, HUB_CHAR_INDV_PORT_OCPM, HUB_CHAR_NO_OCPM, HUB_CHAR_TTTT, HUB_CHAR_PORTIND
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Replies to USB control requests requested after the SET_CONFIGURATION request.
usb_port_status {
wPortStatus flags[usb_port_status_flags, int16]
wPortChange flags[usb_port_change_flags, int16]
dwExtPortStatus array[flags[usb_ext_port_status_flags, int32], 0:1]
} [packed]
usb_port_status_flags = USB_PORT_STAT_CONNECTION, USB_PORT_STAT_ENABLE, USB_PORT_STAT_SUSPEND, USB_PORT_STAT_OVERCURRENT, USB_PORT_STAT_RESET, USB_PORT_STAT_L1, USB_PORT_STAT_POWER, USB_PORT_STAT_LOW_SPEED, USB_PORT_STAT_HIGH_SPEED, USB_PORT_STAT_TEST, USB_PORT_STAT_INDICATOR, USB_PORT_STAT_LINK_STATE, USB_SS_PORT_STAT_POWER, USB_SS_PORT_STAT_SPEED, USB_PORT_STAT_SPEED_5GBPS, USB_SS_PORT_LS_U0, USB_SS_PORT_LS_U1, USB_SS_PORT_LS_U2, USB_SS_PORT_LS_U3, USB_SS_PORT_LS_SS_DISABLED, USB_SS_PORT_LS_RX_DETECT, USB_SS_PORT_LS_SS_INACTIVE, USB_SS_PORT_LS_POLLING, USB_SS_PORT_LS_RECOVERY, USB_SS_PORT_LS_HOT_RESET, USB_SS_PORT_LS_COMP_MOD, USB_SS_PORT_LS_LOOPBACK
usb_port_change_flags = USB_PORT_STAT_C_CONNECTION, USB_PORT_STAT_C_ENABLE, USB_PORT_STAT_C_SUSPEND, USB_PORT_STAT_C_OVERCURRENT, USB_PORT_STAT_C_RESET, USB_PORT_STAT_C_L1, USB_PORT_STAT_C_BH_RESET, USB_PORT_STAT_C_LINK_STATE, USB_PORT_STAT_C_CONFIG_ERROR
usb_ext_port_status_flags = USB_EXT_PORT_STAT_RX_SPEED_ID, USB_EXT_PORT_STAT_TX_SPEED_ID, USB_EXT_PORT_STAT_RX_LANES, USB_EXT_PORT_STAT_TX_LANES
usb_hub_status {
wHubStatus flags[usb_hub_status_flags, int16]
wHubChange flags[usb_hub_change_flags, int16]
} [packed]
usb_hub_status_flags = HUB_STATUS_LOCAL_POWER, HUB_STATUS_OVERCURRENT
usb_hub_change_flags = HUB_CHANGE_LOCAL_POWER, HUB_CHANGE_OVERCURRENT
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# HID device class specific descriptions.
# https://www.usb.org/sites/default/files/documents/hid1_11.pdf
# https://elixir.bootlin.com/linux/latest/source/drivers/hid/usbhid/hid-core.c
# https://elixir.bootlin.com/linux/latest/source/drivers/hid/hid-core.c
# https://elixir.bootlin.com/linux/latest/source/drivers/usb/gadget/legacy/hid.c
# https://elixir.bootlin.com/linux/latest/source/drivers/usb/gadget/function/f_hid.c
# Connected HID devices are known to create the following /dev/ files:
# /dev/hidraw#, /dev/usb/hiddev# and /dev/input/event#.
resource fd_usb_hid[fd_usb]
syz_usb_connect$hid(speed flags[usb_device_speed], dev_len len[dev], dev ptr[in, usb_device_descriptor_hid], conn_descs ptr[in, vusb_connect_descriptors]) fd_usb_hid (timeout[3000], prog_timeout[3000], remote_cover)
syz_usb_control_io$hid(fd fd_usb_hid, descs ptr[in, vusb_descriptors_hid], resps ptr[in, vusb_responses_hid]) (timeout[300], remote_cover)
# idVendor and idProduct are patched by Go code, see sys/linux/init_vusb.go.
usb_device_descriptor_hid {
inner usb_device_descriptor_t[0, 0, 0, 0, 0, 64, array[usb_config_descriptor_hid, 1]]
} [packed]
usb_config_descriptor_hid {
inner usb_config_descriptor_ifaces_array_t[const[1, int8], array[usb_interface_descriptor_hid, 1]]
} [packed]
usb_interface_descriptor_hid {
inner usb_interface_descriptor_t[const[0, int8], int8, int8[1:2], const[USB_CLASS_HID, int8], const[USB_INTERFACE_SUBCLASS_BOOT, int8], flags[usb_hid_protocols, int8], usb_hid_descriptor_hid, usb_endpoint_descriptors_hid]
} [packed]
usb_hid_protocols = USB_INTERFACE_PROTOCOL_KEYBOARD, USB_INTERFACE_PROTOCOL_MOUSE
usb_endpoint_descriptors_hid {
in usb_endpoint_descriptor_hid_in
out array[usb_endpoint_descriptor_hid_out, 0:1]
} [packed]
usb_endpoint_descriptor_hid_in {
inner usb_endpoint_descriptor_t[const[USB_ENDPOINT_HID_IN_ADDRESS, int8], const[USB_ENDPOINT_HID_ATTRIBUTES, int8], void]
} [packed]
usb_endpoint_descriptor_hid_out {
inner usb_endpoint_descriptor_t[const[USB_ENDPOINT_HID_OUT_ADDRESS, int8], const[USB_ENDPOINT_HID_ATTRIBUTES, int8], void]
} [packed]
define USB_ENDPOINT_HID_ATTRIBUTES (USB_ENDPOINT_XFER_INT)
define USB_ENDPOINT_HID_IN_ADDRESS (1 | USB_DIR_IN)
define USB_ENDPOINT_HID_OUT_ADDRESS (2)
vusb_descriptors_hid {
len len[parent, int32]
generic ptr[in, vusb_descriptor_generic]
USB_DT_STRING ptr[in, vusb_descriptor_t[USB_TYPE_STANDARD, USB_DT_STRING, usb_string_descriptor]]
# For unknown reasons these are requested as USB_TYPE_STANDARD and not as USB_TYPE_CLASS.
# Linux doesn't request HID_DT_HID, but some hosts might do that.
HID_DT_REPORT ptr[in, vusb_descriptor_t[USB_TYPE_STANDARD, HID_DT_REPORT, hid_descriptor_report]]
HID_DT_HID ptr[in, vusb_descriptor_t[USB_TYPE_STANDARD, HID_DT_HID, usb_hid_descriptor_hid]]
} [packed]
vusb_responses_hid {
len len[parent, int32]
generic ptr[in, vusb_response_generic]
USB_REQ_GET_INTERFACE ptr[in, vusb_response_t[USB_TYPE_STANDARD, USB_REQ_GET_INTERFACE, int8]]
USB_REQ_GET_CONFIGURATION ptr[in, vusb_response_t[USB_TYPE_STANDARD, USB_REQ_GET_CONFIGURATION, int8]]
HID_REQ_GET_REPORT ptr[in, vusb_response_t[USB_TYPE_CLASS, HID_REQ_GET_REPORT, array[int8, 0:256]]]
HID_REQ_GET_PROTOCOL ptr[in, vusb_response_t[USB_TYPE_CLASS, HID_REQ_GET_PROTOCOL, int8]]
} [packed]
# USB HID specifications allows for multiple report and physical descriptors
# to be present, but I don't see any support for them in the Linux kernel,
# except for a single report descriptor.
usb_hid_descriptor_hid {
bLength len[parent, int8]
bDescriptorType const[HID_DT_HID, int8]
bcdHID int16
bCountryCode int8
bNumDescriptors const[1, int8]
report_desc usb_hid_class_descriptor_report
} [packed]
usb_hid_class_descriptor_report {
bDescriptorType const[HID_DT_REPORT, int8]
wDescriptorLength int16[0:HID_MAX_DESCRIPTOR_SIZE]
} [packed]
# TODO: it's hard to describe the REPORT descriptor structure via syzkaller
# descriptions, so consider generating it in Go code.
# TODO: the length of REPORT descriptor must match the value in HID descriptor.
# TODO: there are vendor specific REPORT descriptor formats (Logitech HID++).
# Linux HID stack doesn't support long items.
hid_descriptor_report {
items array[hid_report_item_short]
} [packed]
type hid_report_item_short_012_t[TYPE, TAGS] {
bSize len[data, int8:2]
bType const[TYPE, int8:2]
bTag flags[TAGS, int8:4]
data array[int8, 0:2]
} [packed]
type hid_report_item_short_4_t[TYPE, TAGS] {
bSize const[3, int8:2]
bType const[TYPE, int8:2]
bTag flags[TAGS, int8:4]
data array[int8, 4]
} [packed]
type hid_report_item_short_t[TYPE, TAGS] [
item_012 hid_report_item_short_012_t[TYPE, TAGS]
item_4 hid_report_item_short_4_t[TYPE, TAGS]
] [varlen]
hid_report_item_short [
main hid_report_item_short_t[HID_ITEM_TYPE_MAIN, hid_report_item_main_tags]
global hid_report_item_short_t[HID_ITEM_TYPE_GLOBAL, hid_report_item_global_tags]
local hid_report_item_short_t[HID_ITEM_TYPE_LOCAL, hid_report_item_local_tags]
] [varlen]
hid_report_item_main_tags = HID_MAIN_ITEM_TAG_INPUT, HID_MAIN_ITEM_TAG_OUTPUT, HID_MAIN_ITEM_TAG_FEATURE, HID_MAIN_ITEM_TAG_BEGIN_COLLECTION, HID_MAIN_ITEM_TAG_END_COLLECTION
hid_report_item_global_tags = HID_GLOBAL_ITEM_TAG_USAGE_PAGE, HID_GLOBAL_ITEM_TAG_LOGICAL_MINIMUM, HID_GLOBAL_ITEM_TAG_LOGICAL_MAXIMUM, HID_GLOBAL_ITEM_TAG_PHYSICAL_MINIMUM, HID_GLOBAL_ITEM_TAG_PHYSICAL_MAXIMUM, HID_GLOBAL_ITEM_TAG_UNIT_EXPONENT, HID_GLOBAL_ITEM_TAG_UNIT, HID_GLOBAL_ITEM_TAG_REPORT_SIZE, HID_GLOBAL_ITEM_TAG_REPORT_ID, HID_GLOBAL_ITEM_TAG_REPORT_COUNT, HID_GLOBAL_ITEM_TAG_PUSH, HID_GLOBAL_ITEM_TAG_POP
hid_report_item_local_tags = HID_LOCAL_ITEM_TAG_USAGE, HID_LOCAL_ITEM_TAG_USAGE_MINIMUM, HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM, HID_LOCAL_ITEM_TAG_DESIGNATOR_INDEX, HID_LOCAL_ITEM_TAG_DESIGNATOR_MINIMUM, HID_LOCAL_ITEM_TAG_DESIGNATOR_MAXIMUM, HID_LOCAL_ITEM_TAG_STRING_INDEX, HID_LOCAL_ITEM_TAG_STRING_MINIMUM, HID_LOCAL_ITEM_TAG_STRING_MAXIMUM, HID_LOCAL_ITEM_TAG_DELIMITER
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# PRINTER device class specific descriptions.
# https://www.usb.org/sites/default/files/usbprint11a021811.pdf
# https://elixir.bootlin.com/linux/latest/source/drivers/usb/class/usblp.c
# https://elixir.bootlin.com/linux/latest/source/drivers/usb/gadget/legacy/printer.c
# https://elixir.bootlin.com/linux/latest/source/drivers/usb/gadget/function/f_printer.c
# Connected PRINTER devices are known to create the following /dev/ files:
# /dev/usb/lp#.
# TODO: write descriptions for those.
# drivers/usb/class/usblp.c
define USBLP_REQ_GET_ID 0x00
define USBLP_REQ_GET_STATUS 0x01
define USBLP_REQ_RESET 0x02
define USBLP_REQ_HP_CHANNEL_CHANGE_REQUEST 0x00
define USBLP_FIRST_PROTOCOL 1
define USBLP_LAST_PROTOCOL 3
resource fd_usb_printer[fd_usb]
syz_usb_connect$printer(speed flags[usb_device_speed], dev_len len[dev], dev ptr[in, usb_device_descriptor_printer], conn_descs ptr[in, vusb_connect_descriptors]) fd_usb_printer (timeout[3000], prog_timeout[3000], remote_cover)
syz_usb_control_io$printer(fd fd_usb_printer, descs ptr[in, vusb_descriptors_printer], resps ptr[in, vusb_responses_printer]) (timeout[300], remote_cover)
usb_device_descriptor_printer {
inner usb_device_descriptor_t[0, 0, 0, 0x525, 0xa4a8, 64, array[usb_config_descriptor_printer, 1]]
} [packed]
usb_config_descriptor_printer {
inner usb_config_descriptor_ifaces_array_t[const[1, int8], array[usb_interface_descriptor_printer, 1]]
} [packed]
usb_interface_descriptor_printer {
inner usb_interface_descriptor_t[const[0, int8], int8, int8[1:2], const[USB_CLASS_PRINTER, int8], const[1, int8], int8[USBLP_FIRST_PROTOCOL:USBLP_LAST_PROTOCOL], void, usb_endpoint_descriptors_printer]
} [packed]
usb_endpoint_descriptors_printer {
in usb_endpoint_descriptor_printer_out
out array[usb_endpoint_descriptor_printer_in, 0:1]
} [packed]
usb_endpoint_descriptor_printer_out {
inner usb_endpoint_descriptor_t[const[USB_ENDPOINT_PRINTER_OUT_ADDRESS, int8], const[USB_ENDPOINT_PRINTER_ATTRIBUTES, int8], void]
} [packed]
usb_endpoint_descriptor_printer_in {
inner usb_endpoint_descriptor_t[const[USB_ENDPOINT_PRINTER_IN_ADDRESS, int8], const[USB_ENDPOINT_PRINTER_ATTRIBUTES, int8], void]
} [packed]
define USB_ENDPOINT_PRINTER_ATTRIBUTES (USB_ENDPOINT_XFER_BULK)
define USB_ENDPOINT_PRINTER_OUT_ADDRESS (1)
define USB_ENDPOINT_PRINTER_IN_ADDRESS (2 | USB_DIR_IN)
vusb_descriptors_printer {
len len[parent, int32]
generic ptr[in, vusb_descriptor_generic]
USB_DT_STRING ptr[in, vusb_descriptor_t[USB_TYPE_STANDARD, USB_DT_STRING, usb_string_descriptor]]
} [packed]
vusb_responses_printer {
len len[parent, int32]
generic ptr[in, vusb_response_generic]
USB_REQ_GET_INTERFACE ptr[in, vusb_response_t[USB_TYPE_STANDARD, USB_REQ_GET_INTERFACE, int8]]
USB_REQ_GET_CONFIGURATION ptr[in, vusb_response_t[USB_TYPE_STANDARD, USB_REQ_GET_CONFIGURATION, int8]]
USBLP_REQ_GET_ID ptr[in, vusb_response_t[USB_TYPE_CLASS, USBLP_REQ_GET_ID, usb_printer_get_id_response]]
USBLP_REQ_GET_STATUS ptr[in, vusb_response_t[USB_TYPE_CLASS, USBLP_REQ_GET_STATUS, int8]]
USBLP_REQ_HP_CHANNEL_CHANGE_REQUEST ptr[in, vusb_response_t[USB_TYPE_CLASS, USBLP_REQ_HP_CHANNEL_CHANGE_REQUEST, int8]]
} [packed]
usb_printer_get_id_response {
length len[id, int16be]
id array[int8, 0:256]
} [packed]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# CDC ECM (Ethernet) device class specific descriptions.
# https://www.usb.org/document-library/class-definitions-communication-devices-12
# https://elixir.bootlin.com/linux/latest/source/drivers/net/usb/cdc_ether.c
# https://elixir.bootlin.com/linux/latest/source/drivers/net/usb/usbnet.c
# https://elixir.bootlin.com/linux/latest/source/drivers/usb/gadget/legacy/ether.c
# https://elixir.bootlin.com/linux/latest/source/drivers/usb/gadget/function/f_ecm.c
# https://elixir.bootlin.com/linux/latest/source/drivers/usb/gadget/function/u_ether.c
# Connected CDC ECM devices are known to create usbN network interfaces.
# TODO: write descriptions for those.
resource fd_usb_cdc_ecm[fd_usb]
syz_usb_connect$cdc_ecm(speed flags[usb_device_speed], dev_len len[dev], dev ptr[in, usb_device_descriptor_cdc_ecm], conn_descs ptr[in, vusb_connect_descriptors]) fd_usb_cdc_ecm (timeout[3000], prog_timeout[3000], remote_cover)
syz_usb_control_io$cdc_ecm(fd fd_usb_cdc_ecm, descs ptr[in, vusb_descriptors_cdc_ecm], resps ptr[in, vusb_responses_cdc_ecm]) (timeout[300], remote_cover)
usb_device_descriptor_cdc_ecm {
inner usb_device_descriptor_t[USB_CLASS_COMM, 0, 0, 0x525, 0xa4a1, 64, array[usb_config_descriptor_cdc_ecm, 1]]
} [packed]
usb_config_descriptor_cdc_ecm {
inner usb_config_descriptor_ifaces_array_t[const[1, int8], array[usb_interface_descriptor_cdc_ecm, 1]]
} [packed]
# Per specification CDC ECM devices have two interfaces (control and data),
# but here we're merging them into one for simplicity since Linux supports that.
usb_interface_descriptor_cdc_ecm {
inner usb_interface_descriptor_t[const[0, int8], int8, int8[2:3], const[USB_CLASS_COMM, int8], const[USB_CDC_SUBCLASS_ETHERNET, int8], const[USB_CDC_PROTO_NONE, int8], usb_cdc_header_ecm, usb_endpoint_descriptors_cdc_ecm]
} [packed]
usb_endpoint_descriptors_cdc_ecm {
notify array[usb_endpoint_descriptor_cdc_ecm_notify, 0:1]
in usb_endpoint_descriptor_cdc_ecm_in
out usb_endpoint_descriptor_cdc_ecm_out
} [packed]
usb_endpoint_descriptor_cdc_ecm_notify {
inner usb_endpoint_descriptor_t[const[USB_ENDPOINT_CDC_ECM_NOTIFY_ADDRESS, int8], const[USB_ENDPOINT_CDC_ECM_NOTIFY_ATTRIBUTES, int8], void]
} [packed]
usb_endpoint_descriptor_cdc_ecm_in {
inner usb_endpoint_descriptor_t[const[USB_ENDPOINT_CDC_ECM_IN_ADDRESS, int8], const[USB_ENDPOINT_CDC_ECM_DATA_ATTRIBUTES, int8], void]
} [packed]
usb_endpoint_descriptor_cdc_ecm_out {
inner usb_endpoint_descriptor_t[const[USB_ENDPOINT_CDC_ECM_OUT_ADDRESS, int8], const[USB_ENDPOINT_CDC_ECM_DATA_ATTRIBUTES, int8], void]
} [packed]
define USB_ENDPOINT_CDC_ECM_NOTIFY_ATTRIBUTES (USB_ENDPOINT_XFER_INT)
define USB_ENDPOINT_CDC_ECM_DATA_ATTRIBUTES (USB_ENDPOINT_XFER_BULK)
define USB_ENDPOINT_CDC_ECM_NOTIFY_ADDRESS (1 | USB_DIR_IN)
define USB_ENDPOINT_CDC_ECM_IN_ADDRESS (2 | USB_DIR_IN)
define USB_ENDPOINT_CDC_ECM_OUT_ADDRESS (3)
# https://elixir.bootlin.com/linux/v5.2.7/source/drivers/usb/core/message.c#L2137
# https://elixir.bootlin.com/linux/v5.2.7/source/drivers/net/usb/cdc_ether.c#L155
usb_cdc_header_ecm {
union usb_cdc_union_desc_t[0, 0]
header usb_cdc_header_desc
ether usb_cdc_ether_desc
other array[usb_cdc_header_ecm_other, 0:6]
} [packed]
usb_cdc_header_ecm_other [
call_mgmt usb_cdc_call_mgmt_descriptor
acm usb_cdc_acm_descriptor
country_functional usb_cdc_country_functional_desc
network_terminal usb_cdc_network_terminal_desc
dmm usb_cdc_dmm_desc
mdlm usb_cdc_mdlm_desc
mdlm_detail usb_cdc_mdlm_detail_desc
obex usb_cdc_obex_desc
ncm usb_cdc_ncm_desc
mbim usb_cdc_mbim_desc
mbim_extended usb_cdc_mbim_extended_desc
] [varlen]
usb_cdc_header_desc {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[USB_CDC_HEADER_TYPE, int8]
bcdCDC int16
} [packed]
usb_cdc_call_mgmt_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[USB_CDC_CALL_MANAGEMENT_TYPE, int8]
bmCapabilities flags[usb_cdc_call_mgmt_caps, int8]
bDataInterface int8
} [packed]
usb_cdc_call_mgmt_caps = USB_CDC_CALL_MGMT_CAP_CALL_MGMT, USB_CDC_CALL_MGMT_CAP_DATA_INTF
usb_cdc_acm_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[USB_CDC_ACM_TYPE, int8]
bmCapabilities flags[usb_cdc_acm_caps, int8]
} [packed]
usb_cdc_acm_caps = USB_CDC_COMM_FEATURE, USB_CDC_CAP_LINE, USB_CDC_CAP_BRK, USB_CDC_CAP_NOTIFY
type usb_cdc_union_desc_t[MASTER, SLAVE] {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[USB_CDC_UNION_TYPE, int8]
bMasterInterface0 const[MASTER, int8]
bSlaveInterface0 const[SLAVE, int8]
slave_interfaces array[int8, 0:6]
} [packed]
usb_cdc_country_functional_desc {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[USB_CDC_COUNTRY_TYPE, int8]
iCountryCodeRelDate int8
wCountyCode0 int16
country_codes array[int16, 0:6]
} [packed]
usb_cdc_network_terminal_desc {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[USB_CDC_NETWORK_TERMINAL_TYPE, int8]
bEntityId int8
iName int8
bChannelIndex int8
bPhysicalInterface int8
} [packed]
usb_cdc_ether_desc {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[USB_CDC_ETHERNET_TYPE, int8]
iMACAddress const[1, int8]
bmEthernetStatistics int32
wMaxSegmentSize int16
wNumberMCFilters int16
bNumberPowerFilters int8
} [packed]
usb_cdc_dmm_desc {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[USB_CDC_DMM_TYPE, int8]
bcdVersion int16
wMaxCommand int16
} [packed]
usb_cdc_mdlm_desc {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[USB_CDC_MDLM_TYPE, int8]
bcdVersion int16
bGUID usb_cdc_ecm_mbm_guid
} [packed]
# https://elixir.bootlin.com/linux/v5.2.7/source/drivers/net/usb/cdc_ether.c#L61
usb_cdc_ecm_mbm_guid {
id0 const[0x14f5e048ba817a3, int64]
id1 const[0x2a397ecbffc007a6, int64]
} [packed]
usb_cdc_mdlm_detail_desc {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[USB_CDC_MDLM_DETAIL_TYPE, int8]
bGuidDescriptorType int8
bDetailData array[int8, 0:256]
} [packed]
usb_cdc_obex_desc {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[USB_CDC_OBEX_TYPE, int8]
bcdVersion int16
} [packed]
usb_cdc_ncm_desc {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[USB_CDC_NCM_TYPE, int8]
bcdNcmVersion int16
bmNetworkCapabilities flags[usb_cdc_ncm_ncaps, int8]
} [packed]
usb_cdc_ncm_ncaps = USB_CDC_NCM_NCAP_ETH_FILTER, USB_CDC_NCM_NCAP_NET_ADDRESS, USB_CDC_NCM_NCAP_ENCAP_COMMAND, USB_CDC_NCM_NCAP_MAX_DATAGRAM_SIZE, USB_CDC_NCM_NCAP_CRC_MODE, USB_CDC_NCM_NCAP_NTB_INPUT_SIZE
usb_cdc_mbim_desc {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[USB_CDC_MBIM_TYPE, int8]
bcdMBIMVersion int16
wMaxControlMessage int16
bNumberFilters int8
bMaxFilterSize int8
wMaxSegmentSize int16
bmNetworkCapabilities int8
} [packed]
usb_cdc_mbim_extended_desc {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[USB_CDC_MBIM_EXTENDED_TYPE, int8]
bcdMBIMExtendedVersion int16
bMaxOutstandingCommandMessages int8
wMTU int16
} [packed]
vusb_descriptors_cdc_ecm {
len len[parent, int32]
generic ptr[in, vusb_descriptor_generic]
# https://elixir.bootlin.com/linux/v5.2.7/source/drivers/net/usb/usbnet.c#L147
USB_DT_STRING ptr[in, vusb_descriptor_t[USB_TYPE_STANDARD, USB_DT_STRING, usb_string_descriptor_t[usb_cdc_ecm_mac]]]
} [packed]
usb_cdc_ecm_mac {
# This is a UTF16 encoded string "424242424242".
data0 const[0x3400320034003200, int64be]
data1 const[0x3400320034003200, int64be]
data2 const[0x3400320034003200, int64be]
} [packed]
vusb_responses_cdc_ecm {
len len[parent, int32]
generic ptr[in, vusb_response_generic]
USB_REQ_GET_INTERFACE ptr[in, vusb_response_t[USB_TYPE_STANDARD, USB_REQ_GET_INTERFACE, int8]]
USB_REQ_GET_CONFIGURATION ptr[in, vusb_response_t[USB_TYPE_STANDARD, USB_REQ_GET_CONFIGURATION, int8]]
} [packed]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# CDC NCM class specific descriptions.
# CDC NCM is based on CDC ECM, so some of the descriptions are reused.
# https://www.usb.org/document-library/network-control-model-devices-specification-v10-and-errata-and-adopters-agreement
# https://elixir.bootlin.com/linux/latest/source/drivers/net/usb/cdc_ncm.c
# https://elixir.bootlin.com/linux/latest/source/drivers/net/usb/usbnet.c
# https://elixir.bootlin.com/linux/latest/source/drivers/usb/gadget/legacy/ncm.c
# https://elixir.bootlin.com/linux/latest/source/drivers/usb/gadget/function/f_ncm.c
resource fd_usb_cdc_ncm[fd_usb]
syz_usb_connect$cdc_ncm(speed flags[usb_device_speed], dev_len len[dev], dev ptr[in, usb_device_descriptor_cdc_ncm], conn_descs ptr[in, vusb_connect_descriptors]) fd_usb_cdc_ncm (timeout[3000], prog_timeout[3000], remote_cover)
syz_usb_control_io$cdc_ncm(fd fd_usb_cdc_ncm, descs ptr[in, vusb_descriptors_cdc_ncm], resps ptr[in, vusb_responses_cdc_ncm]) (timeout[300], remote_cover)
usb_device_descriptor_cdc_ncm {
inner usb_device_descriptor_t[USB_CLASS_COMM, 0, 0, 0x525, 0xa4a1, 64, array[usb_config_descriptor_cdc_ncm, 1]]
} [packed]
usb_config_descriptor_cdc_ncm {
inner usb_config_descriptor_t[const[1, int8], const[2, int8], usb_interface_descriptors_cdc_ncm]
} [packed]
usb_interface_descriptors_cdc_ncm {
control usb_interface_descriptor_fixed_t[0, CDC_NCM_COMM_ALTSETTING_NCM, 1, USB_CLASS_COMM, USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE, usb_cdc_header_ncm, usb_endpoint_descriptor_cdc_ecm_notify]
data_nop usb_interface_descriptor_fixed_t[1, 0, 0, USB_CLASS_COMM, USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE, void, void]
data usb_interface_descriptor_fixed_t[1, CDC_NCM_DATA_ALTSETTING_NCM, 2, USB_CLASS_COMM, USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE, void, usb_endpoint_descriptors_cdc_ncm_data]
} [packed]
usb_endpoint_descriptors_cdc_ncm_data {
in usb_endpoint_descriptor_cdc_ecm_in
out usb_endpoint_descriptor_cdc_ecm_out
} [packed]
# https://elixir.bootlin.com/linux/v5.2.7/source/drivers/usb/core/message.c#L2137
# https://elixir.bootlin.com/linux/v5.2.7/source/drivers/net/usb/cdc_ncm.c#L798
usb_cdc_header_ncm {
union usb_cdc_union_desc_t[0, 1]
header usb_cdc_header_desc
ether usb_cdc_ether_desc
ncm usb_cdc_ncm_desc
other array[usb_cdc_header_ncm_other, 0:6]
} [packed]
usb_cdc_header_ncm_other [
call_mgmt usb_cdc_call_mgmt_descriptor
acm usb_cdc_acm_descriptor
country_functional usb_cdc_country_functional_desc
network_terminal usb_cdc_network_terminal_desc
dmm usb_cdc_dmm_desc
mdlm usb_cdc_mdlm_desc
mdlm_detail usb_cdc_mdlm_detail_desc
obex usb_cdc_obex_desc
mbim usb_cdc_mbim_desc
mbim_extended usb_cdc_mbim_extended_desc
] [varlen]
vusb_descriptors_cdc_ncm {
len len[parent, int32]
generic ptr[in, vusb_descriptor_generic]
# https://elixir.bootlin.com/linux/v5.2.7/source/drivers/net/usb/usbnet.c#L147
USB_DT_STRING ptr[in, vusb_descriptor_t[USB_TYPE_STANDARD, USB_DT_STRING, usb_string_descriptor_t[usb_cdc_ecm_mac]]]
} [packed]
vusb_responses_cdc_ncm {
len len[parent, int32]
generic ptr[in, vusb_response_generic]
USB_REQ_GET_INTERFACE ptr[in, vusb_response_t[USB_TYPE_STANDARD, USB_REQ_GET_INTERFACE, int8]]
USB_REQ_GET_CONFIGURATION ptr[in, vusb_response_t[USB_TYPE_STANDARD, USB_REQ_GET_CONFIGURATION, int8]]
USB_CDC_GET_NTB_PARAMETERS ptr[in, vusb_response_t[USB_TYPE_CLASS, USB_CDC_GET_NTB_PARAMETERS, usb_cdc_ncm_ntb_parameters]]
USB_CDC_GET_NTB_INPUT_SIZE ptr[in, vusb_response_t[USB_TYPE_CLASS, USB_CDC_GET_NTB_INPUT_SIZE, int32]]
USB_CDC_GET_NTB_FORMAT ptr[in, vusb_response_t[USB_TYPE_CLASS, USB_CDC_GET_NTB_FORMAT, int16[0:1]]]
USB_CDC_GET_MAX_DATAGRAM_SIZE ptr[in, vusb_response_t[USB_TYPE_CLASS, USB_CDC_GET_MAX_DATAGRAM_SIZE, int16]]
USB_CDC_GET_CRC_MODE ptr[in, vusb_response_t[USB_TYPE_CLASS, USB_CDC_GET_CRC_MODE, int16[0:1]]]
} [packed]
usb_cdc_ncm_ntb_parameters {
wLength int16
bmNtbFormatsSupported int16
dwNtbInMaxSize int32
wNdpInDivisor int16
wNdpInPayloadRemainder int16
wNdpInAlignment int16
wPadding1 int16
dwNtbOutMaxSize int32
wNdpOutDivisor int16
wNdpOutPayloadRemainder int16
wNdpOutAlignment int16
wNtbOutMaxDatagrams int16
} [packed]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# UAC1 device class specific descriptions.
# https://www.usb.org/sites/default/files/audio10.pdf
# https://elixir.bootlin.com/linux/latest/source/drivers/usb/gadget/legacy/audio.c
# https://elixir.bootlin.com/linux/latest/source/drivers/usb/gadget/function/f_uac1.c
# https://elixir.bootlin.com/linux/latest/source/drivers/usb/gadget/function/f_uac1_legacy.c
# https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/usb/audio.h
# TODO: find out which /dev/ files are created by connected UAC1 devices and add descriptions for those.
resource fd_usb_uac1[fd_usb]
syz_usb_connect$uac1(speed flags[usb_device_speed], dev_len len[dev], dev ptr[in, usb_device_descriptor_uac1], conn_descs ptr[in, vusb_connect_descriptors]) fd_usb_uac1 (timeout[3000], prog_timeout[3000], remote_cover)
syz_usb_control_io$uac1(fd fd_usb_uac1, descs ptr[in, vusb_descriptors_uac1], resps ptr[in, vusb_responses_uac1]) (timeout[300], remote_cover)
usb_device_descriptor_uac1 {
inner usb_device_descriptor_t[0, 0, 0, 0x1d6b, 0x101, 64, array[usb_config_descriptor_uac1, 1]]
} [packed]
usb_config_descriptor_uac1 {
inner usb_config_descriptor_t[const[1, int8], const[3, int8], usb_interface_descriptors_uac1]
} [packed]
# TODO: control interface might have and optional interrupt endpoint.
usb_interface_descriptors_uac1 {
inner usb_interface_descriptors_uac1_inner
} [packed]
# Define folded-in structure to match layout expected by USB ID patching code.
usb_interface_descriptors_uac1_inner {
control usb_interface_descriptor_fixed_t[0, 0, 0, USB_CLASS_AUDIO, USB_SUBCLASS_AUDIOCONTROL, 0, uac_control_iface_extra_descriptors, void]
as_out_alt_0 usb_interface_descriptor_fixed_t[1, 0, 0, USB_CLASS_AUDIO, USB_SUBCLASS_AUDIOSTREAMING, 0, void, void]
as_out_alt_1 usb_interface_descriptor_fixed_t[1, 1, 1, USB_CLASS_AUDIO, USB_SUBCLASS_AUDIOSTREAMING, 0, uac_as_iface_extra_descriptors, uac_as_out_endpoint_descriptor]
as_in_alt_0 usb_interface_descriptor_fixed_t[2, 0, 0, USB_CLASS_AUDIO, USB_SUBCLASS_AUDIOSTREAMING, 0, void, void]
as_in_alt_1 usb_interface_descriptor_fixed_t[2, 1, 1, USB_CLASS_AUDIO, USB_SUBCLASS_AUDIOSTREAMING, 0, uac_as_iface_extra_descriptors, uac_as_in_endpoint_descriptor]
} [packed]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# UAC uses IDs to make it possible for terminals and units to refer to each other.
# We don't have a way to describe this, so just use a limited number of ids.
type uac_id int8[1:6]
uac_control_iface_extra_descriptors {
header uac1_ac_header_descriptor
others array[uac_control_iface_extra_descriptor, 0:6]
} [packed]
uac1_ac_header_descriptor {
bLength const[UAC_DT_AC_HEADER_LENGTH, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[UAC_HEADER, int8]
bcdADC int16
wTotalLength len[uac_control_iface_extra_descriptors, int16]
bInCollection const[F_AUDIO_NUM_INTERFACES, int8]
# These must match interfaces numbers.
baInterfaceNr0 const[1, int8]
baInterfaceNr1 const[2, int8]
} [packed]
uac_control_iface_extra_descriptor [
input_terminal uac_input_terminal_descriptor
output_terminal uac1_output_terminal_descriptor
mixer_unit uac_mixer_unit_descriptor
selector_unit uac_selector_unit_descriptor
feature_unit uac_feature_unit_descriptor
processing_unit uac_processing_unit_descriptor
extension_unit uac_extension_unit_descriptor
] [varlen]
define F_AUDIO_NUM_INTERFACES 2
define UAC_DT_AC_HEADER_LENGTH UAC_DT_AC_HEADER_SIZE(F_AUDIO_NUM_INTERFACES)
uac_input_terminal_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[UAC_INPUT_TERMINAL, int8]
bTerminalID uac_id
wTerminalType flags[uac_input_terminal_types, int16]
bAssocTerminal uac_id
bNrChannels int8
wChannelConfig int16
iChannelNames int8
iTerminal int8
} [packed]
# The following list contains input terminal types and inout terminal types.
uac_input_terminal_types = UAC_TERMINAL_UNDEFINED, UAC_TERMINAL_STREAMING, UAC_TERMINAL_VENDOR_SPEC, UAC_INPUT_TERMINAL_UNDEFINED, UAC_INPUT_TERMINAL_MICROPHONE, UAC_INPUT_TERMINAL_DESKTOP_MICROPHONE, UAC_INPUT_TERMINAL_PERSONAL_MICROPHONE, UAC_INPUT_TERMINAL_OMNI_DIR_MICROPHONE, UAC_INPUT_TERMINAL_MICROPHONE_ARRAY, UAC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY, UAC_BIDIR_TERMINAL_UNDEFINED, UAC_BIDIR_TERMINAL_HANDSET, UAC_BIDIR_TERMINAL_HEADSET, UAC_BIDIR_TERMINAL_SPEAKER_PHONE, UAC_BIDIR_TERMINAL_ECHO_SUPPRESSING, UAC_BIDIR_TERMINAL_ECHO_CANCELING
# The following list contains output terminal types and inout terminal types.
uac_output_terminal_types = UAC_TERMINAL_UNDEFINED, UAC_TERMINAL_STREAMING, UAC_TERMINAL_VENDOR_SPEC, UAC_OUTPUT_TERMINAL_UNDEFINED, UAC_OUTPUT_TERMINAL_SPEAKER, UAC_OUTPUT_TERMINAL_HEADPHONES, UAC_OUTPUT_TERMINAL_HEAD_MOUNTED_DISPLAY_AUDIO, UAC_OUTPUT_TERMINAL_DESKTOP_SPEAKER, UAC_OUTPUT_TERMINAL_ROOM_SPEAKER, UAC_OUTPUT_TERMINAL_COMMUNICATION_SPEAKER, UAC_OUTPUT_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER, UAC_BIDIR_TERMINAL_UNDEFINED, UAC_BIDIR_TERMINAL_HANDSET, UAC_BIDIR_TERMINAL_HEADSET, UAC_BIDIR_TERMINAL_SPEAKER_PHONE, UAC_BIDIR_TERMINAL_ECHO_SUPPRESSING, UAC_BIDIR_TERMINAL_ECHO_CANCELING
uac1_output_terminal_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[UAC_OUTPUT_TERMINAL, int8]
bTerminalID uac_id
wTerminalType flags[uac_output_terminal_types, int16]
bAssocTerminal uac_id
bSourceID uac_id
iTerminal int8
} [packed]
uac_mixer_unit_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[UAC_MIXER_UNIT, int8]
bUnitID uac_id
bNrInPins int8
baSourceID array[int8, 0:6]
} [packed]
uac_selector_unit_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[UAC_SELECTOR_UNIT, int8]
bUnitID uac_id
bNrInPins int8
baSourceID array[int8, 0:6]
} [packed]
uac_feature_unit_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[UAC_FEATURE_UNIT, int8]
bUnitID uac_id
bSourceID uac_id
bControlSize len[bmaControls, int8]
bmaControls array[flags[uac_feature_unit_controls, int16], 1:6]
iFeature int8
} [packed]
uac_feature_unit_controls = UAC_FU_MUTE, UAC_FU_VOLUME, UAC_FU_BASS, UAC_FU_MID, UAC_FU_TREBLE, UAC_FU_GRAPHIC_EQUALIZER, UAC_FU_AUTOMATIC_GAIN, UAC_FU_DELAY, UAC_FU_BASS_BOOST, UAC_FU_LOUDNESS
uac_processing_unit_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[UAC1_PROCESSING_UNIT, int8]
bUnitID uac_id
wProcessType flags[uac_processing_unit_types, int16]
bNrInPins int8
baSourceID array[int8, 0:6]
} [packed]
uac_processing_unit_types = UAC_PROCESS_UNDEFINED, UAC_PROCESS_UP_DOWNMIX, UAC_PROCESS_DOLBY_PROLOGIC, UAC_PROCESS_STEREO_EXTENDER, UAC_PROCESS_REVERB, UAC_PROCESS_CHORUS, UAC_PROCESS_DYN_RANGE_COMP
uac_extension_unit_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[UAC1_EXTENSION_UNIT, int8]
bUnitID uac_id
wProcessType int16
bNrInPins int8
baSourceID array[int8, 0:6]
} [packed]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
uac_as_iface_extra_descriptors {
others array[uac_as_iface_extra_descriptor, 0:6]
} [packed]
uac_as_iface_extra_descriptor [
as_header uac1_as_header_descriptor
format_type_i_continuous uac_format_type_i_continuous_descriptor
format_type_i_discrete uac_format_type_i_discrete_descriptor
format_type_ii_discrete uac_format_type_ii_discrete_descriptor
format_type_ii_ext uac_format_type_ii_ext_descriptor
format_type_i_ext uac_format_type_i_ext_descriptor
] [varlen]
uac1_as_header_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[UAC_AS_GENERAL, int8]
bTerminalLink int8
bDelay int8
wFormatTag flags[uac_format_tags, int16]
} [packed]
uac_format_tags = UAC_FORMAT_TYPE_I_UNDEFINED, UAC_FORMAT_TYPE_I_PCM, UAC_FORMAT_TYPE_I_PCM8, UAC_FORMAT_TYPE_I_IEEE_FLOAT, UAC_FORMAT_TYPE_I_ALAW, UAC_FORMAT_TYPE_I_MULAW, UAC_FORMAT_TYPE_II_MPEG, UAC_FORMAT_TYPE_II_AC3
uac_usb_format_types_i = UAC_FORMAT_TYPE_I, UAC_FORMAT_TYPE_II, UAC_FORMAT_TYPE_III, UAC_FORMAT_TYPE_UNDEFINED
uac_format_type_i_continuous_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[UAC_FORMAT_TYPE, int8]
bFormatType const[UAC_FORMAT_TYPE_I, int8]
bNrChannels int8
bSubframeSize int8[1:4]
bBitResolution int8
bSamFreqType int8
tLowerSamFreq array[int8, 0:3]
tUpperSamFreq array[int8, 0:3]
} [packed]
uac_format_type_i_discrete_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[UAC_FORMAT_TYPE, int8]
bFormatType const[UAC_FORMAT_TYPE_I, int8]
bNrChannels int8
bSubframeSize int8[1:4]
bBitResolution int8
bSamFreqType int8
tSamFreq array[int8, 0:9]
} [packed]
uac_format_type_ii_discrete_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[UAC_FORMAT_TYPE, int8]
bFormatType const[UAC_FORMAT_TYPE_II, int8]
wMaxBitRate int16
wSamplesPerFrame int16
bSamFreqType int8
tSamFreq array[int8, 0:9]
} [packed]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
uac_as_out_endpoint_descriptor {
inner usb_endpoint_descriptor_t[const[USB_ENDPOINT_UAC1_AS_OUT_ADDRESS, int8], const[USB_ENDPOINT_UAC1_AS_ATTRIBUTES, int8], uac_iso_endpoint_descriptor]
} [packed]
uac_as_in_endpoint_descriptor {
inner usb_endpoint_descriptor_t[const[USB_ENDPOINT_UAC1_AS_IN_ADDRESS, int8], const[USB_ENDPOINT_UAC1_AS_ATTRIBUTES, int8], uac_iso_endpoint_descriptor]
} [packed]
define USB_ENDPOINT_UAC1_AS_OUT_ADDRESS (1 | USB_DIR_OUT)
define USB_ENDPOINT_UAC1_AS_IN_ADDRESS (2 | USB_DIR_IN)
define USB_ENDPOINT_UAC1_AS_ATTRIBUTES (USB_ENDPOINT_SYNC_ADAPTIVE | USB_ENDPOINT_XFER_ISOC)
uac_iso_ep_attributes = USB_ENDPOINT_SYNCTYPE, USB_ENDPOINT_SYNC_NONE, USB_ENDPOINT_SYNC_ASYNC, USB_ENDPOINT_SYNC_ADAPTIVE, USB_ENDPOINT_SYNC_SYNC
uac_iso_endpoint_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_ENDPOINT, int8]
bDescriptorSubType const[UAC_EP_GENERAL, int8]
bmAttributes flags[uac_iso_ep_attributes, int8]
bLockDelayUnits int8
wLockDelay int16
} [packed]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
vusb_descriptors_uac1 {
len len[parent, int32]
generic ptr[in, vusb_descriptor_generic]
USB_DT_STRING ptr[in, vusb_descriptor_t[USB_TYPE_STANDARD, USB_DT_STRING, usb_string_descriptor]]
} [packed]
vusb_responses_uac1 {
len len[parent, int32]
generic ptr[in, vusb_response_generic]
USB_REQ_GET_INTERFACE ptr[in, vusb_response_t[USB_TYPE_STANDARD, USB_REQ_GET_INTERFACE, int8]]
USB_REQ_GET_CONFIGURATION ptr[in, vusb_response_t[USB_TYPE_STANDARD, USB_REQ_GET_CONFIGURATION, int8]]
audio_UAC_GET_CUR ptr[in, vusb_response_t[USB_TYPE_CLASS, UAC_GET_CUR, array[int8, 1:3]]]
audio_UAC_GET_MIN ptr[in, vusb_response_t[USB_TYPE_CLASS, UAC_GET_MIN, array[int8, 1:3]]]
audio_UAC_GET_MAX ptr[in, vusb_response_t[USB_TYPE_CLASS, UAC_GET_MAX, array[int8, 1:3]]]
audio_UAC_GET_RES ptr[in, vusb_response_t[USB_TYPE_CLASS, UAC_GET_RES, array[int8, 1:4]]]
audio_UAC_GET_MEM ptr[in, vusb_response_t[USB_TYPE_CLASS, UAC_GET_MEM, array[int8, 3]]]
} [packed]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# UAC2 device class specific descriptions.
# https://www.usb.org/sites/default/files/audio10.pdf
# https://elixir.bootlin.com/linux/latest/source/drivers/usb/gadget/legacy/audio.c
# https://elixir.bootlin.com/linux/latest/source/drivers/usb/gadget/function/f_uac2.c
# https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/usb/audio.h
resource fd_usb_uac2[fd_usb]
syz_usb_connect$uac2(speed flags[usb_device_speed], dev_len len[dev], dev ptr[in, usb_device_descriptor_uac2], conn_descs ptr[in, vusb_connect_descriptors]) fd_usb_uac2 (timeout[3000], prog_timeout[3000], remote_cover)
syz_usb_control_io$uac2(fd fd_usb_uac2, descs ptr[in, vusb_descriptors_uac1], resps ptr[in, vusb_responses_uac1]) (timeout[300], remote_cover)
usb_device_descriptor_uac2 {
inner usb_device_descriptor_t[0, 0, 0, 0x41e, 0x3000, 64, array[usb_config_descriptor_uac2, 1]]
} [packed]
usb_config_descriptor_uac2 {
inner usb_config_descriptor_extra_t[const[1, int8], const[3, int8], uac2_interface_assoc_descriptor, usb_interface_descriptors_uac2]
} [packed]
uac2_interface_assoc_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_INTERFACE_ASSOCIATION, int8]
bFirstInterface int8[0:2]
bInterfaceCount int8[0:2]
bFunctionClass const[USB_CLASS_AUDIO, int8]
bFunctionSubClass flags[audio_function_category_types, int8]
bFunctionProtocol const[UAC_VERSION_2, int8]
iFunction int8
} [packed]
audio_function_category_types = UAC2_FUNCTION_SUBCLASS_UNDEFINED, UAC2_FUNCTION_DESKTOP_SPEAKER, UAC2_FUNCTION_HOME_THEATER, UAC2_FUNCTION_MICROPHONE, UAC2_FUNCTION_HEADSET, UAC2_FUNCTION_TELEPHONE, UAC2_FUNCTION_CONVERTER, UAC2_FUNCTION_SOUND_RECORDER, UAC2_FUNCTION_IO_BOX, UAC2_FUNCTION_MUSICAL_INSTRUMENT, UAC2_FUNCTION_PRO_AUDIO, UAC2_FUNCTION_AUDIO_VIDEO, UAC2_FUNCTION_CONTROL_PANEL, UAC2_FUNCTION_OTHER
usb_interface_descriptors_uac2 {
inner usb_interface_descriptors_uac2_inner
} [packed]
# Define folded-in structure to match layout expected by USB ID patching code.
usb_interface_descriptors_uac2_inner {
control usb_interface_descriptor_fixed_t[0, 0, 0, USB_CLASS_AUDIO, USB_SUBCLASS_AUDIOCONTROL, UAC_VERSION_2, uac2_control_iface_extra_descriptors, void]
as_out_alt_0 usb_interface_descriptor_fixed_t[1, 0, 0, USB_CLASS_AUDIO, USB_SUBCLASS_AUDIOSTREAMING, UAC_VERSION_2, void, void]
as_out_alt_1 usb_interface_descriptor_fixed_t[1, 1, 1, USB_CLASS_AUDIO, USB_SUBCLASS_AUDIOSTREAMING, UAC_VERSION_2, uac2_as_iface_extra_descriptors, uac2_as_out_endpoint_descriptor]
as_in_alt_0 usb_interface_descriptor_fixed_t[2, 0, 0, USB_CLASS_AUDIO, USB_SUBCLASS_AUDIOSTREAMING, UAC_VERSION_2, void, void]
as_in_alt_1 usb_interface_descriptor_fixed_t[2, 1, 1, USB_CLASS_AUDIO, USB_SUBCLASS_AUDIOSTREAMING, UAC_VERSION_2, uac2_as_iface_extra_descriptors, uac2_as_in_endpoint_descriptor]
} [packed]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
uac2_control_iface_extra_descriptors {
header uac2_ac_header_descriptor
others array[uac2_control_iface_extra_descriptor, 0:6]
} [packed]
uac2_ac_header_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[UAC_MS_HEADER, int8]
bcdADC int16
bCategory flags[uac2_feature_unit_controls, int8]
wTotalLength len[uac2_control_iface_extra_descriptors, int16]
bmControls int8
} [packed]
uac2_feature_unit_controls = UAC2_FUNCTION_SUBCLASS_UNDEFINED, UAC2_FUNCTION_DESKTOP_SPEAKER, UAC2_FUNCTION_HOME_THEATER, UAC2_FUNCTION_MICROPHONE, UAC2_FUNCTION_HEADSET, UAC2_FUNCTION_TELEPHONE, UAC2_FUNCTION_CONVERTER, UAC2_FUNCTION_SOUND_RECORDER, UAC2_FUNCTION_IO_BOX, UAC2_FUNCTION_MUSICAL_INSTRUMENT, UAC2_FUNCTION_PRO_AUDIO, UAC2_FUNCTION_AUDIO_VIDEO, UAC2_FUNCTION_CONTROL_PANEL, UAC2_FUNCTION_OTHER, uac_feature_unit_controls
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
uac2_as_iface_extra_descriptors {
others array[uac2_as_iface_extra_descriptor, 0:6]
} [packed]
uac2_as_iface_extra_descriptor [
as_header uac2_as_header_descriptor
format_type_i_descriptor uac2_format_type_i_descriptor
format_type_i_continuous uac_format_type_i_continuous_descriptor
format_type_i_discrete uac_format_type_i_discrete_descriptor
format_type_ii_discrete uac_format_type_ii_discrete_descriptor
format_type_i_ext uac2_format_type_i_ext_descriptor
format_type_ii_ext uac_format_type_ii_ext_descriptor
] [varlen]
uac2_as_header_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[UAC_AS_GENERAL, int8]
bTerminalLink int8
bmControls int8
bFormatType flags[uac_usb_format_types_i, int8]
bmFormats flags[uac_format_tags, int32]
bNrChannels int8
bmChannelConfig int32
iChannelNames int8
} [packed]
b_sub_slot_sizes = 1, 2, 3, 4
uac2_format_type_i_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[UAC_FORMAT_TYPE, int8]
bFormatType const[UAC_FORMAT_TYPE_I, int8]
bSubslotSize flags[b_sub_slot_sizes, int8]
bBitResolution int8
} [packed]
uac2_format_type_i_ext_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[UAC_FORMAT_TYPE, int8]
bFormatType const[UAC_FORMAT_TYPE_I, int8]
bSubslotSize int8
bBitResolution int8
bHeaderLength int8
bControlSize int8
bSideBandProtocol int8
} [packed]
uac_format_type_ii_ext_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[UAC_FORMAT_TYPE, int8]
bFormatType const[UAC_FORMAT_TYPE_II, int8]
wMaxBitRate int16
wSamplesPerFrame int16
bHeaderLength int8
bSideBandProtocol int8
} [packed]
uac_format_type_i_ext_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[UAC_FORMAT_TYPE, int8]
bFormatType const[UAC_FORMAT_TYPE_I, int8]
bSubslotSize int8
bBitResolution int8
bHeaderLength int8
bControlSize int8
bSideBandProtocol int8
} [packed]
uac2_as_out_endpoint_descriptor {
inner usb_endpoint_descriptor_t[const[USB_ENDPOINT_UAC1_AS_OUT_ADDRESS, int8], const[USB_ENDPOINT_UAC1_AS_ATTRIBUTES, int8], uac2_iso_endpoint_descriptor]
} [packed]
uac2_as_in_endpoint_descriptor {
inner usb_endpoint_descriptor_t[const[USB_ENDPOINT_UAC1_AS_IN_ADDRESS, int8], const[USB_ENDPOINT_UAC1_AS_ATTRIBUTES, int8], uac2_iso_endpoint_descriptor]
} [packed]
uac2_iso_endpoint_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_ENDPOINT, int8]
bDescriptorSubtype const[UAC_EP_GENERAL, int8]
bmAttributes flags[csep_bm_attributes, int8]
bmControls flags[csep_bm_controls, int8]
bLockDelayUnits int8
wLockDelay int16
} [packed]
csep_bm_attributes = UAC_EP_CS_ATTR_SAMPLE_RATE, UAC_EP_CS_ATTR_PITCH_CONTROL, UAC_EP_CS_ATTR_FILL_MAX
csep_bm_controls = UAC2_CONTROL_PITCH, UAC2_CONTROL_DATA_OVERRUN, UAC2_CONTROL_DATA_UNDERRUN
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
uac2_control_iface_extra_descriptor [
input_terminal uac2_input_terminal_descriptor
output_terminal uac2_output_terminal_descriptor
mixer_unit uac2_mixer_unit_descriptor
selector_unit uac2_clock_selector_descriptor
feature_unit uac2_feature_unit_descriptor
processing_unit uac2_processing_unit_descriptor
extension_unit uac2_extension_unit_descriptor
effect_unit uac2_effect_unit_descriptor
sample_rate uac2_sample_rate_descriptor
source_unit uac2_clock_source_descriptor
multiply_unit uac2_clock_multiplier_descriptor
] [varlen]
uac2_input_terminal_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubtype const[UAC_INPUT_TERMINAL, int8]
bTerminalID uac_id
wTerminalType flags[uac_input_terminal_types, int16]
bAssocTerminal uac_id
bCSourceID int8
bNrChannels int8
bmChannelConfig int32
iChannelNames int8
bmControls int8
iTerminal int8
} [packed]
uac2_output_terminal_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubtype const[UAC_OUTPUT_TERMINAL, int8]
bTerminalID uac_id
wTerminalType flags[uac_output_terminal_types, int16]
bAssocTerminal int8
bSourceID uac_id
bCSourceID int8
bmControls int16
iTerminal int8
} [packed]
uac2_mixer_unit_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[UAC_MIXER_UNIT, int8]
bUnitID uac_id
bNrInPins int8
baSourceID array[int8, 0:6]
} [packed]
# TODO: Figure out if bmControls and iClockSelector should be a part of this structure.
uac2_clock_selector_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[UAC2_CLOCK_SELECTOR, int8]
bClockID int8
bNrInPins len[baCSourceID, int8]
baCSourceID array[int8, 0:8]
} [packed]
# TODO: Verify coverage.
uac2_processing_unit_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubtype const[UAC2_PROCESSING_UNIT_V2, int8]
bUnitID uac_id
bSourceID uac_id
bmaControls array[flags[uac2_processing_unit_types, int16], 1:6]
} [packed]
uac2_processing_unit_types = UAC2_PROCESS_UNDEFINED, UAC2_PROCESS_UP_DOWNMIX, UAC2_PROCESS_DOLBY_PROLOCIC, UAC2_PROCESS_STEREO_EXTENDER
uac2_extension_unit_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[UAC2_EXTENSION_UNIT_V2, int8]
bUnitID uac_id
wProcessType int16
bNrInPins int8
baSourceID array[int8, 0:6]
} [packed]
# TODO: Verify coverage.
uac2_effect_unit_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubtype const[UAC2_EFFECT_UNIT, int8]
bUnitID uac_id
wEffectType flags[uac2_effect_unit_types, int16]
bSourceID uac_id
bmaControls array[flags[uac2_processing_unit_types, int16], 1:6]
} [packed]
uac2_effect_unit_types = UAC2_EFFECT_UNDEFINED, UAC2_EFFECT_PARAM_EQ, UAC2_EFFECT_REVERB, UAC2_EFFECT_MOD_DELAY, UAC2_EFFECT_DYN_RANGE_COMP
uac2_sample_rate_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubtype const[UAC2_SAMPLE_RATE_CONVERTER, int8]
bUnitID uac_id
wProcessType flags[uac2_processing_unit_types, int16]
bSourceID uac_id
bmaControls array[flags[uac2_processing_unit_types, int16], 1:6]
} [packed]
uac2_feature_unit_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubtype const[UAC_FEATURE_UNIT, int8]
bUnitID uac_id
bSourceID uac_id
bmaControls array[flags[uac2_feature_unit_controls, int16], 1:6]
} [packed]
uac2_clock_source_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[UAC2_CLOCK_SOURCE, int8]
bClockID int8
bmAttributes flags[uac2_clock_bmattribute_types, int8]
bmControls int8
bAssocTerminal int8
iClockSource flags[uac2_clock_source_types, int8]
} [packed]
uac2_clock_bmattribute_types = UAC_CLOCK_SOURCE_TYPE_EXT, UAC_CLOCK_SOURCE_TYPE_INT_FIXED, UAC_CLOCK_SOURCE_TYPE_INT_VAR, UAC_CLOCK_SOURCE_TYPE_INT_PROG, UAC_CLOCK_SOURCE_SYNCED_TO_SOF
uac2_clock_source_types = UAC_CLOCK_SOURCE_TYPE_EXT, UAC_CLOCK_SOURCE_TYPE_INT_FIXED, UAC_CLOCK_SOURCE_TYPE_INT_VAR, UAC_CLOCK_SOURCE_TYPE_INT_PROG, UAC_CLOCK_SOURCE_SYNCED_TO_SOF
uac2_clock_multiplier_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[UAC2_CLOCK_MULTIPLIER, int8]
bClockID int8
bCSourceID int8
bmControls int8
iClockMultiplier int8
} [packed]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# UAC3 device class specific descriptions.
# https://www.usb.org/sites/default/files/audio10.pdf
# https://elixir.bootlin.com/linux/latest/source/drivers/usb/gadget/legacy/audio.c
# https://elixir.bootlin.com/linux/latest/source/drivers/usb/gadget/function/f_uac3.c
# https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/usb/audio.h
resource fd_usb_uac3[fd_usb]
syz_usb_connect$uac3(speed flags[usb_device_speed], dev_len len[dev], dev ptr[in, usb_device_descriptor_uac3], conn_descs ptr[in, vusb_connect_descriptors]) fd_usb_uac3 (timeout[3000], prog_timeout[3000], remote_cover)
syz_usb_control_io$uac3(fd fd_usb_uac3, descs ptr[in, vusb_descriptors_uac1], resps ptr[in, vusb_responses_uac1]) (timeout[300], remote_cover)
usb_device_descriptor_uac3 {
inner usb_device_descriptor_t[0, 0, 0, 0x582, 0x582, 64, array[usb_config_descriptor_uac3, 1]]
} [packed]
usb_config_descriptor_uac3 {
inner usb_config_descriptor_extra_t[const[1, int8], const[3, int8], uac3_interface_assoc_descriptor, usb_interface_descriptors_uac3]
} [packed]
uac3_interface_assoc_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_INTERFACE_ASSOCIATION, int8]
bFirstInterface int8[0:2]
bInterfaceCount int8[0:2]
bFunctionClass const[USB_CLASS_AUDIO, int8]
bFunctionSubClass flags[uac3_all_subclasses, int8]
bFunctionProtocol const[UAC_VERSION_3, int8]
iFunction int8
} [packed]
usb_interface_descriptors_uac3 {
inner usb_interface_descriptors_uac3_inner
} [packed]
# Define folded-in structure to match layout expected by USB ID patching code.
usb_interface_descriptors_uac3_inner {
control usb_interface_descriptor_fixed_t[0, 0, 0, USB_CLASS_AUDIO, USB_SUBCLASS_AUDIOCONTROL, UAC_VERSION_3, uac3_control_iface_extra_descriptors, void]
as_out_alt_0 usb_interface_descriptor_fixed_t[1, 0, 0, USB_CLASS_AUDIO, USB_SUBCLASS_AUDIOSTREAMING, UAC_VERSION_3, void, void]
as_out_alt_1 usb_interface_descriptor_fixed_t[1, 1, 1, USB_CLASS_AUDIO, USB_SUBCLASS_AUDIOSTREAMING, UAC_VERSION_3, uac3_as_iface_extra_descriptors, uac3_as_out_endpoint_descriptor]
as_in_alt_0 usb_interface_descriptor_fixed_t[2, 0, 0, USB_CLASS_AUDIO, USB_SUBCLASS_AUDIOSTREAMING, UAC_VERSION_3, void, void]
as_in_alt_1 usb_interface_descriptor_fixed_t[2, 1, 1, USB_CLASS_AUDIO, USB_SUBCLASS_AUDIOSTREAMING, UAC_VERSION_3, uac3_as_iface_extra_descriptors, uac3_as_in_endpoint_descriptor]
} [packed]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
uac3_control_iface_extra_descriptors {
header uac3_ac_header_descriptor
others array[uac3_control_iface_extra_descriptor, 0:6]
} [packed]
uac3_ac_header_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[UAC_MS_HEADER, int8]
bCategory flags[uac3_feature_unit_controls, int8]
wTotalLength len[uac3_control_iface_extra_descriptors, int16]
bmControls int32
} [packed]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
uac3_as_iface_extra_descriptors {
others array[uac3_as_iface_extra_descriptor, 0:6]
} [packed]
uac3_as_iface_extra_descriptor [
as_header uac3_as_header_descriptor
format_type_i_descriptor uac2_format_type_i_descriptor
format_type_i_continuous uac_format_type_i_continuous_descriptor
format_type_i_discrete uac_format_type_i_discrete_descriptor
format_type_ii_discrete uac_format_type_ii_discrete_descriptor
format_type_i_ext uac2_format_type_i_ext_descriptor
format_type_ii_ext uac_format_type_ii_ext_descriptor
] [varlen]
# TODO: Figure out how wClusterDescrID is used in the kernel.
uac3_as_header_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[UAC_AS_GENERAL, int8]
bTerminalLink int8
bmControls int32
wClusterDescrID int16
bmFormats flags[uac_format_tags, int64]
bSubslotSize int8
bBitResolution int8
bmAuxProtocols int16
bControlSize int8
} [packed]
uac3_as_out_endpoint_descriptor {
inner usb_endpoint_descriptor_t[const[USB_ENDPOINT_UAC1_AS_OUT_ADDRESS, int8], const[USB_ENDPOINT_UAC1_AS_ATTRIBUTES, int8], uac3_iso_endpoint_descriptor]
} [packed]
uac3_as_in_endpoint_descriptor {
inner usb_endpoint_descriptor_t[const[USB_ENDPOINT_UAC1_AS_IN_ADDRESS, int8], const[USB_ENDPOINT_UAC1_AS_ATTRIBUTES, int8], uac3_iso_endpoint_descriptor]
} [packed]
uac3_iso_endpoint_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_ENDPOINT, int8]
bDescriptorSubType const[UAC3_CS_ENDPOINT, int8]
bmControls int32
bLockDelayUnits int8
wLockDelay int16
} [packed]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
uac3_control_iface_extra_descriptor [
input_terminal uac3_input_terminal_descriptor
output_terminal uac3_output_terminal_descriptor
mixer_unit uac3_mixer_unit_descriptor
selector_unit uac3_clock_selector_descriptor
source_unit uac3_clock_source_descriptor
multiply_unit uac3_clock_multiplier_descriptor
feature_unit uac3_feature_unit_descriptor
processing_unit uac3_processing_unit_descriptor
extension_unit uac3_extension_unit_descriptor
power_domain uac3_power_domain_descriptor
cluster_info_segment uac3_cluster_information_segment_descriptor
# Only cluster information segment is currently used in the kernel.See: sound/usb/stream.c
# cluster_segment uac3_cluster_segment_descriptor
# cluster_end_segment uac3_cluster_end_segment_descriptor
# The following units are not yet supported by the kernel.
# See audio_validators[] in sound/usb/validate.c:
# effect_unit uac3_effect_unit_descriptor
# sample_rate uac3_sample_rate_descriptor
# connectors_unit uac3_connectors_unit_descriptor
# extended_term_unit uac3_extended_terminal_unit
] [varlen]
uac3_input_terminal_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubtype const[UAC_INPUT_TERMINAL, int8]
bTerminalID uac_id
wTerminalType flags[uac_input_terminal_types, int16]
bAssocTerminal uac_id
bCSourceID int8
bmControls int32
wClusterDescrID int16
wExTerminalDescrID int16
wConnectorsDescrID int16
wTerminalDescrStr int16
} [packed]
uac3_output_terminal_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubtype const[UAC_OUTPUT_TERMINAL, int8]
bTerminalID uac_id
wTerminalType flags[uac_output_terminal_types, int16]
bAssocTerminal uac_id
bSourceID uac_id
bCSourceID int8
bmControls int32
wExTerminalDescrID int16
wConnectorsDescrID int16
wTerminalDescrStr int16
} [packed]
uac3_mixer_unit_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[UAC3_MIXER_UNIT, int8]
bUnitID uac_id
bNrInPins int8
baSourceID array[int8, 0:6]
} [packed]
uac3_clock_selector_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[UAC3_CLOCK_SELECTOR, int8]
bClockID int8
bNrInPins len[baCSourceID, int8]
baCSourceID array[int8, 0:8]
} [packed]
uac3_clock_source_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[UAC3_CLOCK_SOURCE, int8]
bClockID int8
bmAttributes flags[uac3_clock_bmattribute_types, int8]
bmControls int32
bReferenceTerminal int8
wClockSourceStr int16
} [packed]
uac3_clock_bmattribute_types = UAC3_CLOCK_SOURCE_TYPE_EXT, UAC3_CLOCK_SOURCE_TYPE_INT, UAC3_CLOCK_SOURCE_ASYNC, UAC3_CLOCK_SOURCE_SYNCED_TO_SOF
uac3_clock_multiplier_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[UAC3_CLOCK_MULTIPLIER, int8]
bClockID int8
bCSourceID int8
bmControls int32
wCMultiplierDescrStr int16
} [packed]
uac3_feature_unit_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubtype const[UAC3_FEATURE_UNIT, int8]
bUnitID uac_id
bSourceID uac_id
bmaControls array[flags[uac3_feature_unit_controls, int32], 1:6]
} [packed]
uac3_processing_unit_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubtype const[UAC3_PROCESSING_UNIT, int8]
bUnitID uac_id
bSourceID uac_id
bmaControls array[flags[uac3_processing_unit_types, int32], 1:6]
} [packed]
uac3_processing_unit_types = UAC3_PROCESS_UNDEFINED, UAC3_PROCESS_UP_DOWNMIX, UAC3_PROCESS_STEREO_EXTENDER, UAC3_PROCESS_MULTI_FUNCTION
uac3_extension_unit_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubtype const[UAC3_EXTENSION_UNIT, int8]
bUnitID uac_id
bSourceID uac_id
bmaControls array[flags[uac3_processing_unit_types, int32], 1:6]
} [packed]
uac3_power_domain_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[UAC3_POWER_DOMAIN, int8]
bPowerDomainID int8
waRecoveryTime1 int16
waRecoveryTime2 int16
bNrEntities int8
baEntityID array[int8, 0:8]
} [packed]
uac3_cluster_information_segment_descriptor {
bLength len[parent, int16]
bSegmentType const[UAC3_CHANNEL_INFORMATION, int8]
bChPurpose flags[uac3_cluster_channel_purposes, int8]
bChRelationship flags[uac3_cluster_channel_relationships, int8]
bChGroupID int8
} [packed]
uac3_cluster_channel_purposes = UAC3_PURPOSE_UNDEFINED, UAC3_PURPOSE_GENERIC_AUDIO, UAC3_PURPOSE_VOICE, UAC3_PURPOSE_SPEECH, UAC3_PURPOSE_AMBIENT, UAC3_PURPOSE_REFERENCE, UAC3_PURPOSE_ULTRASONIC, UAC3_PURPOSE_VIBROKINETIC, UAC3_PURPOSE_NON_AUDIO
uac3_cluster_channel_relationships = UAC3_CH_RELATIONSHIP_UNDEFINED, UAC3_CH_MONO, UAC3_CH_LEFT, UAC3_CH_RIGHT, UAC3_CH_ARRAY, UAC3_CH_PATTERN_X, UAC3_CH_PATTERN_Y, UAC3_CH_PATTERN_A, UAC3_CH_PATTERN_B, UAC3_CH_PATTERN_M, UAC3_CH_PATTERN_S, UAC3_CH_FRONT_LEFT, UAC3_CH_FRONT_RIGHT, UAC3_CH_FRONT_CENTER, UAC3_CH_FRONT_LEFT_OF_CENTER, UAC3_CH_FRONT_RIGHT_OF_CENTER, UAC3_CH_FRONT_WIDE_LEFT, UAC3_CH_FRONT_WIDE_RIGHT, UAC3_CH_SIDE_LEFT, UAC3_CH_SIDE_RIGHT, UAC3_CH_SURROUND_ARRAY_LEFT, UAC3_CH_SURROUND_ARRAY_RIGHT, UAC3_CH_BACK_LEFT, UAC3_CH_BACK_RIGHT, UAC3_CH_BACK_CENTER, UAC3_CH_BACK_LEFT_OF_CENTER, UAC3_CH_BACK_RIGHT_OF_CENTER, UAC3_CH_BACK_WIDE_LEFT, UAC3_CH_BACK_WIDE_RIGHT, UAC3_CH_TOP_CENTER, UAC3_CH_TOP_FRONT_LEFT, UAC3_CH_TOP_FRONT_RIGHT, UAC3_CH_TOP_FRONT_CENTER, UAC3_CH_TOP_FRONT_LOC, UAC3_CH_TOP_FRONT_ROC, UAC3_CH_TOP_FRONT_WIDE_LEFT, UAC3_CH_TOP_FRONT_WIDE_RIGHT, UAC3_CH_TOP_SIDE_LEFT, UAC3_CH_TOP_SIDE_RIGHT, UAC3_CH_TOP_SURR_ARRAY_LEFT, UAC3_CH_TOP_SURR_ARRAY_RIGHT, UAC3_CH_TOP_BACK_LEFT, UAC3_CH_TOP_BACK_RIGHT, UAC3_CH_TOP_BACK_CENTER, UAC3_CH_TOP_BACK_LOC, UAC3_CH_TOP_BACK_ROC, UAC3_CH_TOP_BACK_WIDE_LEFT, UAC3_CH_TOP_BACK_WIDE_RIGHT, UAC3_CH_BOTTOM_CENTER, UAC3_CH_BOTTOM_FRONT_LEFT, UAC3_CH_BOTTOM_FRONT_RIGHT, UAC3_CH_BOTTOM_FRONT_CENTER, UAC3_CH_BOTTOM_FRONT_LOC, UAC3_CH_BOTTOM_FRONT_ROC, UAC3_CH_BOTTOM_FRONT_WIDE_LEFT, UAC3_CH_BOTTOM_FRONT_WIDE_RIGHT, UAC3_CH_BOTTOM_SIDE_LEFT, UAC3_CH_BOTTOM_SIDE_RIGHT, UAC3_CH_BOTTOM_SURR_ARRAY_LEFT, UAC3_CH_BOTTOM_SURR_ARRAY_RIGHT, UAC3_CH_BOTTOM_BACK_LEFT, UAC3_CH_BOTTOM_BACK_RIGHT, UAC3_CH_BOTTOM_BACK_CENTER, UAC3_CH_BOTTOM_BACK_LOC, UAC3_CH_BOTTOM_BACK_ROC, UAC3_CH_BOTTOM_BACK_WIDE_LEFT, UAC3_CH_BOTTOM_BACK_WIDE_RIGHT, UAC3_CH_LOW_FREQUENCY_EFFECTS, UAC3_CH_LFE_LEFT, UAC3_CH_LFE_RIGHT, UAC3_CH_HEADPHONE_LEFT, UAC3_CH_HEADPHONE_RIGHT
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# This list consists of uac3_func_subclasses + uac3_badd_classes.
uac3_all_subclasses = UAC3_FUNCTION_SUBCLASS_UNDEFINED, UAC3_FUNCTION_SUBCLASS_FULL_ADC_3_0, UAC3_FUNCTION_SUBCLASS_GENERIC_IO, UAC3_FUNCTION_SUBCLASS_HEADPHONE, UAC3_FUNCTION_SUBCLASS_SPEAKER, UAC3_FUNCTION_SUBCLASS_MICROPHONE, UAC3_FUNCTION_SUBCLASS_HEADSET, UAC3_FUNCTION_SUBCLASS_HEADSET_ADAPTER, UAC3_FUNCTION_SUBCLASS_SPEAKERPHONE
uac3_feature_unit_controls = UAC3_FUNCTION_SUBCLASS_UNDEFINED, UAC3_FUNCTION_DESKTOP_SPEAKER, UAC3_FUNCTION_HOME_THEATER, UAC3_FUNCTION_MICROPHONE, UAC3_FUNCTION_HEADSET, UAC3_FUNCTION_TELEPHONE, UAC3_FUNCTION_CONVERTER, UAC3_FUNCTION_SOUND_RECORDER, UAC3_FUNCTION_IO_BOX, UAC3_FUNCTION_MUSICAL_INSTRUMENT, UAC3_FUNCTION_PRO_AUDIO, UAC3_FUNCTION_AUDIO_VIDEO, UAC3_FUNCTION_CONTROL_PANEL, UAC3_FUNCTION_HEADPHONE, UAC3_FUNCTION_GENERIC_SPEAKER, UAC3_FUNCTION_HEADSET_ADAPTER, UAC3_FUNCTION_SPEAKERPHONE, UAC3_FUNCTION_OTHER
# TODO: Support uac3 badd profiles. See sound/usb/mixer.c: snd_usb_mixer_controls_badd()
# uac3_badd_endpoint_descriptor {
# inner usb_endpoint_descriptor_t[const[USB_ENDPOINT_UAC1_AS_OUT_ADDRESS, int8], const[USB_ENDPOINT_UAC1_AS_ATTRIBUTES, int8], uac3_iso_endpoint_descriptor]
# } [packed]
#uac3_badd_maxsizes = UAC3_BADD_EP_MAXPSIZE_SYNC_MONO_16,UAC3_BADD_EP_MAXPSIZE_ASYNC_MONO_16,UAC3_BADD_EP_MAXPSIZE_SYNC_MONO_24,UAC3_BADD_EP_MAXPSIZE_ASYNC_MONO_24,UAC3_BADD_EP_MAXPSIZE_SYNC_STEREO_16,UAC3_BADD_EP_MAXPSIZE_ASYNC_STEREO_16,UAC3_BADD_EP_MAXPSIZE_SYNC_STEREO_24,UAC3_BADD_EP_MAXPSIZE_ASYNC_STEREO_24
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# MIDI device class specific descriptions.
# https://www.usb.org/sites/default/files/midi10.pdf
# https://elixir.bootlin.com/linux/latest/source/sound/usb/midi.c
# https://elixir.bootlin.com/linux/latest/source/drivers/usb/gadget/function/f_midi.c
syz_usb_connect$midi(speed flags[usb_device_speed], dev_len len[dev], dev ptr[in, usb_device_descriptor_midi], conn_descs ptr[in, vusb_connect_descriptors]) fd_usb (timeout[3000], prog_timeout[3000], remote_cover)
usb_device_descriptor_midi {
inner usb_device_descriptor_t[0, 0, 0, 0x1430, 0x474b, 64, array[usb_config_descriptor_midi, 1]]
} [packed]
usb_config_descriptor_midi {
inner usb_config_descriptor_t[const[1, int8], const[1, int8], usb_interface_descriptors_midi]
} [packed]
usb_interface_descriptors_midi {
inner usb_interface_descriptors_midi_inner
} [packed]
# Define folded-in structure to match layout expected by USB ID patching code.
usb_interface_descriptors_midi_inner {
control usb_interface_descriptor_eps_array_t[const[0, int8], const[0, int8], const[USB_CLASS_AUDIO, int8], const[USB_SUBCLASS_MIDISTREAMING, int8], flags[uac_version_types, int8], array[usb_midi_iface_extra], array[usb_endpoint_descriptor_midi, 0:8]]
} [packed]
usb_endpoint_descriptor_midi {
inner usb_endpoint_descriptor_t[flags[usb_endpoint_addresses, int8], flags[usb_endpoint_attributes, int8], usb_ms_endpoint_descriptor]
} [packed]
midi_jack_type = USB_MS_EMBEDDED, USB_MS_EXTERNAL
uac_version_types = UAC_VERSION_1, UAC_VERSION_2, UAC_VERSION_3
usb_ms_endpoint_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_ENDPOINT, int8]
bDescriptorSubType const[USB_MS_GENERAL, int8]
bNumEmbMIDIJack len[baAssocJackID, int8]
baAssocJackID array[int8, 0:16]
} [packed]
usb_midi_iface_extra [
ms_header usb_ms_header_descriptor
midi_in_jack usb_midi_in_jack_descriptor
midi_out_jack usb_midi_out_jack_descriptor
] [varlen]
usb_ms_header_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[UAC_HEADER, int8]
bcdMSC int16
wTotalLength len[parent, int16]
} [packed]
usb_midi_in_jack_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[UAC_MIDI_IN_JACK, int8]
bJackType flags[midi_jack_type, int8]
bJackID int8
iJack int8
} [packed]
usb_midi_out_jack_descriptor {
bLength len[parent, int8]
bDescriptorType const[USB_DT_CS_INTERFACE, int8]
bDescriptorSubType const[UAC_MIDI_OUT_JACK, int8]
bJackType flags[midi_jack_type, int8]
bJackID int8
bNrInputPins len[pins, int8]
pins array[usb_midi_source_pin]
iJack int8
} [packed]
usb_midi_source_pin {
baSourceID int8
baSourcePin int8
} [packed]
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# ath9k driver specific descriptions.
include <drivers/net/wireless/ath/ath9k/htc_hst.h>
include <drivers/net/wireless/ath/ath9k/hif_usb.h>
define USB_ENDPOINT_ATH9K_BULK_OUT_ADDRESS (1)
define USB_ENDPOINT_ATH9K_BULK_IN_ADDRESS (2 | USB_DIR_IN)
define USB_ENDPOINT_ATH9K_INT_IN_ADDRESS (3 | USB_DIR_IN)
define USB_ENDPOINT_ATH9K_INT_OUT_ADDRESS (4)
define USB_ENDPOINT_ATH9K_BULK_EXTRA1_ADDRESS (5)
define USB_ENDPOINT_ATH9K_BULK_EXTRA2_ADDRESS (6)
resource fd_usb_ath9k[fd_usb]
syz_usb_connect_ath9k(speed const[USB_SPEED_HIGH], dev_len len[dev], dev ptr[in, usb_device_descriptor_ath9k], conn_descs const[0]) fd_usb_ath9k (timeout[3000], prog_timeout[3000], remote_cover)
syz_usb_ep_write$ath9k_ep1(fd fd_usb_ath9k, ep const[USB_ENDPOINT_ATH9K_BULK_IN_ADDRESS], len bytesize[data], data ptr[in, ath9k_bulk_frame]) (timeout[300], remote_cover)
syz_usb_ep_write$ath9k_ep2(fd fd_usb_ath9k, ep const[USB_ENDPOINT_ATH9K_INT_IN_ADDRESS], len bytesize[data], data ptr[in, htc_frame]) (timeout[300], remote_cover)
usb_device_descriptor_ath9k {
inner usb_device_descriptor_fixed_t[0x200, USB_CLASS_VENDOR_SPEC, USB_SUBCLASS_VENDOR_SPEC, 0xff, 64, 0xcf3, 0x9271, 0x108, array[usb_config_descriptor_ath9k, 1]]
} [packed]
usb_config_descriptor_ath9k {
inner usb_config_descriptor_fixed_t[1, 1, USB_CONFIG_ATT_ONE, 250, usb_interface_descriptor_ath9k]
} [packed]
usb_interface_descriptor_ath9k {
iface usb_interface_descriptor_fixed_t[0, 0, 6, USB_CLASS_VENDOR_SPEC, 0, 0, void, usb_endpoint_descriptors_ath9k]
} [packed]
usb_endpoint_descriptors_ath9k {
bulk_out usb_endpoint_descriptor_fixed_t[USB_ENDPOINT_ATH9K_BULK_OUT_ADDRESS, USB_ENDPOINT_ATH9K_BULK_ATTRIBUTES, 512, 0, void]
bulk_in usb_endpoint_descriptor_fixed_t[USB_ENDPOINT_ATH9K_BULK_IN_ADDRESS, USB_ENDPOINT_ATH9K_BULK_ATTRIBUTES, 512, 0, void]
int_in usb_endpoint_descriptor_fixed_t[USB_ENDPOINT_ATH9K_INT_IN_ADDRESS, USB_ENDPOINT_ATH9K_INT_ATTRIBUTES, 64, 1, void]
int_out usb_endpoint_descriptor_fixed_t[USB_ENDPOINT_ATH9K_INT_OUT_ADDRESS, USB_ENDPOINT_ATH9K_INT_ATTRIBUTES, 64, 1, void]
bulk_extra1 usb_endpoint_descriptor_fixed_t[USB_ENDPOINT_ATH9K_BULK_EXTRA1_ADDRESS, USB_ENDPOINT_ATH9K_BULK_ATTRIBUTES, 512, 0, void]
bulk_extra2 usb_endpoint_descriptor_fixed_t[USB_ENDPOINT_ATH9K_BULK_EXTRA2_ADDRESS, USB_ENDPOINT_ATH9K_BULK_ATTRIBUTES, 512, 0, void]
} [packed]
define USB_ENDPOINT_ATH9K_BULK_ATTRIBUTES (USB_ENDPOINT_XFER_BULK)
define USB_ENDPOINT_ATH9K_INT_ATTRIBUTES (USB_ENDPOINT_XFER_INT)
ath9k_bulk_frame {
packets array[ath9k_bulk_packet]
} [packed]
ath9k_bulk_packet {
pkt_len len[data, int16]
pkt_tag const[ATH_USB_RX_STREAM_MODE_TAG, int16]
data array[int8]
} [packed, align[4]]
htc_frame [
ready htc_ready_frame
conn_svc_rsp htc_conn_svc_rsp_frame
generic htc_generic_frame
] [varlen]
# This is actually wrong, as the driver is buggy and doesn't skip the header
# before processing the frame payload, but let's leave it like thise for now.
htc_ready_frame {
endpoint_id const[0, int8]
flags const[0, int8]
payload_len len[payload, int16be]
control array[int8, 4]
payload htc_ready_msg
} [packed]
htc_ready_msg {
message_id const[HTC_MSG_READY_ID, int16be]
credits int16be
credit_size int16be
max_endpoints int8
pad int8
} [packed]
htc_conn_svc_rsp_frame {
endpoint_id const[0, int8]
flags const[0, int8]
payload_len len[payload, int16be]
control array[int8, 4]
payload htc_conn_svc_rspmsg
} [packed]
htc_conn_svc_rspmsg {
message_id const[HTC_MSG_CONNECT_SERVICE_RESPONSE_ID, int16be]
service_id flags[htc_svcs, int16be]
status const[HTC_SERVICE_SUCCESS, int8]
endpoint_id int8
max_msg_len int16be
svc_meta_len int8
pad int8
} [packed]
htc_svcs = HTC_CTRL_RSVD_SVC, HTC_LOOPBACK_RSVD_SVC, WMI_CONTROL_SVC, WMI_BEACON_SVC, WMI_CAB_SVC, WMI_UAPSD_SVC, WMI_MGMT_SVC, WMI_DATA_VO_SVC, WMI_DATA_VI_SVC, WMI_DATA_BE_SVC, WMI_DATA_BE_SVC
htc_generic_frame {
endpoint_id int8[0:8]
flags flags[htc_frame_flags, int8]
payload_len len[payload, int16be]
control array[int8, 4]
payload array[int8, 0:256]
} [packed]
htc_frame_flags = HTC_FLAGS_RECV_TRAILER
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Assorted driver-specific descriptions of generic syz_* calls' variants.
# Generic calls such as syz_usb_connect() and syz_usb_control_io() should be enough
# (in theory) to emulate a proper device and finish driver probes without a hitch.
# However, there are cases when syzkaller fails to come up with correct inputs to achieve it.
# Use fixed descriptors to quickly pass through probe() to access select drivers' post-probe functionality.
# It is important to note that, one way or another, drivers in question require multiple control requests
# between a driver and a device processed during probe(). Descriptions below do not deal with specific
# CTRL requests as such (except for basic information included in vusb_responses_XXX). Instead, rely on
# seeds, created both manually and with syzkaller's help. For examples, see sys/linux/test/vusb_XXX.
# Common constants for endpoint descriptors.
define USB_ENDPOINT_BULK_ATTR (USB_ENDPOINT_XFER_BULK)
define USB_ENDPOINT_INT_ATTR (USB_ENDPOINT_XFER_INT)
define USB_FIXED_ENDPOINT_BULK_IN_ADDR (1 | USB_DIR_IN)
define USB_FIXED_ENDPOINT_BULK_OUT_ADDR (2)
define USB_FIXED_ENDPOINT_INT_IN_ADDR (3 | USB_DIR_IN)
define USB_RECIP_DEVICE 0x00
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# rtl8150 driver specific descriptions.
resource fd_usb_rtl8150[fd_usb]
syz_usb_connect$rtl8150(speed flags[usb_device_speed], dev_len len[dev], dev ptr[in, usb_device_descriptor_rtl8150], conn_descs const[0]) fd_usb_rtl8150 (timeout[3000], prog_timeout[3000], remote_cover)
syz_usb_control_io$rtl8150(fd fd_usb_rtl8150, descs ptr[in, vusb_descriptors_rtl8150], resps ptr[in, vusb_responses_rtl8150]) (timeout[300], remote_cover)
usb_device_descriptor_rtl8150 {
inner usb_device_descriptor_fixed_t[0x200, USB_CLASS_VENDOR_SPEC, USB_SUBCLASS_VENDOR_SPEC, 0xff, 64, 0xbda, 0x8150, 0, array[usb_config_descriptor_rtl8150, 1]]
} [packed]
usb_config_descriptor_rtl8150 {
inner usb_config_descriptor_fixed_t[1, 1, USB_CONFIG_ATT_ONE, 250, usb_interface_descriptor_rtl8150]
} [packed]
usb_interface_descriptor_rtl8150 {
iface usb_interface_descriptor_fixed_t[0, 0, 3, USB_CLASS_VENDOR_SPEC, 0, 0, void, usb_endpoint_descriptors_rtl8150]
} [packed]
usb_endpoint_descriptors_rtl8150 {
bulk_in usb_endpoint_descriptor_fixed_t[USB_FIXED_ENDPOINT_BULK_IN_ADDR, USB_ENDPOINT_BULK_ATTR, 512, 0, void]
bulk_out usb_endpoint_descriptor_fixed_t[USB_FIXED_ENDPOINT_BULK_OUT_ADDR, USB_ENDPOINT_BULK_ATTR, 512, 0, void]
int_in usb_endpoint_descriptor_fixed_t[USB_FIXED_ENDPOINT_INT_IN_ADDR, USB_ENDPOINT_INT_ATTR, 64, 1, void]
} [packed]
vusb_descriptors_rtl8150 {
len len[parent, int32]
generic ptr[in, vusb_descriptor_generic]
USB_DT_STRING ptr[in, vusb_descriptor_t[USB_TYPE_STANDARD, USB_DT_STRING, usb_string_descriptor]]
} [packed]
vusb_responses_rtl8150 {
len len[parent, int32]
generic ptr[in, vusb_response_generic]
USB_REQ_GET_INTERFACE ptr[in, vusb_response_t[USB_TYPE_STANDARD, USB_REQ_GET_INTERFACE, int8]]
USB_REQ_GET_CONFIGURATION ptr[in, vusb_response_t[USB_TYPE_STANDARD, USB_REQ_GET_CONFIGURATION, int8]]
RTL8150_REQ_GET_REGS ptr[in, vusb_response_t[RTL8150_REQT_READ, RTL8150_REQ_GET_REGS, array[int8, 0:6]]]
RTL8150_REQ_SET_REGS ptr[in, vusb_response_t[RTL8150_REQT_WRITE, RTL8150_REQ_SET_REGS, array[int8, 0:6]]]
} [packed]
define RTL8150_REQ_GET_REGS 0x05
define RTL8150_REQ_SET_REGS 0x05
define RTL8150_REQT_READ 0xc0
define RTL8150_REQT_WRITE 0x40
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# sierra_net driver specific descriptions.
resource fd_usb_sierra_net[fd_usb]
syz_usb_connect$sierra_net(speed flags[usb_device_speed], dev_len len[dev], dev ptr[in, usb_device_descriptor_sierra_net], conn_descs const[0]) fd_usb_sierra_net (timeout[3000], prog_timeout[3000], remote_cover)
syz_usb_control_io$sierra_net(fd fd_usb_sierra_net, descs ptr[in, vusb_descriptors_sierra_net], resps ptr[in, vusb_responses_sierra_net]) (timeout[300], remote_cover)
usb_device_descriptor_sierra_net {
inner usb_device_descriptor_fixed_t[0x200, USB_CLASS_VENDOR_SPEC, USB_SUBCLASS_VENDOR_SPEC, 0xff, 64, 0x1199, 0x68a3, 0, array[usb_config_descriptor_sierra_net, 1]]
} [packed]
usb_config_descriptor_sierra_net {
inner usb_config_descriptor_fixed_t[1, 1, USB_CONFIG_ATT_ONE, 250, usb_interface_descriptor_sierra_net]
} [packed]
usb_interface_descriptor_sierra_net {
iface usb_interface_descriptor_fixed_t[7, 0, 3, USB_CLASS_VENDOR_SPEC, 0, 0, void, usb_endpoint_descriptors_sierra_net]
} [packed]
# sierra_net driver does not expect fixed ep addresses, so refrain from being too specific here.
# As long as we ensure there are 3 endpoints, 2 bulk and 1 int, syzkaller should figure it out.
usb_endpoint_descriptors_sierra_net {
bulk_in usb_endpoint_descriptor_t[flags[usb_endpoint_addresses, int8], const[USB_ENDPOINT_BULK_ATTR, int8], void]
bulk_out usb_endpoint_descriptor_t[flags[usb_endpoint_addresses, int8], const[USB_ENDPOINT_BULK_ATTR, int8], void]
status usb_endpoint_descriptor_t[flags[usb_endpoint_addresses, int8], const[USB_ENDPOINT_INT_ATTR, int8], void]
} [packed]
vusb_descriptors_sierra_net {
len len[parent, int32]
generic ptr[in, vusb_descriptor_generic]
USB_DT_STRING ptr[in, vusb_descriptor_t[USB_TYPE_STANDARD, USB_DT_STRING, usb_string_descriptor]]
} [packed]
vusb_responses_sierra_net {
len len[parent, int32]
generic ptr[in, vusb_response_generic]
USB_CDC_GET_ENCAPSULATED_RESPONSE ptr[in, vusb_response_t[SIERRA_CMD_TYPE_IN, USB_CDC_GET_ENCAPSULATED_RESPONSE, array[int8, 1024]]]
USB_CDC_SEND_ENCAPSULATED_COMMANDT ptr[in, vusb_response_t[SIERRA_CMD_TYPE_OUT, USB_CDC_SEND_ENCAPSULATED_COMMAND, array[int8, 0:4]]]
} [packed]
define SIERRA_CMD_TYPE_IN (USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE)
define SIERRA_CMD_TYPE_OUT (USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# lan78xx driver specific descriptions.
# While these syz_* variants noticably help with the probe() process, they are not enough.
# This is due to a high number of control requests expected between the driver and the device.
include <drivers/net/usb/smsc95xx.h>
resource fd_usb_lan78xx[fd_usb]
syz_usb_connect$lan78xx(speed flags[usb_device_speed], dev_len len[dev], dev ptr[in, usb_device_descriptor_lan78xx], conn_descs const[0]) fd_usb_lan78xx (timeout[3000], prog_timeout[3000], remote_cover)
syz_usb_control_io$lan78xx(fd fd_usb_lan78xx, descs ptr[in, vusb_descriptors_lan78xx], resps ptr[in, vusb_responses_lan78xx]) (timeout[300], remote_cover)
usb_device_descriptor_lan78xx {
inner usb_device_descriptor_fixed_t[0x200, USB_CLASS_VENDOR_SPEC, USB_SUBCLASS_VENDOR_SPEC, 0xff, 64, 0x424, 0x7850, 0, array[usb_config_descriptor_lan78xx, 1]]
} [packed]
usb_config_descriptor_lan78xx {
inner usb_config_descriptor_fixed_t[1, 1, USB_CONFIG_ATT_ONE, 250, usb_interface_descriptor_lan78xx]
} [packed]
usb_interface_descriptor_lan78xx {
iface usb_interface_descriptor_fixed_t[0, 0, 3, USB_CLASS_VENDOR_SPEC, 0, 0, void, usb_endpoint_descriptors_lan78xx]
} [packed]
usb_endpoint_descriptors_lan78xx {
bulk_in usb_endpoint_descriptor_fixed_t[USB_FIXED_ENDPOINT_BULK_IN_ADDR, USB_ENDPOINT_BULK_ATTR, 512, 0, void]
bulk_out usb_endpoint_descriptor_fixed_t[USB_FIXED_ENDPOINT_BULK_OUT_ADDR, USB_ENDPOINT_BULK_ATTR, 512, 0, void]
int_in usb_endpoint_descriptor_fixed_t[USB_FIXED_ENDPOINT_INT_IN_ADDR, USB_ENDPOINT_INT_ATTR, 64, 1, void]
} [packed]
vusb_descriptors_lan78xx {
len len[parent, int32]
generic ptr[in, vusb_descriptor_generic]
USB_DT_STRING ptr[in, vusb_descriptor_t[USB_TYPE_STANDARD, USB_DT_STRING, usb_string_descriptor]]
} [packed]
vusb_responses_lan78xx {
len len[parent, int32]
generic ptr[in, vusb_response_generic]
USB_REQ_GET_INTERFACE ptr[in, vusb_response_t[USB_TYPE_STANDARD, USB_REQ_GET_INTERFACE, int8]]
USB_REQ_GET_CONFIGURATION ptr[in, vusb_response_t[USB_TYPE_STANDARD, USB_REQ_GET_CONFIGURATION, int8]]
USB_VENDOR_REQUEST_READ_REGISTER ptr[in, vusb_response_t[LAN78XX_REG_TYPE_IN, USB_VENDOR_REQUEST_READ_REGISTER, int32]]
USB_VENDOR_REQUEST_WRITE_REGISTER ptr[in, vusb_response_t[LAN78XX_REG_TYPE_OUT, USB_VENDOR_REQUEST_WRITE_REGISTER, int32]]
USB_VENDOR_REQUEST_GET_STATS ptr[in, vusb_response_t[LAN78XX_REG_TYPE_IN, USB_VENDOR_REQUEST_GET_STATS, array[int8, 47]]]
} [packed]
define LAN78XX_REG_TYPE_IN (USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE)
define LAN78XX_REG_TYPE_OUT (USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE)
]
|
| 61/2 |
2026/05/19 14:13 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 133768
output: 56
thoughts: 2914
Thoughts: **Constructing a USB Device Descriptor for em28xx Device Initialization**
Okay, so I'm thinking I can leverage `syz_usb_disconnect` after connecting a USB device, specifically, an `em28xx` device. The plan is to use `syz_usb_connect` to set up the device. `syz_usb_connect` returns a file descriptor, which `syz_usb_disconnect` takes. The trick is making sure the connection happens correctly.
The core idea is to craft a `usb_device_descriptor` that matches what the `em28xx` driver expects, using the known vendor and product IDs (0xeb1a and 0x2800). I can either let syzkaller patch them based on device matching, or I can define the `usb_device_descriptor` myself. The latter seems more robust and controllable, forcing a specific device type.
I've got the idea from `vusb.txt` that `syzkaller` automatically patches fields of `usb_device_descriptor`. The goal is to define our `usb_device_descriptor` and feed that to `syz_usb_connect`. I've got the descriptor layout:
`usb_device_descriptor {
inner usb_device_descriptor_t[0, 0, 0, 0, 0, 0, array[usb_config_descriptor, 1]]
} [packed]`
However, setting the `idVendor` and `idProduct` is not enough, because I'll need to define configuration, interface, and endpoint descriptors.
The raw bytes are: `\x12\x01\x00\x02\xff\xff\xff\x40\x1a\xeb\x00\x28\x00\x01\x00\x00\x00\x01`.
`syz_usb_connect`'s signature, to be absolutely sure:
`syz_usb_connect(speed flags[usb_device_speed], dev_len len[dev], dev ptr[in, usb_device_descriptor], conn_descs ptr[in, vusb_connect_descriptors]) fd_usb`
I'm thinking of constructing the `dev` argument, which is a pointer to the `usb_device_descriptor` and passing it to `syz_usb_connect`. The tricky part is ensuring all of the required descriptors are present.
I have a plan to use the `AUTO` variable of Syzkaller to define a structured representation with required fields, including configuration, interfaces, and endpoint descriptors.
Let's use verbose descriptors to define configuration, interface, and endpoint descriptors correctly:
```
usb_device_descriptor_verbose_t
usb_config_descriptor_verbose_t
usb_interface_descriptor_verbose_t
```
My goal is to successfully call `em28xx_usb_probe`, to register a `/dev/video0`. Otherwise, the test is useless.
I will construct the `dev` argument as follows, and ensure all the fields are filled:
```
&AUTO={
{
0x12, 0x1, 0x200, 0xff, 0xff, 0xff, 0x40, 0xeb1a, 0x2800, 0x100, 1, 2, 3, AUTO,
[
{
{
0x9, 0x2, AUTO, AUTO, 1, 0, 0, 0, @void,
[
{
{
0x9, 0x4, 0, 0, AUTO, 0xff, 0xff, 0xff, 0, @void,
[]
}
}
]
}
}
]
}
}
```
Now I need to find the specific requirements of `em28xx_usb_probe`, so I can make sure the descriptor is correct.
|
| 62/2 |
2026/05/19 14:14 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/media/usb/em28xx/em28xx-cards.c IncludeLines:true Name:em28xx_usb_probe]
Results: map[SourceCode:3864: /*
3865: * em28xx_usb_probe()
3866: * checks for supported devices
3867: */
3868: static int em28xx_usb_probe(struct usb_interface *intf,
3869: const struct usb_device_id *id)
3870: {
3871: struct usb_device *udev;
3872: struct em28xx *dev = NULL;
3873: int retval;
3874: bool has_vendor_audio = false, has_video = false, has_dvb = false;
3875: int i, nr, try_bulk;
3876: const int ifnum = intf->altsetting[0].desc.bInterfaceNumber;
3877: char *speed;
3878:
3879: udev = usb_get_dev(interface_to_usbdev(intf));
3880:
3881: /* Check to see next free device and mark as used */
3882: do {
3883: nr = find_first_zero_bit(em28xx_devused, EM28XX_MAXBOARDS);
3884: if (nr >= EM28XX_MAXBOARDS) {
3885: /* No free device slots */
3886: dev_err(&intf->dev,
3887: "Driver supports up to %i em28xx boards.\n",
3888: EM28XX_MAXBOARDS);
3889: retval = -ENOMEM;
3890: goto err_no_slot;
3891: }
3892: } while (test_and_set_bit(nr, em28xx_devused));
3893:
3894: /* Don't register audio interfaces */
3895: if (intf->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) {
3896: dev_info(&intf->dev,
3897: "audio device (%04x:%04x): interface %i, class %i\n",
3898: le16_to_cpu(udev->descriptor.idVendor),
3899: le16_to_cpu(udev->descriptor.idProduct),
3900: ifnum,
3901: intf->altsetting[0].desc.bInterfaceClass);
3902:
3903: retval = -ENODEV;
3904: goto err;
3905: }
3906:
3907: /* allocate memory for our device state and initialize it */
3908: dev = kzalloc_obj(*dev);
3909: if (!dev) {
3910: retval = -ENOMEM;
3911: goto err;
3912: }
3913:
3914: /* compute alternate max packet sizes */
3915: dev->alt_max_pkt_size_isoc = kcalloc(intf->num_altsetting,
3916: sizeof(dev->alt_max_pkt_size_isoc[0]),
3917: GFP_KERNEL);
3918: if (!dev->alt_max_pkt_size_isoc) {
3919: kfree(dev);
3920: retval = -ENOMEM;
3921: goto err;
3922: }
3923:
3924: /* Get endpoints */
3925: for (i = 0; i < intf->num_altsetting; i++) {
3926: int ep;
3927:
3928: for (ep = 0;
3929: ep < intf->altsetting[i].desc.bNumEndpoints;
3930: ep++)
3931: em28xx_check_usb_descriptor(dev, udev, intf,
3932: i, ep,
3933: &has_vendor_audio,
3934: &has_video,
3935: &has_dvb);
3936: }
3937:
3938: if (!(has_vendor_audio || has_video || has_dvb)) {
3939: retval = -ENODEV;
3940: goto err_free;
3941: }
3942:
3943: switch (udev->speed) {
3944: case USB_SPEED_LOW:
3945: speed = "1.5";
3946: break;
3947: case USB_SPEED_UNKNOWN:
3948: case USB_SPEED_FULL:
3949: speed = "12";
3950: break;
3951: case USB_SPEED_HIGH:
3952: speed = "480";
3953: break;
3954: default:
3955: speed = "unknown";
3956: }
3957:
3958: dev_info(&intf->dev,
3959: "New device %s %s @ %s Mbps (%04x:%04x, interface %d, class %d)\n",
3960: udev->manufacturer ? udev->manufacturer : "",
3961: udev->product ? udev->product : "",
3962: speed,
3963: le16_to_cpu(udev->descriptor.idVendor),
3964: le16_to_cpu(udev->descriptor.idProduct),
3965: ifnum,
3966: intf->altsetting->desc.bInterfaceNumber);
3967:
3968: /*
3969: * Make sure we have 480 Mbps of bandwidth, otherwise things like
3970: * video stream wouldn't likely work, since 12 Mbps is generally
3971: * not enough even for most Digital TV streams.
3972: */
3973: if (udev->speed != USB_SPEED_HIGH && disable_usb_speed_check == 0) {
3974: dev_err(&intf->dev, "Device initialization failed.\n");
3975: dev_err(&intf->dev,
3976: "Device must be connected to a high-speed USB 2.0 port.\n");
3977: retval = -ENODEV;
3978: goto err_free;
3979: }
3980:
3981: kref_init(&dev->ref);
3982:
3983: dev->devno = nr;
3984: dev->model = id->driver_info;
3985: dev->alt = -1;
3986: dev->is_audio_only = has_vendor_audio && !(has_video || has_dvb);
3987: dev->has_video = has_video;
3988: dev->ifnum = ifnum;
3989:
3990: dev->ts = PRIMARY_TS;
3991: snprintf(dev->name, 28, "em28xx");
3992: dev->dev_next = NULL;
3993:
3994: if (has_vendor_audio) {
3995: dev_info(&intf->dev,
3996: "Audio interface %i found (Vendor Class)\n", ifnum);
3997: dev->usb_audio_type = EM28XX_USB_AUDIO_VENDOR;
3998: }
3999: /* Checks if audio is provided by a USB Audio Class intf */
4000: for (i = 0; i < udev->config->desc.bNumInterfaces; i++) {
4001: struct usb_interface *uif = udev->config->interface[i];
4002:
4003: if (uif->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) {
4004: if (has_vendor_audio)
4005: dev_err(&intf->dev,
4006: "em28xx: device seems to have vendor AND usb audio class interfaces !\n"
4007: "\t\tThe vendor interface will be ignored. Please contact the developers <linux-media@vger.kernel.org>\n");
4008: dev->usb_audio_type = EM28XX_USB_AUDIO_CLASS;
4009: break;
4010: }
4011: }
4012:
4013: if (has_video)
4014: dev_info(&intf->dev, "Video interface %i found:%s%s\n",
4015: ifnum,
4016: dev->analog_ep_bulk ? " bulk" : "",
4017: dev->analog_ep_isoc ? " isoc" : "");
4018: if (has_dvb)
4019: dev_info(&intf->dev, "DVB interface %i found:%s%s\n",
4020: ifnum,
4021: dev->dvb_ep_bulk ? " bulk" : "",
4022: dev->dvb_ep_isoc ? " isoc" : "");
4023:
4024: dev->num_alt = intf->num_altsetting;
4025:
4026: if ((unsigned int)card[nr] < em28xx_bcount)
4027: dev->model = card[nr];
4028:
4029: /* save our data pointer in this intf device */
4030: usb_set_intfdata(intf, dev);
4031:
4032: /* allocate device struct and check if the device is a webcam */
4033: mutex_init(&dev->lock);
4034: retval = em28xx_init_dev(dev, udev, intf, nr);
4035: if (retval)
4036: goto err_free;
4037:
4038: if (usb_xfer_mode < 0) {
4039: if (dev->is_webcam)
4040: try_bulk = 1;
4041: else
4042: try_bulk = 0;
4043: } else {
4044: try_bulk = usb_xfer_mode > 0;
4045: }
4046:
4047: /* Disable V4L2 if the device doesn't have a decoder or image sensor */
4048: if (has_video &&
4049: dev->board.decoder == EM28XX_NODECODER &&
4050: dev->em28xx_sensor == EM28XX_NOSENSOR) {
4051: dev_err(&intf->dev,
4052: "Currently, V4L2 is not supported on this model\n");
4053: has_video = false;
4054: dev->has_video = false;
4055: }
4056:
4057: if (dev->board.has_dual_ts &&
4058: (dev->tuner_type != TUNER_ABSENT || INPUT(0)->type)) {
4059: /*
4060: * The logic with sets alternate is not ready for dual-tuners
4061: * which analog modes.
4062: */
4063: dev_err(&intf->dev,
4064: "We currently don't support analog TV or stream capture on dual tuners.\n");
4065: has_video = false;
4066: }
4067:
4068: /* Select USB transfer types to use */
4069: if (has_video) {
4070: if (!dev->analog_ep_isoc || (try_bulk && dev->analog_ep_bulk))
4071: dev->analog_xfer_bulk = 1;
4072: dev_info(&intf->dev, "analog set to %s mode.\n",
4073: dev->analog_xfer_bulk ? "bulk" : "isoc");
4074: }
4075: if (has_dvb) {
4076: if (!dev->dvb_ep_isoc || (try_bulk && dev->dvb_ep_bulk))
4077: dev->dvb_xfer_bulk = 1;
4078: dev_info(&intf->dev, "dvb set to %s mode.\n",
4079: dev->dvb_xfer_bulk ? "bulk" : "isoc");
4080: }
4081:
4082: if (dev->board.has_dual_ts && em28xx_duplicate_dev(dev) == 0) {
4083: kref_init(&dev->dev_next->ref);
4084:
4085: dev->dev_next->ts = SECONDARY_TS;
4086: dev->dev_next->alt = -1;
4087: dev->dev_next->is_audio_only = has_vendor_audio &&
4088: !(has_video || has_dvb);
4089: dev->dev_next->has_video = false;
4090: dev->dev_next->ifnum = ifnum;
4091: dev->dev_next->model = id->driver_info;
4092:
4093: mutex_init(&dev->dev_next->lock);
4094: retval = em28xx_init_dev(dev->dev_next, udev, intf,
4095: dev->dev_next->devno);
4096: if (retval)
4097: goto err_free;
4098:
4099: dev->dev_next->board.ir_codes = NULL; /* No IR for 2nd tuner */
4100: dev->dev_next->board.has_ir_i2c = 0; /* No IR for 2nd tuner */
4101:
4102: if (usb_xfer_mode < 0) {
4103: if (dev->dev_next->is_webcam)
4104: try_bulk = 1;
4105: else
4106: try_bulk = 0;
4107: } else {
4108: try_bulk = usb_xfer_mode > 0;
4109: }
4110:
4111: /* Select USB transfer types to use */
4112: if (has_dvb) {
4113: if (!dev->dvb_ep_isoc_ts2 ||
4114: (try_bulk && dev->dvb_ep_bulk_ts2))
4115: dev->dev_next->dvb_xfer_bulk = 1;
4116: dev_info(&dev->intf->dev, "dvb ts2 set to %s mode.\n",
4117: dev->dev_next->dvb_xfer_bulk ? "bulk" : "isoc");
4118: }
4119:
4120: dev->dev_next->dvb_ep_isoc = dev->dvb_ep_isoc_ts2;
4121: dev->dev_next->dvb_ep_bulk = dev->dvb_ep_bulk_ts2;
4122: dev->dev_next->dvb_max_pkt_size_isoc = dev->dvb_max_pkt_size_isoc_ts2;
4123: dev->dev_next->dvb_alt_isoc = dev->dvb_alt_isoc;
4124:
4125: /* Configure hardware to support TS2*/
4126: if (dev->dvb_xfer_bulk) {
4127: /* The ep4 and ep5 are configured for BULK */
4128: em28xx_write_reg(dev, 0x0b, 0x96);
4129: mdelay(100);
4130: em28xx_write_reg(dev, 0x0b, 0x80);
4131: mdelay(100);
4132: } else {
4133: /* The ep4 and ep5 are configured for ISO */
4134: em28xx_write_reg(dev, 0x0b, 0x96);
4135: mdelay(100);
4136: em28xx_write_reg(dev, 0x0b, 0x82);
4137: mdelay(100);
4138: }
4139: }
4140:
4141: request_modules(dev);
4142:
4143: /*
4144: * Do it at the end, to reduce dynamic configuration changes during
4145: * the device init. Yet, as request_modules() can be async, the
4146: * topology will likely change after the load of the em28xx subdrivers.
4147: */
4148: #ifdef CONFIG_MEDIA_CONTROLLER
4149: /*
4150: * No need to check the return value, the device will still be
4151: * usable without media controller API.
4152: */
4153: retval = media_device_register(dev->media_dev);
4154: #endif
4155:
4156: return 0;
4157:
4158: err_free:
4159: kfree(dev->alt_max_pkt_size_isoc);
4160: kfree(dev);
4161:
4162: err:
4163: clear_bit(nr, em28xx_devused);
4164:
4165: err_no_slot:
4166: usb_put_dev(udev);
4167: return retval;
4168: }
SourceFile:drivers/media/usb/em28xx/em28xx-cards.c]
|
| 63/2 |
2026/05/19 14:14 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 142607
output: 58
thoughts: 1830
Thoughts: **Race Condition Analysis for em28xx USB Driver**
Okay, let's break this down. My goal is to trigger a race condition in the `em28xx` USB driver, specifically with the video device. The starting point is `em28xx_usb_probe`. It seems like the key check is `em28xx_check_usb_descriptor` for determining the presence of video. If video is detected, it sets `dev->has_video = true`, then it requests modules like `em28xx-video`. Now, `em28xx-video` loading is asynchronous, triggered by `request_modules`, but not directly by `request_module` itself. I had to look closely. Turns out `em28xx-video` is an extension module. The system registers an `em28xx_ops` struct, and when `em28xx-video` loads, `em28xx_register_extension` kicks off the process. It's the `ops->init` which is called and it's initialized through `em28xx_v4l2_init`. If it fails, `dev->v4l2` is set to NULL, and it unregisters the video device.
So here's the thought. We need a way to make `em28xx_v4l2_init` fail *after* the video device has been registered, but before the driver finishes cleaning up. That's the race! Two paths to a race appear. `em28xx_v4l2_init` failing after `video_register_device` will work. The disconnect will also work! If we disconnect the USB device, `em28xx_usb_disconnect` is called and that's it! `em28xx_usb_disconnect` calls `em28xx_close_extension` and it calls `ops->fini`, in this case `em28xx_v4l2_fini`. That cleans up the video device.
Here's the plan. Connect, wait for `/dev/video0`, concurrently open `/dev/video0`, then disconnect. To implement this in syzkaller, which lacks a wait primitive, we can leverage syzkaller's device enumeration behavior with `syz_usb_connect`. If it succeeds and `/dev/video0` is created, then it's a good approach. The disconnect, triggered by `syz_usb_disconnect` and the `openat` call, will be concurrent.
But... `syz_usb_connect` needs a *valid* USB descriptor. Otherwise, probe will fail, and we will never get our `/dev/video0`. I have to craft a valid descriptor, which is not difficult. To ensure the proper vendor/product IDs (0xeb1a/0x2800), I think it's better to just pass the raw bytes. It looks like it wants a pointer to a `usb_device_descriptor`. Let's give it the struct format to avoid type mismatch errors! The `em28xx_check_usb_descriptor` function requires specific endpoint addresses (0x82 or 0x84). I'll need to make sure the crafted descriptor has those endpoints. The device descriptor also requires at least one interface with an alternate setting.
So the final syzkaller program structure should look like:
1. `r0 = syz_usb_connect(...)` (with crafted descriptor and endpoint addresses)
2. `openat$video(AT_FDCWD, &AUTO="/dev/video0", 0x2, 0x0) (async)`
3. `syz_usb_disconnect(r0)`
|
| 64/2 |
2026/05/19 14:14 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/media/usb/em28xx/em28xx-cards.c IncludeLines:true Name:em28xx_check_usb_descriptor]
Results: map[SourceCode:3760: static void em28xx_check_usb_descriptor(struct em28xx *dev,
3761: struct usb_device *udev,
3762: struct usb_interface *intf,
3763: int alt, int ep,
3764: bool *has_vendor_audio,
3765: bool *has_video,
3766: bool *has_dvb)
3767: {
3768: const struct usb_endpoint_descriptor *e;
3769: int sizedescr, size;
3770:
3771: /*
3772: * NOTE:
3773: *
3774: * Old logic with support for isoc transfers only was:
3775: * 0x82 isoc => analog
3776: * 0x83 isoc => audio
3777: * 0x84 isoc => digital
3778: *
3779: * New logic with support for bulk transfers
3780: * 0x82 isoc => analog
3781: * 0x82 bulk => analog
3782: * 0x83 isoc* => audio
3783: * 0x84 isoc => digital
3784: * 0x84 bulk => analog or digital**
3785: * 0x85 isoc => digital TS2
3786: * 0x85 bulk => digital TS2
3787: * (*: audio should always be isoc)
3788: * (**: analog, if ep 0x82 is isoc, otherwise digital)
3789: *
3790: * The new logic preserves backwards compatibility and
3791: * reflects the endpoint configurations we have seen
3792: * so far. But there might be devices for which this
3793: * logic is not sufficient...
3794: */
3795:
3796: e = &intf->altsetting[alt].endpoint[ep].desc;
3797:
3798: if (!usb_endpoint_dir_in(e))
3799: return;
3800:
3801: sizedescr = le16_to_cpu(e->wMaxPacketSize);
3802: size = sizedescr & 0x7ff;
3803:
3804: if (udev->speed == USB_SPEED_HIGH)
3805: size = size * hb_mult(sizedescr);
3806:
3807: /* Only inspect input endpoints */
3808:
3809: switch (e->bEndpointAddress) {
3810: case 0x82:
3811: *has_video = true;
3812: if (usb_endpoint_xfer_isoc(e)) {
3813: dev->analog_ep_isoc = e->bEndpointAddress;
3814: dev->alt_max_pkt_size_isoc[alt] = size;
3815: } else if (usb_endpoint_xfer_bulk(e)) {
3816: dev->analog_ep_bulk = e->bEndpointAddress;
3817: }
3818: return;
3819: case 0x83:
3820: if (usb_endpoint_xfer_isoc(e))
3821: *has_vendor_audio = true;
3822: else
3823: dev_err(&intf->dev,
3824: "error: skipping audio endpoint 0x83, because it uses bulk transfers !\n");
3825: return;
3826: case 0x84:
3827: if (*has_video && (usb_endpoint_xfer_bulk(e))) {
3828: dev->analog_ep_bulk = e->bEndpointAddress;
3829: } else {
3830: if (usb_endpoint_xfer_isoc(e)) {
3831: if (size > dev->dvb_max_pkt_size_isoc) {
3832: /*
3833: * 2) some manufacturers (e.g. Terratec)
3834: * disable endpoints by setting
3835: * wMaxPacketSize to 0 bytes for all
3836: * alt settings. So far, we've seen
3837: * this for DVB isoc endpoints only.
3838: */
3839: *has_dvb = true;
3840: dev->dvb_ep_isoc = e->bEndpointAddress;
3841: dev->dvb_max_pkt_size_isoc = size;
3842: dev->dvb_alt_isoc = alt;
3843: }
3844: } else {
3845: *has_dvb = true;
3846: dev->dvb_ep_bulk = e->bEndpointAddress;
3847: }
3848: }
3849: return;
3850: case 0x85:
3851: if (usb_endpoint_xfer_isoc(e)) {
3852: if (size > dev->dvb_max_pkt_size_isoc_ts2) {
3853: dev->dvb_ep_isoc_ts2 = e->bEndpointAddress;
3854: dev->dvb_max_pkt_size_isoc_ts2 = size;
3855: dev->dvb_alt_isoc = alt;
3856: }
3857: } else {
3858: dev->dvb_ep_bulk_ts2 = e->bEndpointAddress;
3859: }
3860: return;
3861: }
3862: }
SourceFile:drivers/media/usb/em28xx/em28xx-cards.c]
|
| 65/2 |
2026/05/19 14:14 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 146955
output: 308
thoughts: 6486
Thoughts: **Crash Analysis: Race Condition in em28xx Driver**
Okay, so the goal here is to trigger a race condition in the `em28xx` driver, specifically related to the `/dev/video0` device. The plan is to create a situation where the device is registered and then unregistered concurrently, leading to potential use-after-free or double-free scenarios.
First, we know that setting `0x82` for the endpoint means we will set `has_video = true` and `dev->analog_ep_bulk = 0x82` when our custom device is probed. The key is to construct a specific `usb_device_descriptor` to make `em28xx_usb_probe` succeed. The address `0x82` corresponds to `USB_DIR_IN | 2` and the transfer type is `USB_ENDPOINT_XFER_BULK`. This endpoint configuration should trigger the loading of the `em28xx-video` module, which then calls `em28xx_v4l2_init`. This function registers `/dev/video0`.
However, `em28xx_v4l2_init` can fail if there are issues, for instance, with I2C or if other endpoints are missing. If it fails, `/dev/video0` will be unregistered. This is the crucial point for the race condition. If we can *concurrently* open `/dev/video0` *while* it's being unregistered, we've got the bug.
The `em28xx_vbi_supported` function becomes relevant here. It checks for `dev->analog_ep_isoc` or `dev->analog_ep_bulk`. For this device, with an `idVendor` and `idProduct` of `0xeb1a:0x2800`, `dev->is_webcam` will be false, so it tries to register `vbi_dev`. If the VBI endpoint is not provided, we may hit the problem. Also, `em28xx_audio_setup` is important as it is called before the video device registration; if this fails, `/dev/video0` won't be created. `em28xx_vb2_setup` is also called later, but a failure here won't cause the device to be unregistered.
The strategy is to make sure `em28xx_v4l2_init` *succeeds initially*, but *then get it to fail quickly*. Disconnecting the USB device through `syz_usb_disconnect` is the way to trigger this failure. `em28xx_usb_disconnect` will call `em28xx_v4l2_fini`, which sets `dev->v4l2 = NULL`.
The exploit becomes the following Syzkaller program:
1. Connect the custom USB device using `syz_usb_connect`.
2. Open `/dev/video0` and `/dev/video1` asynchronously using `openat`.
3. Disconnect the device using `syz_usb_disconnect` *after* a device descriptor with our endpoints is sent, but before the `openat` calls can complete.
We construct the `usb_device_descriptor`:
```
r0 = syz_usb_connect(3, 0x2b, &AUTO=ANY="\x12\x01\x00\x02\xff\xff\xff\x40\x1a\xeb\x00\x28\x00\x01\x00\x00\x00\x01\x09\x02\x19\x00\x01\x01\x00\x80\xfa\x09\x04\x00\x00\x01\xff\xff\xff\x00\x07\x05\x82\x02\x00\x02\x00", &AUTO={0, 0, 0, 0, 0, []})
openat(0xffffffffffffff9c, &AUTO="/dev/video0\x00", 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO="/dev/video1\x00", 0x2, 0x0) (async)
syz_usb_disconnect(r0) (async)
```
Where the `usb_device_descriptor` is the carefully crafted byte string:
`1201
|
| 66/2 |
2026/05/19 14:15 |
tool |
reproduce-crash |
0m
Error:
Args: map[ReproSyz:r0 = syz_usb_connect(3, 0x2b, &AUTO=ANY="\x12\x01\x00\x02\xff\xff\xff\x40\x1a\xeb\x00\x28\x00\x01\x00\x00\x00\x01\x09\x02\x19\x00\x01\x01\x00\x80\xfa\x09\x04\x00\x00\x01\xff\xff\xff\x00\x07\x05\x82\x02\x00\x02\x00", &AUTO={0, 0, 0, 0, 0, []})
openat(0xffffffffffffff9c, &AUTO="/dev/video0\x00", 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO="/dev/video1\x00", 0x2, 0x0) (async)
syz_usb_disconnect(r0) (async)
]
Results: map[CoverageID: ReproducedBugTitle: ReproducedCrashReport:]
|
| 67/2 |
2026/05/19 14:15 |
llm |
crash-repro-finder |
4m
Model:
Tokens:
input: 155005
output: 306
thoughts: 32
Thoughts: Okay, here's my interpretation of that thought process, assuming I'm deep in the weeds of some technical challenge, likely related to data serialization or protocol design:
**Exploring the `ANY` Syntax for a Binary Representation**
Right, so I'm thinking about how to represent this "ANY" type, which is a common concept when you need to handle data that could be a variety of formats without knowing the specifics at compile time. I remember the syntax is something like `&ANY="..."`. Okay, simple enough. But now I'm trying to figure out the best way to encode a *binary* value using this. I immediately go to the low-level representation - hex. Let's see... since I'm trying to represent binary data within a text-based format, let me explore representing the byte array `\x12\x01...`. It's pretty standard. I need to figure out the exact encoding. So I'll try that with the syntax: `&ANY="\x12\x01..."` and see what happens. I'm probably experimenting with the format to see if this passes validation.
|
| 68/2 |
2026/05/19 14:20 |
tool |
reproduce-crash |
0m
Error:
Args: map[ReproSyz:r0 = syz_usb_connect(3, 0x2b, &ANY="\x12\x01\x00\x02\xff\xff\xff\x40\x1a\xeb\x00\x28\x00\x01\x00\x00\x00\x01\x09\x02\x19\x00\x01\x01\x00\x80\xfa\x09\x04\x00\x00\x01\xff\xff\xff\x00\x07\x05\x82\x02\x00\x02\x00", &AUTO={0, 0, 0, 0, 0, []})
openat(0xffffffffffffff9c, &AUTO="/dev/video0\x00", 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO="/dev/video1\x00", 0x2, 0x0) (async)
syz_usb_disconnect(r0) (async)
]
Results: map[CoverageID: ReproducedBugTitle: ReproducedCrashReport:]
|
| 69/2 |
2026/05/19 14:20 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 155817
output: 306
thoughts: 234
Thoughts: **Decoding the Mysterious '&AUTO' Pointer**
Okay, so I'm wrestling with this `&AUTO` pointer type. It seems like it's the only one allowed, which is a bit unusual. Let me see, the syntax is defined as `pointer-arg = "&" pointer-arg-addr ["=ANY"] "=" arg`. So, if I understand correctly, I should be able to specify a value for this pointer type directly. The documentation's a little sparse, but the notation looks like `&AUTO=ANY="\x12..."`. I gave that a shot, feeding it some hexadecimal data, but it barked back with a "wrong string arg" error. Hmm, not quite right. Maybe it needs an empty string? Worth a shot. I'll test it out with `&AUTO=""`.
Alright, that didn't work. Now, let's try inputting a carefully crafted binary blob: `&AUTO="\x12\x01\x00\x02\xff\xff\xff\x40\x1a\xeb\x00\x28\x00\x01\x00\x00\x00\x01\x09\x02\x19\x00\x01\x01\x00\x80\xfa\x09\x04\x00\x00\x01\xff\xff\xff\x00\x07\x05\x82\x02\x00\x02\x00"`. Hopefully, the program will accept this format. Time to see if this works!
|
| 70/2 |
2026/05/19 14:21 |
tool |
reproduce-crash |
0m
Error:
Args: map[ReproSyz:r0 = syz_usb_connect(3, 0x2b, &AUTO="\x12\x01\x00\x02\xff\xff\xff\x40\x1a\xeb\x00\x28\x00\x01\x00\x00\x00\x01\x09\x02\x19\x00\x01\x01\x00\x80\xfa\x09\x04\x00\x00\x01\xff\xff\xff\x00\x07\x05\x82\x02\x00\x02\x00", &AUTO={0, 0, 0, 0, 0, []})
openat(0xffffffffffffff9c, &AUTO="/dev/video0\x00", 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO="/dev/video1\x00", 0x2, 0x0) (async)
syz_usb_disconnect(r0) (async)
]
Results: map[CoverageID: ReproducedBugTitle: ReproducedCrashReport:]
|
| 71/2 |
2026/05/19 14:21 |
llm |
crash-repro-finder |
1m
Model:
Tokens:
input: 156960
output: 308
thoughts: 1048
Thoughts: **Constructing a USB Device Descriptor for Reproducible Testing**
Okay, so I'm trying to craft a specific `usb_device_descriptor`. I initially thought I could just provide a string, but it's clearly a struct, so I need to use the `{...}` syntax in my definition. Let's start with the basic structure. I'll build it up and plug in values.
Then, I need to check the exact type definition of `usb_device_descriptor_t`. Now, I understand that `usb_device_descriptor` encapsulates `usb_device_descriptor_t`, but crucially, fields like `idVendor` and `idProduct` are defined as `const`. That means, if I try to directly set them, I'm going to run into trouble. Specifically, syzkaller will always serialize them as `0`. But, here's where it gets interesting: the `init_vusb.go` script *patches* these values after connection! That's how it injects specific vendor/product IDs.
The problem is, how do I reliably influence `init_vusb.go` to use my target values, `0xeb1a:0x2800`? There's no specialized `syz_usb_connect$em28xx` call I can use to directly target that. Hmmm, does `init_vusb.go` randomly choose from a list of known IDs? Yes, that's it! It *might* pick `0xeb1a:0x2800` if I just use a regular `syz_usb_connect`. But, that's not a dependable setup for a reproducible test case.
The key to a *reproducible* exploit is the ability to bypass this restriction, right? My next thought is the `ANY` pointer. This would bypass the type restrictions. I've tried using it, but I'm getting errors, mainly about string syntax. I'm going to consult the documentation again. Okay, it's `pointer-arg = "&" pointer-arg-addr ["=ANY"] "=" arg` and `pointer-arg-addr = "AUTO" | "(" pointer-addr ["/" region-size] ")"` So, it should be `&AUTO=ANY="..."`. I tried that, got an error, and had a thought that maybe my string syntax is off. Let me try different string delimiters, like single quotes. Let's see if this works: `&AUTO=ANY='\x12\x01\x00\x02\xff\xff\xff\x40\x1a\xeb\x00\x28\x00\x01\x00\x00\x00\x01\x09\x02\x19\x00\x01\x01\x00\x80\xfa\x09\x04\x00\x00\x01\xff\xff\xff\x00\x07\x05\x82\x02\x00\x02\x00'`. If that works, then I should be able to force the `init_vusb.go` patching to use those parameters.
|
| 72/2 |
2026/05/19 14:22 |
tool |
reproduce-crash |
0m
Error:
Args: map[ReproSyz:r0 = syz_usb_connect(3, 0x2b, &AUTO=ANY='\x12\x01\x00\x02\xff\xff\xff\x40\x1a\xeb\x00\x28\x00\x01\x00\x00\x00\x01\x09\x02\x19\x00\x01\x01\x00\x80\xfa\x09\x04\x00\x00\x01\xff\xff\xff\x00\x07\x05\x82\x02\x00\x02\x00', &AUTO={0, 0, 0, 0, 0, []})
openat(0xffffffffffffff9c, &AUTO="/dev/video0\x00", 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO="/dev/video1\x00", 0x2, 0x0) (async)
syz_usb_disconnect(r0) (async)
]
Results: map[CoverageID: ReproducedBugTitle: ReproducedCrashReport:]
|
| 73/2 |
2026/05/19 14:22 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 159267
output: 19
thoughts: 503
Thoughts: **Analyzing USB Device Descriptor Handling**
Okay, so I'm wrestling with how `ANY` works in this context. Initially, I thought `ANY` was a keyword, but that's not right. It looks like it's part of an optional specifier in this pointer argument structure: `pointer-arg = "&" pointer-arg-addr ["=ANY"] "=" arg`. The key is that `"=ANY"` is *optional*.
So, based on that structure, something like `&AUTO=ANY="..."` should be valid syntax. But, there is a catch: that `arg` itself must still be a valid argument for the underlying *type*. If the type is `usb_device_descriptor`, then my `arg` has to be a struct, right?
But then I had a thought: if I *do* use `=ANY`, does it actually let the argument be *any* type? Wait, no. I think it means the *pointer* is `ANY` type but the argument has to match the type it points to. No, I'm second-guessing myself. If `ANY`, the argument can actually be anything!
But then I remembered `syz_usb_connect` expects `ptr[in, usb_device_descriptor]`. If I pass `&AUTO=ANY="..."`, maybe it fails because `ANY` isn't valid for this specific function/argument? I should look at that function definition.
Wait a second, there's `syz_usb_connect$ath9k`! I can probably use that! That function expects a `usb_device_descriptor_ath9k`.
Looking at that struct definition:
```
usb_device_descriptor_ath9k {
inner usb_device_descriptor_fixed_t[0x200, USB_CLASS_VENDOR_SPEC, USB_SUBCLASS_VENDOR_SPEC, 0xff, 64, 0xcf3, 0x9271, 0x108, array[usb_config_descriptor_ath9k, 1]]
} [packed]
```
Aha! This has *fixed* `idVendor=0xcf3` and `idProduct=0x9271`. This is *not* the same as `em28xx`.
Now the question is, are there *any* other `syz_usb_connect` variants that I can use?
Okay, let's explore an alternative. What if I just use `syz_usb_connect` (the original one) and pass the struct, but I put the correct `0xeb1a` value into the `idVendor` field? Wait, if `idVendor` is defined as `const[0, int16]`, syzkaller is going to overwrite it with `0` during serialization, right? Damn!
But wait a minute, `init_vusb.go` is supposed to patch that! Okay, let's go check `init_vusb.go` to see *how* it's patching this value.
|
| 74/2 |
2026/05/19 14:23 |
tool |
grepper |
0m
Args:
Results: map[Output:drivers/media/rc/keymaps/rc-dib0700-rc5.c=16=static struct rc_map_table dib0700_rc5_table[] = {
--
drivers/media/rc/keymaps/rc-dib0700-rc5.c-67- { 0xeb19, KEY_YELLOW },
drivers/media/rc/keymaps/rc-dib0700-rc5.c:68: { 0xeb1a, KEY_BLUE },
drivers/media/rc/keymaps/rc-dib0700-rc5.c-69- { 0xeb1b, KEY_CHANNELUP },
--
drivers/media/usb/em28xx/em28xx-cards.c=2637=struct usb_device_id em28xx_id_table[] = {
drivers/media/usb/em28xx/em28xx-cards.c:2638: { USB_DEVICE(0xeb1a, 0x2750),
drivers/media/usb/em28xx/em28xx-cards.c-2639- .driver_info = EM2750_BOARD_UNKNOWN },
drivers/media/usb/em28xx/em28xx-cards.c:2640: { USB_DEVICE(0xeb1a, 0x2751),
drivers/media/usb/em28xx/em28xx-cards.c-2641- .driver_info = EM2750_BOARD_UNKNOWN },
drivers/media/usb/em28xx/em28xx-cards.c:2642: { USB_DEVICE(0xeb1a, 0x2800),
drivers/media/usb/em28xx/em28xx-cards.c-2643- .driver_info = EM2800_BOARD_UNKNOWN },
drivers/media/usb/em28xx/em28xx-cards.c:2644: { USB_DEVICE(0xeb1a, 0x2710),
drivers/media/usb/em28xx/em28xx-cards.c-2645- .driver_info = EM2820_BOARD_UNKNOWN },
drivers/media/usb/em28xx/em28xx-cards.c:2646: { USB_DEVICE(0xeb1a, 0x2820),
drivers/media/usb/em28xx/em28xx-cards.c-2647- .driver_info = EM2820_BOARD_UNKNOWN },
drivers/media/usb/em28xx/em28xx-cards.c:2648: { USB_DEVICE(0xeb1a, 0x2821),
drivers/media/usb/em28xx/em28xx-cards.c-2649- .driver_info = EM2820_BOARD_UNKNOWN },
drivers/media/usb/em28xx/em28xx-cards.c:2650: { USB_DEVICE(0xeb1a, 0x2860),
drivers/media/usb/em28xx/em28xx-cards.c-2651- .driver_info = EM2820_BOARD_UNKNOWN },
drivers/media/usb/em28xx/em28xx-cards.c:2652: { USB_DEVICE(0xeb1a, 0x2861),
drivers/media/usb/em28xx/em28xx-cards.c-2653- .driver_info = EM2820_BOARD_UNKNOWN },
drivers/media/usb/em28xx/em28xx-cards.c:2654: { USB_DEVICE(0xeb1a, 0x2862),
drivers/media/usb/em28xx/em28xx-cards.c-2655- .driver_info = EM2820_BOARD_UNKNOWN },
drivers/media/usb/em28xx/em28xx-cards.c:2656: { USB_DEVICE(0xeb1a, 0x2863),
drivers/media/usb/em28xx/em28xx-cards.c-2657- .driver_info = EM2820_BOARD_UNKNOWN },
drivers/media/usb/em28xx/em28xx-cards.c:2658: { USB_DEVICE(0xeb1a, 0x2870),
drivers/media/usb/em28xx/em28xx-cards.c-2659- .driver_info = EM2820_BOARD_UNKNOWN },
drivers/media/usb/em28xx/em28xx-cards.c:2660: { USB_DEVICE(0xeb1a, 0x2881),
drivers/media/usb/em28xx/em28xx-cards.c-2661- .driver_info = EM2820_BOARD_UNKNOWN },
drivers/media/usb/em28xx/em28xx-cards.c:2662: { USB_DEVICE(0xeb1a, 0x2883), /* used by :Zolid Hybrid Tv Stick */
drivers/media/usb/em28xx/em28xx-cards.c-2663- .driver_info = EM2820_BOARD_UNKNOWN },
drivers/media/usb/em28xx/em28xx-cards.c:2664: { USB_DEVICE(0xeb1a, 0x2868),
drivers/media/usb/em28xx/em28xx-cards.c-2665- .driver_info = EM2820_BOARD_UNKNOWN },
drivers/media/usb/em28xx/em28xx-cards.c:2666: { USB_DEVICE(0xeb1a, 0x2875),
drivers/media/usb/em28xx/em28xx-cards.c-2667- .driver_info = EM2820_BOARD_UNKNOWN },
drivers/media/usb/em28xx/em28xx-cards.c:2668: { USB_DEVICE(0xeb1a, 0x2885), /* MSI Digivox Trio */
drivers/media/usb/em28xx/em28xx-cards.c-2669- .driver_info = EM2884_BOARD_TERRATEC_H5 },
drivers/media/usb/em28xx/em28xx-cards.c:2670: { USB_DEVICE(0xeb1a, 0xe300),
drivers/media/usb/em28xx/em28xx-cards.c-2671- .driver_info = EM2861_BOARD_KWORLD_PVRTV_300U },
drivers/media/usb/em28xx/em28xx-cards.c:2672: { USB_DEVICE(0xeb1a, 0xe303),
drivers/media/usb/em28xx/em28xx-cards.c-2673- .driver_info = EM2860_BOARD_KAIOMY_TVNPC_U2 },
drivers/media/usb/em28xx/em28xx-cards.c:2674: { USB_DEVICE(0xeb1a, 0xe305),
drivers/media/usb/em28xx/em28xx-cards.c-2675- .driver_info = EM2880_BOARD_KWORLD_DVB_305U },
drivers/media/usb/em28xx/em28xx-cards.c:2676: { USB_DEVICE(0xeb1a, 0xe310),
drivers/media/usb/em28xx/em28xx-cards.c-2677- .driver_info = EM2880_BOARD_MSI_DIGIVOX_AD },
drivers/media/usb/em28xx/em28xx-cards.c:2678: { USB_DEVICE(0xeb1a, 0xa313),
drivers/media/usb/em28xx/em28xx-cards.c-2679- .driver_info = EM2882_BOARD_KWORLD_ATSC_315U },
drivers/media/usb/em28xx/em28xx-cards.c:2680: { USB_DEVICE(0xeb1a, 0xa316),
drivers/media/usb/em28xx/em28xx-cards.c-2681- .driver_info = EM2883_BOARD_KWORLD_HYBRID_330U },
drivers/media/usb/em28xx/em28xx-cards.c:2682: { USB_DEVICE(0xeb1a, 0xe320),
drivers/media/usb/em28xx/em28xx-cards.c-2683- .driver_info = EM2880_BOARD_MSI_DIGIVOX_AD_II },
drivers/media/usb/em28xx/em28xx-cards.c:2684: { USB_DEVICE(0xeb1a, 0xe323),
drivers/media/usb/em28xx/em28xx-cards.c-2685- .driver_info = EM2882_BOARD_KWORLD_VS_DVBT },
drivers/media/usb/em28xx/em28xx-cards.c:2686: { USB_DEVICE(0xeb1a, 0xe350),
drivers/media/usb/em28xx/em28xx-cards.c-2687- .driver_info = EM2870_BOARD_KWORLD_350U },
drivers/media/usb/em28xx/em28xx-cards.c:2688: { USB_DEVICE(0xeb1a, 0xe355),
drivers/media/usb/em28xx/em28xx-cards.c-2689- .driver_info = EM2870_BOARD_KWORLD_355U },
drivers/media/usb/em28xx/em28xx-cards.c:2690: { USB_DEVICE(0xeb1a, 0x2801),
drivers/media/usb/em28xx/em28xx-cards.c-2691- .driver_info = EM2800_BOARD_GRABBEEX_USB2800 },
drivers/media/usb/em28xx/em28xx-cards.c:2692: { USB_DEVICE(0xeb1a, 0xe357),
drivers/media/usb/em28xx/em28xx-cards.c-2693- .driver_info = EM2870_BOARD_KWORLD_355U },
drivers/media/usb/em28xx/em28xx-cards.c:2694: { USB_DEVICE(0xeb1a, 0xe359),
drivers/media/usb/em28xx/em28xx-cards.c-2695- .driver_info = EM2870_BOARD_KWORLD_355U },
--
drivers/media/usb/em28xx/em28xx-cards.c-2789- .driver_info = EM2820_BOARD_IODATA_GVMVP_SZ },
drivers/media/usb/em28xx/em28xx-cards.c:2790: { USB_DEVICE(0xeb1a, 0x50a6),
drivers/media/usb/em28xx/em28xx-cards.c-2791- .driver_info = EM2860_BOARD_GADMEI_UTV330 },
--
drivers/media/usb/em28xx/em28xx-cards.c-2805- .driver_info = EM2884_BOARD_C3TECH_DIGITAL_DUO },
drivers/media/usb/em28xx/em28xx-cards.c:2806: { USB_DEVICE(0xeb1a, 0x5006),
drivers/media/usb/em28xx/em28xx-cards.c-2807- .driver_info = EM2860_BOARD_HT_VIDBOX_NW03 },
--
drivers/media/usb/em28xx/em28xx-cards.c-2845- .driver_info = EM2861_BOARD_LEADTEK_VC100 },
drivers/media/usb/em28xx/em28xx-cards.c:2846: { USB_DEVICE(0xeb1a, 0x8179),
drivers/media/usb/em28xx/em28xx-cards.c-2847- .driver_info = EM28178_BOARD_TERRATEC_T2_STICK_HD },
--
drivers/media/usb/em28xx/em28xx-cards.c-2849- .driver_info = EM28178_BOARD_PLEX_PX_BCUD },
drivers/media/usb/em28xx/em28xx-cards.c:2850: { USB_DEVICE(0xeb1a, 0x5051), /* Ion Video 2 PC MKII / Startech svid2usb23 / Raygo R12-41373 */
drivers/media/usb/em28xx/em28xx-cards.c-2851- .driver_info = EM2860_BOARD_TVP5150_REFERENCE_DESIGN },
--
drivers/media/usb/em28xx/em28xx-cards.c=3574=static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev,
--
drivers/media/usb/em28xx/em28xx-cards.c-3618- chip_name = "em2710/2820";
drivers/media/usb/em28xx/em28xx-cards.c:3619: if (le16_to_cpu(udev->descriptor.idVendor) == 0xeb1a) {
drivers/media/usb/em28xx/em28xx-cards.c-3620- __le16 idProd = udev->descriptor.idProduct;
--
include/media/dvb-usb-ids.h-45-#define USB_VID_ELGATO 0x0fd9
include/media/dvb-usb-ids.h:46:#define USB_VID_EMPIA 0xeb1a
include/media/dvb-usb-ids.h-47-#define USB_VID_EVOLUTEPC 0x1e59
]
|
| 75/2 |
2026/05/19 14:23 |
llm |
crash-repro-finder |
1m
Model:
Tokens:
input: 164250
output: 393
thoughts: 512
Thoughts: **Navigating the USB Chaos**
Okay, so I'm trying to figure out how to reliably trigger something with `vusb` via `syzkaller`, and I've hit a roadblock. I initially thought `init_vusb.go` was kernel code, but it's actually in the syzkaller source. So, grepping for its behavior here is a dead end. Damn.
I know `init_vusb.go` is the key – it's where the `idVendor` and `idProduct` get patched when using the `syz_usb_connect` call. The obvious thought is to use `syz_usb_connect` directly and let it pick a random device, but I want to be *more* precise. I considered using a specific variant, like `syz_usb_connect$em28xx`, but that configuration isn't in `vusb.txt`, so that's out. Shoot, is *any* `syz_usb_connect` variant even usable?
So, back to the initial idea: use `syz_usb_connect` and just let syzkaller handle the patching. The issue is that the random patching might not hit the `em28xx` values that I want. But, wait... I had that failure message about "wrong string arg" when using `&AUTO="\x12\x01..."`! Maybe I don't *need* a string; maybe I can use an array of bytes. I know syzkaller has that `array-arg` syntax.
If I define `&AUTO=ANY=[0x12, 0x01, 0x00, 0x02, 0xff, 0xff, 0xff, 0x40, 0x1a, 0xeb, 0x00, 0x28, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x09, 0x02, 0x19, 0x00, 0x01, 0x01, 0x00, 0x80, 0xfa, 0x09, 0x04, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0x00, 0x07, 0x05, 0x82, 0x02, 0x00, 0x02, 0x00]`, then maybe the patching will work, even if it's random. Let's try this and see what happens.
|
| 76/2 |
2026/05/19 14:25 |
tool |
reproduce-crash |
0m
Error:
Args: map[ReproSyz:r0 = syz_usb_connect(3, 0x2b, &AUTO=ANY=[0x12, 0x01, 0x00, 0x02, 0xff, 0xff, 0xff, 0x40, 0x1a, 0xeb, 0x00, 0x28, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x09, 0x02, 0x19, 0x00, 0x01, 0x01, 0x00, 0x80, 0xfa, 0x09, 0x04, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0x00, 0x07, 0x05, 0x82, 0x02, 0x00, 0x02, 0x00], &AUTO={0, 0, 0, 0, 0, []})
openat(0xffffffffffffff9c, &AUTO="/dev/video0\x00", 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO="/dev/video1\x00", 0x2, 0x0) (async)
syz_usb_disconnect(r0) (async)
]
Results: map[CoverageID: ReproducedBugTitle: ReproducedCrashReport:]
|
| 77/2 |
2026/05/19 14:25 |
llm |
crash-repro-finder |
1m
Model:
Tokens:
input: 166088
output: 333
thoughts: 209
Thoughts: **Navigating the Nuances of `ANY` in Syzkaller**
Okay, so I'm diving back into this `ANY` type in syzkaller. Initially, I was thinking it's a straightforward union of all possible types, right? My first instinct was to reach for the `@` operator to define the union options. But then, a mental flag went up: "Wait, isn't `ANY` something...special in syzkaller?" It's not a standard union like in some other type systems.
Right, `ANY` has its own unique behavior. The question now is, if I want to feed an array of bytes to `ANY`, what's the correct syntax? Could I use something like `&AUTO=ANY=[@ANYBLOB="1201..."]`? I should probably check the source code, specifically `prog/encoding.go`, or just stick with a struct format.
Actually, using a struct seems simpler. If I'm dealing with a USB device descriptor, why not just use `usb_device_descriptor` and let syzkaller handle the serialization? It’s cleaner and less error-prone. Ah, but there's a snag: `idVendor` and `idProduct` are defined as `const[0, int16]`. Hmm.
So, if I just plop in `0xeb1a`, expecting it to work, syzkaller is going to throw a fit, complaining about a "wrong const arg." I'm pretty sure syzkaller won't like that. The proper response is probably to enter `0` as the value and let syzkaller handle the internal conversion. Best approach is to just run a test case and see the exact error message. Let’s get to it and confirm the expected error.
|
| 78/2 |
2026/05/19 14:26 |
tool |
reproduce-crash |
0m
Error:
Args: map[ReproSyz:r0 = syz_usb_connect(3, 0x2b, &AUTO={{0x12, 0x1, 0x200, 0xff, 0xff, 0xff, 0x40, 0xeb1a, 0x2800, 0x100, 1, 2, 3, 1, [{{0x9, 0x2, 0x19, 1, 1, 0, 0x80, 0xfa, @void, [{{0x9, 0x4, 0, 0, 1, 0xff, 0xff, 0xff, 0, @void, [{{0x7, 0x5, 0x82, 0x2, 0x200, 0, @void}}]}}]}}]}}, &AUTO={0, 0, 0, 0, 0, []})
openat(0xffffffffffffff9c, &AUTO="/dev/video0\x00", 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO="/dev/video1\x00", 0x2, 0x0) (async)
syz_usb_disconnect(r0) (async)
]
Results: map[CoverageID: ReproducedBugTitle: ReproducedCrashReport:]
|
| 79/2 |
2026/05/19 14:26 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 167273
output: 324
thoughts: 153
Thoughts: **Aha! The Problem's Revealed!**
Okay, hold on a second! It wasn't the hex value `0xeb1a` that triggered the error, that's not what the compiler was complaining about! It was the `@void` annotation that was the issue. I need to figure out why. Let's delve into the definition of `usb_config_descriptor_verbose_t`. I'll have to refer to the structure:
```
type usb_config_descriptor_verbose_t[NUM, IFSNUM, ICONFIG, ATTRS, POWER, EXTRA, IFS] {
...
extra EXTRA
interfaces IFS
} [packed]
```
Alright, the key is the `EXTRA` field. In the context of `usb_device_descriptor`, `EXTRA` is defined as `void`. Now, it's starting to click. `void` is fundamentally a type with a size of zero. This means, *no* argument is expected for it. That's it! I was overthinking it by including `@void`. The solution is simple: I'll just remove that `@void` annotation. Problem solved!
|
| 80/2 |
2026/05/19 14:27 |
tool |
reproduce-crash |
0m
Error:
Args: map[ReproSyz:r0 = syz_usb_connect(3, 0x2b, &AUTO={{0x12, 0x1, 0x200, 0xff, 0xff, 0xff, 0x40, 0xeb1a, 0x2800, 0x100, 1, 2, 3, 1, [{{0x9, 0x2, 0x19, 1, 1, 0, 0x80, 0xfa, [{{0x9, 0x4, 0, 0, 1, 0xff, 0xff, 0xff, 0, [{{0x7, 0x5, 0x82, 0x2, 0x200, 0}}]}}]}}]}}, &AUTO={0, 0, 0, 0, 0, []})
openat(0xffffffffffffff9c, &AUTO="/dev/video0\x00", 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO="/dev/video1\x00", 0x2, 0x0) (async)
syz_usb_disconnect(r0) (async)
]
Results: map[CoverageID: ReproducedBugTitle: ReproducedCrashReport:]
|
| 81/2 |
2026/05/19 14:27 |
llm |
crash-repro-finder |
1m
Model:
Tokens:
input: 168252
output: 327
thoughts: 200
Thoughts: **Analyzing USB Interface and Endpoint Descriptors**
Okay, let me think this through. I'm looking at the `usb_interface_descriptor_t` structure definition, and specifically focusing on that `EXTRA` field. Aha! It's defined as `array[usb_interface_extra_descriptor, 0:2]`. This means it's an array, but the lower bound is 0 and the upper bound is 2. So it can hold a maximum of two `usb_interface_extra_descriptor` elements, or it can be empty.
Let me translate this to an actual descriptor. Okay, in practice, the `EXTRA` element becomes `[]`, meaning an empty array.
Alright, so let me apply this thinking to the `usb_endpoint_descriptor`. Just checking, the `EXTRA` here is `array[usb_endpoint_extra_descriptor, 0:2]`. Right, so exactly the same. So that will become `[]` also.
Okay, I think I've got a handle on this now. I'm going to start implementing the descriptors assuming the `EXTRA` field is just an empty array. Let's see how that works.
|
| 82/2 |
2026/05/19 14:28 |
tool |
reproduce-crash |
0m
Error:
Args: map[ReproSyz:r0 = syz_usb_connect(3, 0x2b, &AUTO={{0x12, 0x1, 0x200, 0xff, 0xff, 0xff, 0x40, 0xeb1a, 0x2800, 0x100, 1, 2, 3, 1, [{{0x9, 0x2, 0x19, 1, 1, 0, 0x80, 0xfa, [{{0x9, 0x4, 0, 0, 1, 0xff, 0xff, 0xff, 0, [], [{{0x7, 0x5, 0x82, 0x2, 0x200, 0, []}}]}}]}}]}}, &AUTO={0, 0, 0, 0, 0, []})
openat(0xffffffffffffff9c, &AUTO="/dev/video0\x00", 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO="/dev/video1\x00", 0x2, 0x0) (async)
syz_usb_disconnect(r0) (async)
]
Results: map[CoverageID: ReproducedBugTitle: ReproducedCrashReport:]
|
| 83/2 |
2026/05/19 14:28 |
llm |
crash-repro-finder |
1m
Model:
Tokens:
input: 169286
output: 306
thoughts: 1950
Thoughts: **Debugging USB Descriptor Initialization**
Okay, let's break this down. I was initially thrown by the `usb_config_descriptor_t` definition and the presence of `EXTRA` as `void`. My initial thought was that if `EXTRA` is `void`, it shouldn't be in the struct's arguments. Then, after looking at `usb_config_descriptor_verbose_t`, I realized that the `EXTRA` field is *not* present in the struct arguments, as expected. This meant that `usb_config_descriptor` has 9 fields: `bLength`, `bDescriptorType`, `wTotalLength`, `bNumInterfaces`, `bConfigurationValue`, `iConfiguration`, `bmAttributes`, `bMaxPower`, and `interfaces`.
I tried providing the corresponding arguments: `0x9, 0x2, 0x19, 1, 1, 0, 0x80, 0xfa, [{{...}}]`. That seemed correct, but I got the error: `wrong array arg *prog.BufferType`.
I realized that `interfaces` is actually of type `IFS`, which expands to an array of `usb_interface_descriptor` with size 1 to 4 in this case. Also, `usb_interface_descriptor` itself is a struct, containing inner structs and arrays. So, the `[{{...}}]` was an array containing one struct. Then, I remembered that `usb_config_descriptor` is defined as a struct containing an inner struct called `inner`.
Therefore, I need to represent the entire structure as `{{0x9, 0x2, ...}}` when used in a nested data structure, such as inside `usb_config_descriptor`. So I wrote it out as `{{0x9, 0x2, 0x19, 1, 1, 0, 0x80, 0xfa, [{{0x9, 0x4, 0, 0, 1, 0xff, 0xff, 0xff, 0, [], [{{0x7, 0x5, 0x82, 0x2, 0x200, 0, []}}]}}]}}`. This should be what I want!
Yet, I was still getting the `wrong array arg *prog.BufferType` error.
I re-examined the definitions, specifically `usb_config_descriptor_ifaces_array_t` which uses the `len[interfaces, int8]` and realized that the field `bNumInterfaces` is calculated automatically using the `len` keyword. Thus, it does *not* require an argument in the struct initialization. This `len` field is similar to what I have with `usb_device_descriptor_verbose_t`, specifically `bNumConfigurations`, and also `wTotalLength` in `usb_config_descriptor_verbose_t`, and `bNumEndpoints` in `usb_interface_descriptor_verbose_t`. These are auto-calculated and do not accept args.
Finally, I considered the fields in the `usb_device_descriptor_verbose_t`: specifically, `idVendor` and `idProduct`. These are declared as `const`, meaning they do not take arguments. If they don't take arguments, I can *not* change their values directly! My initialization will *always* serialize these as `0`, and then, `init_vusb.go` patches them. However, `init_vusb.go` patches them with a random value! Therefore, if I want to force specific `idVendor` and `idProduct` values (like `0xeb1a:0x2800`), I *cannot* use the `usb_device_descriptor` struct.
The solution is to use the `ANY` pointer type. I tried `&AUTO=ANY="..."` and it failed. Then I tried `&AUTO=""`. I will use the raw bytes! Let's try `&AUTO="\x12\x01\x00\x02\xff\xff\xff\x40\x1a\xeb\x00\x28\x00\x01\x00\x00\x00\x01\x09\x02\x19\x00\x01\x01\x00\x80\xfa\x09\x04\x00\x00\x01\xff\xff\xff\x00\x07\x05\x82\x02\x00\x02\x00"`
|
| 84/2 |
2026/05/19 14:29 |
tool |
reproduce-crash |
0m
Error:
Args: map[ReproSyz:r0 = syz_usb_connect(3, 0x2b, &AUTO="\x12\x01\x00\x02\xff\xff\xff\x40\x1a\xeb\x00\x28\x00\x01\x00\x00\x00\x01\x09\x02\x19\x00\x01\x01\x00\x80\xfa\x09\x04\x00\x00\x01\xff\xff\xff\x00\x07\x05\x82\x02\x00\x02\x00", &AUTO={0, 0, 0, 0, 0, []})
openat(0xffffffffffffff9c, &AUTO="/dev/video0\x00", 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO="/dev/video1\x00", 0x2, 0x0) (async)
syz_usb_disconnect(r0) (async)
]
Results: map[CoverageID: ReproducedBugTitle: ReproducedCrashReport:]
|
| 85/2 |
2026/05/19 14:29 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 172796
output: 312
thoughts: 276
Thoughts: **My Syzkaller Debugging Journey**
Okay, so `syz_usb_connect` is giving me grief. It's expecting a pointer to a `usb_device_descriptor`, right? And I initially tried passing a simple string, and *duh*, it failed because it needs a struct. The question is, how do I inject a string *into* a struct pointer? Is there some trick? The `ANY` type! I remember reading about that.
But how do I *use* `ANY`? Just `&ANY="..."` didn't work. Let me check the syntax… Aha! It’s `pointer-arg = "&" pointer-arg-addr ["=ANY"] "=" arg`. So, logically, `&AUTO=ANY="..."` *should* work. Nope. Got a "wrong string arg" error. Hmm… Why? Oh right! `ANY` expects a byte *array*, not a string! Okay, let's try `&AUTO=ANY=[0x12, 0x01, ...]`.
Damn, that failed too! Now I'm getting "wrong int arg *prog.UnionType". Why am I seeing `UnionType`? Oh! Because `ANY` is a bloody *union*! In syzkaller, `ANY` is this catch-all union of every possible type. Okay, so I need to specify which union member I want. What are the options? Let me see… there’s `ANYRES16`, `ANYRES32`, `ANYRES64`, `ANYBLOB`, etc. Right! Since I'm passing what *effectively* is a blob of data, I should try `@ANYBLOB="..."`. Let's see if that works.
|
| 86/2 |
2026/05/19 14:30 |
tool |
reproduce-crash |
0m
Error:
Args: map[ReproSyz:r0 = syz_usb_connect(3, 0x2b, &AUTO=ANY=@ANYBLOB="\x12\x01\x00\x02\xff\xff\xff\x40\x1a\xeb\x00\x28\x00\x01\x00\x00\x00\x01\x09\x02\x19\x00\x01\x01\x00\x80\xfa\x09\x04\x00\x00\x01\xff\xff\xff\x00\x07\x05\x82\x02\x00\x02\x00", &AUTO={0, 0, 0, 0, 0, []})
openat(0xffffffffffffff9c, &AUTO="/dev/video0\x00", 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO="/dev/video1\x00", 0x2, 0x0) (async)
syz_usb_disconnect(r0) (async)
]
Results: map[CoverageID: ReproducedBugTitle: ReproducedCrashReport:]
|
| 87/2 |
2026/05/19 14:30 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 173994
output: 310
thoughts: 520
Thoughts: **USB Fuzzing Strategy: Refining the Approach**
Okay, so I'm thinking through this USB fuzzing approach for `em28xx`. The initial hunch was to leverage `ANY` in syzkaller. I need to remember that `ANY` is actually `ANYUNION`. Let's clarify, either by checking `prog/encoding.go`, or using the struct that's defined for `ANY` instead.
I thought, initially, just using `syz_usb_connect` with `usb_device_descriptor` should get syzkaller to patch the descriptor. Great, but how do I *force* it to patch it to `0xeb1a:0x2800`? I don't need to force it! It looks like if I just use the base `syz_usb_connect` call and the `usb_device_descriptor`, syzkaller *will* patch *something*. Crucially, if it patches to the right `em28xx` vendor/product ID, the bug will trigger.
Ah, but *how* is the patch happening? `init_vusb.go` is the key. It looks like it patches based on the `syz_usb_connect` variant that's used. If there's *no* `syz_usb_connect$em28xx`, `init_vusb.go` *won't* specifically target the `em28xx` ID. Wait. It looks like `init_vusb.go` patches to a *random* ID from a list of *all* known USB IDs! That's a problem. That means the chance of hitting the right ID is small and could take forever.
Is there a way to guide this randomness? Can I use `syz_usb_connect$ath9k`, for example? That has a fixed `idVendor` of `0xcf3`. But is there any pre-defined `syz_usb_connect` variant that *already* sets the vendor ID to `0xeb1a`? No.
Okay, let's pivot. Can I feed `syz_usb_connect` a *custom* `usb_device_descriptor` using `ANY`? The idea is something like `&AUTO=ANY=[0x12, 0x01, ...]`. Nope. The error is saying I have a "wrong int arg *prog.UnionType". Right, `ANY` is a union, `ANYUNION` specifically. Let's try to figure out which fields are in the union. It's an `ANYUNION`, so I need to check those members. I'll test `@ANYRES16`, `@ANYRES32`, or `@ANYBLOB`.
I'm getting closer. The error I'm seeing says "wrong union arg for 'array'". That means `ANY` must have a field named "array"! Time to try `@array="..."` or `@array=[...]`!
|
| 88/2 |
2026/05/19 14:30 |
tool |
reproduce-crash |
0m
Error:
Args: map[ReproSyz:r0 = syz_usb_connect(3, 0x2b, &AUTO=ANY=@array="\x12\x01\x00\x02\xff\xff\xff\x40\x1a\xeb\x00\x28\x00\x01\x00\x00\x00\x01\x09\x02\x19\x00\x01\x01\x00\x80\xfa\x09\x04\x00\x00\x01\xff\xff\xff\x00\x07\x05\x82\x02\x00\x02\x00", &AUTO={0, 0, 0, 0, 0, []})
openat(0xffffffffffffff9c, &AUTO="/dev/video0\x00", 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO="/dev/video1\x00", 0x2, 0x0) (async)
syz_usb_disconnect(r0) (async)
]
Results: map[CoverageID: ReproducedBugTitle: ReproducedCrashReport:]
|
| 89/2 |
2026/05/19 14:30 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 175700
output: 327
thoughts: 726
Thoughts: **Debugging a Syzkaller USB Descriptor Issue**
Okay, so I'm seeing this "wrong union arg for 'array'" error, and I need to figure out what's going on. First, I thought maybe it's misinterpreting the option name itself – is it expecting "array" as the *name* of the option, or the *type*? No, the error message suggests it's getting something it doesn't expect in place of an option name.
Then, I tried `@ANYBLOB`, but got the same error. That means the union option isn't valid, it's expecting an option for an `array`. But wait, `ANY` isn't a union, it's a special type.
Aha! `usb_device_descriptor` is a struct, not a union. If I try `&AUTO=ANY="..."`, it's trying to interpret `ANY` as a `usb_device_descriptor`, which is wrong! My initial approach is off. The problem is I'm assuming `@ANY` works for a `usb_device_descriptor`.
Let me look at the struct definition for `usb_device_descriptor`. Okay, it contains `inner`. `inner` is a `usb_device_descriptor_t[0, 0, 0, 0, 0, 0, array[usb_config_descriptor, 1]]`. So, `&AUTO=ANY` is attempting to cast a pointer to `ANY`, but the right syzkaller syntax for an ANY pointer is actually `&ANY=...`. I should look at `prog/encoding.go` for the exact syntax, but I'll try `&AUTO=""` first – that still failed.
Okay, instead of messing with the `ANY` type, there's another approach: I can use `syz_usb_connect` with the `usb_device_descriptor` and *not* specify `idVendor` and `idProduct`. If I don't set these, syzkaller will serialize them as `0`, and then `init_vusb.go` can patch them.
Will `init_vusb.go` patch them to the `em28xx` values? If I run this repeatedly, it might. But wait, `init_vusb.go` only patches if those values are `0`! So, if I pass `0` for `idVendor` and `idProduct`, it should be patched. If I pass `0xeb1a` or some other value, the patch won't happen.
Let me try passing something like `0xeb1a` to see if the tool catches it. If I get an error like "wrong const arg: want 0, got 0xeb1a", that confirms my theory. I need to test that now!
|
| 90/2 |
2026/05/19 14:30 |
tool |
reproduce-crash |
0m
Error:
Args: map[ReproSyz:r0 = syz_usb_connect(3, 0x2b, &AUTO={{0x12, 0x1, 0x200, 0xff, 0xff, 0xff, 0x40, 0xeb1a, 0x2800, 0x100, 1, 2, 3, 1, [{{0x9, 0x2, 0x19, 1, 1, 0, 0x80, 0xfa, [{{0x9, 0x4, 0, 0, 1, 0xff, 0xff, 0xff, 0, [], [{{0x7, 0x5, 0x82, 0x2, 0x200, 0, []}}]}}]}}]}}, &AUTO={0, 0, 0, 0, 0, []})
openat(0xffffffffffffff9c, &AUTO="/dev/video0\x00", 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO="/dev/video1\x00", 0x2, 0x0) (async)
syz_usb_disconnect(r0) (async)
]
Results: map[CoverageID: ReproducedBugTitle: ReproducedCrashReport:]
|
| 91/2 |
2026/05/19 14:30 |
llm |
crash-repro-finder |
1m
Model:
Tokens:
input: 177617
output: 313
thoughts: 1347
Thoughts: **Debugging USB Descriptor Initialization**
Okay, so it didn't like `0xeb1a`. It complained about `[{{0x9, 0x4...}}]` specifically! Right, let's go back and examine `usb_config_descriptor_t`. Looking at its verbose form, I see:
```
type usb_config_descriptor_t[NUM, IFSNUM, IFS] usb_config_descriptor_verbose_t[NUM, IFSNUM, int8, flags[usb_config_attributes, int8], int8, void, IFS]
```
Aha! `usb_config_descriptor_verbose_t` has `EXTRA` and `IFS`. And if `EXTRA` is `void`, it's omitted. This means the fields are: `bLength`, `bDescriptorType`, `wTotalLength`, `bNumInterfaces`, `bConfigurationValue`, `iConfiguration`, `bmAttributes`, `bMaxPower`, and `interfaces`.
Now, if we look closer at `IFSNUM`, it's actually `len[interfaces, int8]`, which makes `bNumInterfaces` also a `len` field, and therefore, it's *omitted*. So the arguments I pass are: `bConfigurationValue`, `iConfiguration`, `bmAttributes`, `bMaxPower`, and `interfaces`. Let's count them, I passed: `0x9, 0x2, 0x19, 1, 1, 0, 0x80, 0xfa, [{{...}}]`, but that is 9 arguments, and only 5 are expected! Right! Fields declared as `const` and `len` are omitted in the argument list!
Now let's check `usb_device_descriptor_verbose_t`:
1. `bLength` (const) -> omitted
2. `bDescriptorType` (const) -> omitted
3. `bcdUSB`
4. `bDeviceClass` (const) -> omitted
5. `bDeviceSubClass` (const) -> omitted
6. `bDeviceProtocol` (const) -> omitted
7. `bMaxPacketSize0`
8. `idVendor` (const) -> omitted
9. `idProduct` (const) -> omitted
10. `bcdDevice` (const) -> omitted
11. `iManufacturer` (const) -> omitted
12. `iProduct` (const) -> omitted
13. `iSerialNumber` (const) -> omitted
14. `bNumConfigurations` (len) -> omitted
15. `configs`
Okay, `usb_device_descriptor_t` really only wants 3 arguments: `bcdUSB`, `bMaxPacketSize0`, and `configs`. But I'm providing `0x12, 0x1, 0x200, 0xff, 0xff, 0xff, 0x40, 0xeb1a, 0x2800, 0x100, 1, 2, 3, 1, [{{...}}]}`, that is 15 arguments! That's why it failed! So, let's provide only: `0x200, 0x40, [{{...}}]`.
Wait a minute, how am I supposed to set `idVendor` and `idProduct` to `0xeb1a:0x2800` when those are `const` and omitted? I can't.
Looking at `usb_device_descriptor`:
```
type usb_device_descriptor_t[CLASS, SUBCLASS, PROTOCOL, VENDOR, PRODUCT, DEVICE, CFS] usb_device_descriptor_verbose_t[flags[usb_versions, int16], CLASS, SUBCLASS, PROTOCOL, flags[usb_device_max_packet_sizes, int8], VENDOR, PRODUCT, DEVICE, CFS]
```
Right, it's `usb_device_descriptor_t[0, 0, 0, 0, 0, 0, array[usb_config_descriptor, 1]]`. So `VENDOR` and `PRODUCT` are zero, and they are const. I can't set them with `usb_device_descriptor`. I'll have to use `ANY` or some different struct.
Okay, how to use this `ANY` pointer? If I use `&AUTO=""`, it fails with "wrong string arg". Can I use `&AUTO=ANY=[0x12, ...]`? Nope, that failed with "wrong int arg *prog.UnionType". Right, `ANY` is a union.
So
|
| 92/2 |
2026/05/19 14:31 |
tool |
reproduce-crash |
0m
Error:
Args: map[ReproSyz:r0 = syz_usb_connect(3, 0x2b, &AUTO=ANY=@ANYRES16="\x12\x01\x00\x02\xff\xff\xff\x40\x1a\xeb\x00\x28\x00\x01\x00\x00\x00\x01\x09\x02\x19\x00\x01\x01\x00\x80\xfa\x09\x04\x00\x00\x01\xff\xff\xff\x00\x07\x05\x82\x02\x00\x02\x00", &AUTO={0, 0, 0, 0, 0, []})
openat(0xffffffffffffff9c, &AUTO="/dev/video0\x00", 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO="/dev/video1\x00", 0x2, 0x0) (async)
syz_usb_disconnect(r0) (async)
]
Results: map[CoverageID: ReproducedBugTitle: ReproducedCrashReport:]
|
| 93/2 |
2026/05/19 14:31 |
llm |
crash-repro-finder |
1m
Model:
Tokens:
input: 180542
output: 234
thoughts: 1907
Thoughts: **Debugging USB Descriptor Initialization in Syzkaller**
Okay, so I'm hitting this "wrong union arg for 'array'" error, and it's got me thinking. My initial thought was that the union option wasn't `@ANYRES16`, but the error's pointing me towards the `array` field in the USB descriptor. I started by testing `@array`, but the error persisted. It's becoming clearer that the problem isn't the specific type, but how the system expects to interpret the `array` field. Is the issue that `array` is not itself a valid union type?
I'm looking at `usb_device_descriptor`, which is a struct with a single field named `inner`. The goal is to set this struct using `@AUTO`, to avoid patching the values. Using `ANY` doesn't work directly because it's meant for pointers, not structs. The goal is to pass raw bytes, so using the patched version is out.
The `dev` is defined as `ptr[in, usb_device_descriptor]`. Using `&AUTO=ANY="..."` suggests the pointer points to `ANY`, so that seems valid. However, that still doesn't explain the `wrong union arg` error. Is `ANY` itself a union, with potential options like `ANYRES16`, `ANYRES32`, etc.?
I'm considering my options here. Should I dive into `prog/encoding.go`, or just let syzkaller patch a `syz_usb_connect` call with a `usb_device_descriptor`? The latter seems like a simpler first step, as syzkaller will fill in vendor/product IDs. However, this risks triggering the wrong driver - there are many.
Could I use a specific syscall variant like `syz_usb_connect$ath9k`, which expects `usb_device_descriptor_ath9k`? That would fix the vendor/product IDs to known ones, but that won't help here.
I can't define new syscall variants, so I'll try correctly constructing a struct for `syz_usb_connect` with `&AUTO={...}`. The key is correctly crafting the USB descriptor data:
I need to map the struct fields and sizes to their `syzkaller` representation. Specifically, `usb_config_descriptor_t`, `usb_interface_descriptor_t`, and `usb_endpoint_descriptor_t`.
After studying the definitions, my updated struct is as follows:
```
&AUTO={
{
0x200, 0x40,
[
{
{
1, 0, 0x80, 0xfa,
[
{
{
0, 0, 0xff, 0xff, 0xff, 0, [],
[
{
{
0x82, 0x2, 0x200, 0, 0, 0, []
}
}
]
}
}
]
}
}
]
}
}
```
Now, let's see if this revised structure finally works!
|
| 94/2 |
2026/05/19 14:33 |
tool |
reproduce-crash |
0m
Error:
Args: map[ReproSyz:r0 = syz_usb_connect(3, 0x2b, &AUTO={{0x200, 0x40, [{{1, 0, 0x80, 0xfa, [{{0, 0, 0xff, 0xff, 0xff, 0, [], [{{0x82, 0x2, 0x200, 0, 0, 0, []}}]}}]}}]}}, &AUTO={0, 0, 0, 0, 0, []})
openat(0xffffffffffffff9c, &AUTO="/dev/video0\x00", 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO="/dev/video1\x00", 0x2, 0x0) (async)
syz_usb_disconnect(r0) (async)
]
Results: map[CoverageID: ReproducedBugTitle: ReproducedCrashReport:]
|
| 95/2 |
2026/05/19 14:33 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 183547
output: 18
thoughts: 4213
Thoughts: **Debugging USB Device Descriptor Parsing**
Okay, here's what I've got so far, thinking it through step-by-step:
The error "wrong array arg *prog.FlagsType" is the core issue. I need to understand what type is expected versus what's being provided. Initially, I thought it was a simple type mismatch with `configs`, because the initial declaration seems to suggest it's an array, but the context indicates this might not be right. I'm looking at `usb_device_descriptor_verbose_t`. The setup seems to be: I have `bcdUSB`, `bMaxPacketSize0`, and the `configs` array. The error flags that the `configs` array is problematic, indicating that a `FlagsType` is expected instead.
Digging deeper into the structure: the `usb_device_descriptor_t` definition is the key. I see that `CLASS`, `SUBCLASS`, etc., are all passed as '0' in the `usb_device_descriptor`. This makes them effectively `const[0, int8]` types, and they are omitted! Because `syzkaller` patches those fields via Go code, they are not present in the struct.
I'm starting to suspect that the problem is not with `usb_config_descriptor` directly, because its definition looks okay with NUM, IFSNUM, and IFS all having proper arguments. The issue is about where the error is complaining within the definition of the larger USB device.
I'm stepping through the data. It appears the arguments I'm providing - `0x200` for `bcdUSB`, `0x40` for `bMaxPacketSize0`, and the `configs` array- should be correct. The error points to the `configs` array. However, `configs` is a *CFS* which is another `array` type.
The `wrong array arg *prog.FlagsType` is really puzzling. I check the `usb_device_descriptor_t` and `usb_device_descriptor_verbose_t` and it's all fine. So I come to the conclusion that maybe the problem doesn't lie in the structure I'm using, or even in my setup, but perhaps in how `syz_usb_connect` handles the descriptors. I note the issue is with the arguments being provided, perhaps a field I'm omitting from the function definition.
Since I don't need to specify the exact USB device description, I should let `syzkaller` generate the descriptor. But then the exact bug may not be triggered. Instead, I should try to trigger the crash using any device, as the bug is in `em28xx` and should trigger via a device connected to udev. This is a possibility that I can explore. I'll focus on just using `syz_usb_connect`.
|
| 96/2 |
2026/05/19 14:33 |
tool |
grepper |
0m
Args:
Results: map[Output:
Full output is too long, showing 500 out of 4698 lines.
Use more precise expression if possible.
[Documentation/.renames.txt=729=media/v4l-drivers/cx88-devel driver-api/media/drivers/cx88-devel
Documentation/.renames.txt:730:media/v4l-drivers/em28xx-cardlist admin-guide/media/em28xx-cardlist
Documentation/.renames.txt-731-media/v4l-drivers/fimc admin-guide/media/fimc
--
Documentation/admin-guide/media/usb-cardlist.rst=82=dvb-usb-vp7045 TwinhanDTV Alpha/MagicBoxII, DNTV tinyUSB2, Beetle USB2.0
Documentation/admin-guide/media/usb-cardlist.rst:83:em28xx Empia EM28xx USB devices
Documentation/admin-guide/media/usb-cardlist.rst-84-go7007 WIS GO7007 MPEG encoder
--
Documentation/admin-guide/media/usb-cardlist.rst=98=zd1301 ZyDAS ZD1301
--
Documentation/admin-guide/media/usb-cardlist.rst-105- cx231xx-cardlist
Documentation/admin-guide/media/usb-cardlist.rst:106: em28xx-cardlist
Documentation/admin-guide/media/usb-cardlist.rst-107- siano-cardlist
--
MAINTAINERS=9355=T: git git://linuxtv.org/media.git
MAINTAINERS:9356:F: Documentation/admin-guide/media/em28xx*
MAINTAINERS:9357:F: drivers/media/usb/em28xx/
MAINTAINERS-9358-
--
drivers/media/common/tveeprom.c=415=void tveeprom_hauppauge_analog(struct tveeprom *tvee,
--
drivers/media/common/tveeprom.c-456-
drivers/media/common/tveeprom.c:457: /* Different eeprom start offsets for em28xx, cx2388x and cx23418 */
drivers/media/common/tveeprom.c-458- if (eeprom_data[0] == 0x1a &&
--
drivers/media/common/tveeprom.c-461- eeprom_data[3] == 0x95)
drivers/media/common/tveeprom.c:462: start = 0xa0; /* Generic em28xx offset */
drivers/media/common/tveeprom.c-463- else if ((eeprom_data[0] & 0xe1) == 0x01 &&
--
drivers/media/i2c/Kconfig=332=config VIDEO_MT9V011
--
drivers/media/i2c/Kconfig-336- mt0v011 1.3 Mpixel camera. It currently only works with the
drivers/media/i2c/Kconfig:337: em28xx driver.
drivers/media/i2c/Kconfig-338-
--
drivers/media/usb/Kconfig=55=if (MEDIA_CAMERA_SUPPORT || MEDIA_ANALOG_TV_SUPPORT || MEDIA_DIGITAL_TV_SUPPORT)
--
drivers/media/usb/Kconfig-57-
drivers/media/usb/Kconfig:58:source "drivers/media/usb/em28xx/Kconfig"
drivers/media/usb/Kconfig-59-
--
drivers/media/usb/Makefile=26=obj-$(CONFIG_VIDEO_CX231XX) += cx231xx/
drivers/media/usb/Makefile:27:obj-$(CONFIG_VIDEO_EM28XX) += em28xx/
drivers/media/usb/Makefile-28-obj-$(CONFIG_VIDEO_GO7007) += go7007/
--
drivers/media/usb/au0828/au0828-input.c-6-//
drivers/media/usb/au0828/au0828-input.c:7:// Based on em28xx-input.c.
drivers/media/usb/au0828/au0828-input.c-8-
--
drivers/media/usb/au0828/au0828-video.c=1028=static int au0828_v4l2_close(struct file *filp)
--
drivers/media/usb/au0828/au0828-video.c-1061- * streaming. Exceptions are some very old USB tuner
drivers/media/usb/au0828/au0828-video.c:1062: * models such as em28xx-based WinTV USB2 which have
drivers/media/usb/au0828/au0828-video.c-1063- * a separate audio output jack. The devices that have
--
drivers/media/usb/cx231xx/cx231xx-audio.c-5- * Copyright (C) 2008 <srinivasa.deevi at conexant dot com>
drivers/media/usb/cx231xx/cx231xx-audio.c:6: * Based on em28xx driver
drivers/media/usb/cx231xx/cx231xx-audio.c-7- */
--
drivers/media/usb/cx231xx/cx231xx-cards.c-6- Copyright (C) 2008 <srinivasa.deevi at conexant dot com>
drivers/media/usb/cx231xx/cx231xx-cards.c:7: Based on em28xx driver
drivers/media/usb/cx231xx/cx231xx-cards.c-8-
--
drivers/media/usb/cx231xx/cx231xx-core.c-6- Copyright (C) 2008 <srinivasa.deevi at conexant dot com>
drivers/media/usb/cx231xx/cx231xx-core.c:7: Based on em28xx driver
drivers/media/usb/cx231xx/cx231xx-core.c-8-
--
drivers/media/usb/cx231xx/cx231xx-dvb.c-5- Copyright (C) 2008 <srinivasa.deevi at conexant dot com>
drivers/media/usb/cx231xx/cx231xx-dvb.c:6: Based on em28xx driver
drivers/media/usb/cx231xx/cx231xx-dvb.c-7-
--
drivers/media/usb/cx231xx/cx231xx-i2c.c-5- Copyright (C) 2008 <srinivasa.deevi at conexant dot com>
drivers/media/usb/cx231xx/cx231xx-i2c.c:6: Based on em28xx driver
drivers/media/usb/cx231xx/cx231xx-i2c.c-7- Based on Cx23885 driver
--
drivers/media/usb/cx231xx/cx231xx-video.c-6- Copyright (C) 2008 <srinivasa.deevi at conexant dot com>
drivers/media/usb/cx231xx/cx231xx-video.c:7: Based on em28xx driver
drivers/media/usb/cx231xx/cx231xx-video.c-8- Based on cx23885 driver
--
drivers/media/usb/cx231xx/cx231xx.h-5- Copyright (C) 2008 <srinivasa.deevi at conexant dot com>
drivers/media/usb/cx231xx/cx231xx.h:6: Based on em28xx driver
drivers/media/usb/cx231xx/cx231xx.h-7-
--
drivers/media/usb/em28xx/Kconfig=8=config VIDEO_EM28XX_V4L2
--
drivers/media/usb/em28xx/Kconfig-20- To compile this driver as a module, choose M here: the
drivers/media/usb/em28xx/Kconfig:21: module will be called em28xx
drivers/media/usb/em28xx/Kconfig-22-
drivers/media/usb/em28xx/Kconfig=23=config VIDEO_EM28XX_ALSA
--
drivers/media/usb/em28xx/Kconfig-30- This is not required for em2800/em2820/em2821 boards. However,
drivers/media/usb/em28xx/Kconfig:31: newer em28xx devices uses Vendor Class for audio, instead of
drivers/media/usb/em28xx/Kconfig-32- implementing the USB Audio Class. For those chips, this module
--
drivers/media/usb/em28xx/Kconfig-35- To compile this driver as a module, choose M here: the
drivers/media/usb/em28xx/Kconfig:36: module will be called em28xx-alsa
drivers/media/usb/em28xx/Kconfig-37-
drivers/media/usb/em28xx/Kconfig=38=config VIDEO_EM28XX_DVB
drivers/media/usb/em28xx/Kconfig:39: tristate "DVB/ATSC Support for em28xx based TV cards"
drivers/media/usb/em28xx/Kconfig-40- depends on VIDEO_EM28XX && DVB_CORE
--
drivers/media/usb/em28xx/Kconfig-73- This adds support for DVB cards based on the
drivers/media/usb/em28xx/Kconfig:74: Empiatech em28xx chips.
drivers/media/usb/em28xx/Kconfig-75-
drivers/media/usb/em28xx/Kconfig=76=config VIDEO_EM28XX_RC
--
drivers/media/usb/em28xx/Kconfig-83- help
drivers/media/usb/em28xx/Kconfig:84: Enables Remote Controller support on em28xx driver.
--
drivers/media/usb/em28xx/Makefile-1-# SPDX-License-Identifier: GPL-2.0
drivers/media/usb/em28xx/Makefile:2:em28xx-y += em28xx-core.o em28xx-i2c.o em28xx-cards.o em28xx-camera.o
drivers/media/usb/em28xx/Makefile-3-
drivers/media/usb/em28xx/Makefile:4:em28xx-v4l-objs := em28xx-video.o em28xx-vbi.o
drivers/media/usb/em28xx/Makefile:5:em28xx-alsa-objs := em28xx-audio.o
drivers/media/usb/em28xx/Makefile:6:em28xx-rc-objs := em28xx-input.o
drivers/media/usb/em28xx/Makefile-7-
drivers/media/usb/em28xx/Makefile:8:obj-$(CONFIG_VIDEO_EM28XX) += em28xx.o
drivers/media/usb/em28xx/Makefile:9:obj-$(CONFIG_VIDEO_EM28XX_V4L2) += em28xx-v4l.o
drivers/media/usb/em28xx/Makefile:10:obj-$(CONFIG_VIDEO_EM28XX_ALSA) += em28xx-alsa.o
drivers/media/usb/em28xx/Makefile:11:obj-$(CONFIG_VIDEO_EM28XX_DVB) += em28xx-dvb.o
drivers/media/usb/em28xx/Makefile:12:obj-$(CONFIG_VIDEO_EM28XX_RC) += em28xx-rc.o
drivers/media/usb/em28xx/Makefile-13-
--
drivers/media/usb/em28xx/em28xx-audio.c-13-
drivers/media/usb/em28xx/em28xx-audio.c:14:#include "em28xx.h"
drivers/media/usb/em28xx/em28xx-audio.c-15-
--
drivers/media/usb/em28xx/em28xx-audio.c=47=static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
drivers/media/usb/em28xx/em28xx-audio.c-48-
drivers/media/usb/em28xx/em28xx-audio.c:49:static int em28xx_deinit_isoc_audio(struct em28xx *dev)
drivers/media/usb/em28xx/em28xx-audio.c-50-{
--
drivers/media/usb/em28xx/em28xx-audio.c-65-
drivers/media/usb/em28xx/em28xx-audio.c:66:static void em28xx_audio_isocirq(struct urb *urb)
drivers/media/usb/em28xx/em28xx-audio.c-67-{
drivers/media/usb/em28xx/em28xx-audio.c:68: struct em28xx *dev = urb->context;
drivers/media/usb/em28xx/em28xx-audio.c-69- int i;
--
drivers/media/usb/em28xx/em28xx-audio.c-158-
drivers/media/usb/em28xx/em28xx-audio.c:159:static int em28xx_init_audio_isoc(struct em28xx *dev)
drivers/media/usb/em28xx/em28xx-audio.c-160-{
--
drivers/media/usb/em28xx/em28xx-audio.c-174- err);
drivers/media/usb/em28xx/em28xx-audio.c:175: em28xx_deinit_isoc_audio(dev);
drivers/media/usb/em28xx/em28xx-audio.c-176- atomic_set(&dev->adev.stream_started, 0);
--
drivers/media/usb/em28xx/em28xx-audio.c-183-
drivers/media/usb/em28xx/em28xx-audio.c:184:static const struct snd_pcm_hardware snd_em28xx_hw_capture = {
drivers/media/usb/em28xx/em28xx-audio.c-185- .info = SNDRV_PCM_INFO_BLOCK_TRANSFER |
--
drivers/media/usb/em28xx/em28xx-audio.c-215-
drivers/media/usb/em28xx/em28xx-audio.c:216:static int snd_em28xx_capture_open(struct snd_pcm_substream *substream)
drivers/media/usb/em28xx/em28xx-audio.c-217-{
drivers/media/usb/em28xx/em28xx-audio.c:218: struct em28xx *dev = snd_pcm_substream_chip(substream);
drivers/media/usb/em28xx/em28xx-audio.c-219- struct snd_pcm_runtime *runtime = substream->runtime;
--
drivers/media/usb/em28xx/em28xx-audio.c-222- if (!dev) {
drivers/media/usb/em28xx/em28xx-audio.c:223: pr_err("em28xx-audio: BUG: em28xx can't find device struct. Can't proceed with open\n");
drivers/media/usb/em28xx/em28xx-audio.c-224- return -ENODEV;
--
drivers/media/usb/em28xx/em28xx-audio.c-239-
drivers/media/usb/em28xx/em28xx-audio.c:240: runtime->hw = snd_em28xx_hw_capture;
drivers/media/usb/em28xx/em28xx-audio.c-241-
--
drivers/media/usb/em28xx/em28xx-audio.c-269- dev->mute = 0;
drivers/media/usb/em28xx/em28xx-audio.c:270: ret = em28xx_audio_analog_set(dev);
drivers/media/usb/em28xx/em28xx-audio.c-271- if (ret < 0)
--
drivers/media/usb/em28xx/em28xx-audio.c-291- dev_err(&dev->intf->dev,
drivers/media/usb/em28xx/em28xx-audio.c:292: "Error while configuring em28xx mixer\n");
drivers/media/usb/em28xx/em28xx-audio.c-293- return ret;
--
drivers/media/usb/em28xx/em28xx-audio.c-295-
drivers/media/usb/em28xx/em28xx-audio.c:296:static int snd_em28xx_pcm_close(struct snd_pcm_substream *substream)
drivers/media/usb/em28xx/em28xx-audio.c-297-{
drivers/media/usb/em28xx/em28xx-audio.c:298: struct em28xx *dev = snd_pcm_substream_chip(substream);
drivers/media/usb/em28xx/em28xx-audio.c-299-
--
drivers/media/usb/em28xx/em28xx-audio.c-309-
drivers/media/usb/em28xx/em28xx-audio.c:310: em28xx_audio_analog_set(dev);
drivers/media/usb/em28xx/em28xx-audio.c-311- mutex_unlock(&dev->lock);
drivers/media/usb/em28xx/em28xx-audio.c:312: kref_put(&dev->ref, em28xx_free_device);
drivers/media/usb/em28xx/em28xx-audio.c-313-
--
drivers/media/usb/em28xx/em28xx-audio.c-316-
drivers/media/usb/em28xx/em28xx-audio.c:317:static int snd_em28xx_prepare(struct snd_pcm_substream *substream)
drivers/media/usb/em28xx/em28xx-audio.c-318-{
drivers/media/usb/em28xx/em28xx-audio.c:319: struct em28xx *dev = snd_pcm_substream_chip(substream);
drivers/media/usb/em28xx/em28xx-audio.c-320-
--
drivers/media/usb/em28xx/em28xx-audio.c=330=static void audio_trigger(struct work_struct *work)
drivers/media/usb/em28xx/em28xx-audio.c-331-{
drivers/media/usb/em28xx/em28xx-audio.c:332: struct em28xx_audio *adev =
drivers/media/usb/em28xx/em28xx-audio.c:333: container_of(work, struct em28xx_audio, wq_trigger);
drivers/media/usb/em28xx/em28xx-audio.c:334: struct em28xx *dev = container_of(adev, struct em28xx, adev);
drivers/media/usb/em28xx/em28xx-audio.c-335-
--
drivers/media/usb/em28xx/em28xx-audio.c-337- dprintk("starting capture");
drivers/media/usb/em28xx/em28xx-audio.c:338: em28xx_init_audio_isoc(dev);
drivers/media/usb/em28xx/em28xx-audio.c-339- } else {
drivers/media/usb/em28xx/em28xx-audio.c-340- dprintk("stopping capture");
drivers/media/usb/em28xx/em28xx-audio.c:341: em28xx_deinit_isoc_audio(dev);
drivers/media/usb/em28xx/em28xx-audio.c-342- }
--
drivers/media/usb/em28xx/em28xx-audio.c-344-
drivers/media/usb/em28xx/em28xx-audio.c:345:static int snd_em28xx_capture_trigger(struct snd_pcm_substream *substream,
drivers/media/usb/em28xx/em28xx-audio.c-346- int cmd)
drivers/media/usb/em28xx/em28xx-audio.c-347-{
drivers/media/usb/em28xx/em28xx-audio.c:348: struct em28xx *dev = snd_pcm_substream_chip(substream);
drivers/media/usb/em28xx/em28xx-audio.c-349- int retval = 0;
--
drivers/media/usb/em28xx/em28xx-audio.c-371-
drivers/media/usb/em28xx/em28xx-audio.c:372:static snd_pcm_uframes_t snd_em28xx_capture_pointer(struct snd_pcm_substream
drivers/media/usb/em28xx/em28xx-audio.c-373- *substream)
--
drivers/media/usb/em28xx/em28xx-audio.c-375- unsigned long flags;
drivers/media/usb/em28xx/em28xx-audio.c:376: struct em28xx *dev;
drivers/media/usb/em28xx/em28xx-audio.c-377- snd_pcm_uframes_t hwptr_done;
--
drivers/media/usb/em28xx/em28xx-audio.c-392- */
drivers/media/usb/em28xx/em28xx-audio.c:393:static int em28xx_vol_info(struct snd_kcontrol *kcontrol,
drivers/media/usb/em28xx/em28xx-audio.c-394- struct snd_ctl_elem_info *info)
drivers/media/usb/em28xx/em28xx-audio.c-395-{
drivers/media/usb/em28xx/em28xx-audio.c:396: struct em28xx *dev = snd_kcontrol_chip(kcontrol);
drivers/media/usb/em28xx/em28xx-audio.c-397-
--
drivers/media/usb/em28xx/em28xx-audio.c-408-
drivers/media/usb/em28xx/em28xx-audio.c:409:static int em28xx_vol_put(struct snd_kcontrol *kcontrol,
drivers/media/usb/em28xx/em28xx-audio.c-410- struct snd_ctl_elem_value *value)
drivers/media/usb/em28xx/em28xx-audio.c-411-{
drivers/media/usb/em28xx/em28xx-audio.c:412: struct em28xx *dev = snd_kcontrol_chip(kcontrol);
drivers/media/usb/em28xx/em28xx-audio.c-413- struct snd_pcm_substream *substream = dev->adev.capture_pcm_substream;
--
drivers/media/usb/em28xx/em28xx-audio.c-429- }
drivers/media/usb/em28xx/em28xx-audio.c:430: rc = em28xx_read_ac97(dev, kcontrol->private_value);
drivers/media/usb/em28xx/em28xx-audio.c-431- if (rc < 0)
--
drivers/media/usb/em28xx/em28xx-audio.c-435-
drivers/media/usb/em28xx/em28xx-audio.c:436: rc = em28xx_write_ac97(dev, kcontrol->private_value, val);
drivers/media/usb/em28xx/em28xx-audio.c-437- if (rc < 0)
--
drivers/media/usb/em28xx/em28xx-audio.c-449-
drivers/media/usb/em28xx/em28xx-audio.c:450:static int em28xx_vol_get(struct snd_kcontrol *kcontrol,
drivers/media/usb/em28xx/em28xx-audio.c-451- struct snd_ctl_elem_value *value)
drivers/media/usb/em28xx/em28xx-audio.c-452-{
drivers/media/usb/em28xx/em28xx-audio.c:453: struct em28xx *dev = snd_kcontrol_chip(kcontrol);
drivers/media/usb/em28xx/em28xx-audio.c-454- struct snd_pcm_substream *substream = dev->adev.capture_pcm_substream;
--
drivers/media/usb/em28xx/em28xx-audio.c-468- }
drivers/media/usb/em28xx/em28xx-audio.c:469: val = em28xx_read_ac97(dev, kcontrol->private_value);
drivers/media/usb/em28xx/em28xx-audio.c-470- mutex_unlock(&dev->lock);
--
drivers/media/usb/em28xx/em28xx-audio.c-484-
drivers/media/usb/em28xx/em28xx-audio.c:485:static int em28xx_vol_put_mute(struct snd_kcontrol *kcontrol,
drivers/media/usb/em28xx/em28xx-audio.c-486- struct snd_ctl_elem_value *value)
drivers/media/usb/em28xx/em28xx-audio.c-487-{
drivers/media/usb/em28xx/em28xx-audio.c:488: struct em28xx *dev = snd_kcontrol_chip(kcontrol);
drivers/media/usb/em28xx/em28xx-audio.c-489- u16 val = value->value.integer.value[0];
--
drivers/media/usb/em28xx/em28xx-audio.c-504- }
drivers/media/usb/em28xx/em28xx-audio.c:505: rc = em28xx_read_ac97(dev, kcontrol->private_value);
drivers/media/usb/em28xx/em28xx-audio.c-506- if (rc < 0)
--
drivers/media/usb/em28xx/em28xx-audio.c-513-
drivers/media/usb/em28xx/em28xx-audio.c:514: rc = em28xx_write_ac97(dev, kcontrol->private_value, rc);
drivers/media/usb/em28xx/em28xx-audio.c-515- if (rc < 0)
--
drivers/media/usb/em28xx/em28xx-audio.c-527-
drivers/media/usb/em28xx/em28xx-audio.c:528:static int em28xx_vol_get_mute(struct snd_kcontrol *kcontrol,
drivers/media/usb/em28xx/em28xx-audio.c-529- struct snd_ctl_elem_value *value)
drivers/media/usb/em28xx/em28xx-audio.c-530-{
drivers/media/usb/em28xx/em28xx-audio.c:531: struct em28xx *dev = snd_kcontrol_chip(kcontrol);
drivers/media/usb/em28xx/em28xx-audio.c-532- struct snd_pcm_substream *substream = dev->adev.capture_pcm_substream;
--
drivers/media/usb/em28xx/em28xx-audio.c-546- }
drivers/media/usb/em28xx/em28xx-audio.c:547: val = em28xx_read_ac97(dev, kcontrol->private_value);
drivers/media/usb/em28xx/em28xx-audio.c-548- mutex_unlock(&dev->lock);
--
drivers/media/usb/em28xx/em28xx-audio.c-564-
drivers/media/usb/em28xx/em28xx-audio.c:565:static const DECLARE_TLV_DB_SCALE(em28xx_db_scale, -3450, 150, 0);
drivers/media/usb/em28xx/em28xx-audio.c-566-
drivers/media/usb/em28xx/em28xx-audio.c:567:static int em28xx_cvol_new(struct snd_card *card, struct em28xx *dev,
drivers/media/usb/em28xx/em28xx-audio.c-568- char *name, int id)
--
drivers/media/usb/em28xx/em28xx-audio.c-581- sprintf(ctl_name, "%s Switch", name);
drivers/media/usb/em28xx/em28xx-audio.c:582: tmp.get = em28xx_vol_get_mute;
drivers/media/usb/em28xx/em28xx-audio.c:583: tmp.put = em28xx_vol_put_mute;
drivers/media/usb/em28xx/em28xx-audio.c-584- tmp.info = snd_ctl_boolean_mono_info;
--
drivers/media/usb/em28xx/em28xx-audio.c-598- sprintf(ctl_name, "%s Volume", name);
drivers/media/usb/em28xx/em28xx-audio.c:599: tmp.get = em28xx_vol_get;
drivers/media/usb/em28xx/em28xx-audio.c:600: tmp.put = em28xx_vol_put;
drivers/media/usb/em28xx/em28xx-audio.c:601: tmp.info = em28xx_vol_info;
drivers/media/usb/em28xx/em28xx-audio.c:602: tmp.tlv.p = em28xx_db_scale;
drivers/media/usb/em28xx/em28xx-audio.c-603- kctl = snd_ctl_new1(&tmp, dev);
--
drivers/media/usb/em28xx/em28xx-audio.c-615- */
drivers/media/usb/em28xx/em28xx-audio.c:616:static const struct snd_pcm_ops snd_em28xx_pcm_capture = {
drivers/media/usb/em28xx/em28xx-audio.c:617: .open = snd_em28xx_capture_open,
drivers/media/usb/em28xx/em28xx-audio.c:618: .close = snd_em28xx_pcm_close,
drivers/media/usb/em28xx/em28xx-audio.c:619: .prepare = snd_em28xx_prepare,
drivers/media/usb/em28xx/em28xx-audio.c:620: .trigger = snd_em28xx_capture_trigger,
drivers/media/usb/em28xx/em28xx-audio.c:621: .pointer = snd_em28xx_capture_pointer,
drivers/media/usb/em28xx/em28xx-audio.c-622-};
drivers/media/usb/em28xx/em28xx-audio.c-623-
drivers/media/usb/em28xx/em28xx-audio.c:624:static void em28xx_audio_free_urb(struct em28xx *dev)
drivers/media/usb/em28xx/em28xx-audio.c-625-{
--
drivers/media/usb/em28xx/em28xx-audio.c-646-/* high bandwidth multiplier, as encoded in highspeed endpoint descriptors */
drivers/media/usb/em28xx/em28xx-audio.c:647:static int em28xx_audio_ep_packet_size(struct usb_device *udev,
drivers/media/usb/em28xx/em28xx-audio.c-648- struct usb_endpoint_descriptor *e)
--
drivers/media/usb/em28xx/em28xx-audio.c-657-
drivers/media/usb/em28xx/em28xx-audio.c:658:static int em28xx_audio_urb_init(struct em28xx *dev)
drivers/media/usb/em28xx/em28xx-audio.c-659-{
--
drivers/media/usb/em28xx/em28xx-audio.c-694-
drivers/media/usb/em28xx/em28xx-audio.c:695: ep_size = em28xx_audio_ep_packet_size(udev, ep);
drivers/media/usb/em28xx/em28xx-audio.c-696- interval = 1 << (ep->bInterval - 1);
--
drivers/media/usb/em28xx/em28xx-audio.c-767- if (!urb) {
drivers/media/usb/em28xx/em28xx-audio.c:768: em28xx_audio_free_urb(dev);
drivers/media/usb/em28xx/em28xx-audio.c-769- return -ENOMEM;
--
drivers/media/usb/em28xx/em28xx-audio.c-777- "usb_alloc_coherent failed!\n");
drivers/media/usb/em28xx/em28xx-audio.c:778: em28xx_audio_free_urb(dev);
drivers/media/usb/em28xx/em28xx-audio.c-779- return -ENOMEM;
--
drivers/media/usb/em28xx/em28xx-audio.c-788- urb->interval = interval;
drivers/media/usb/em28xx/em28xx-audio.c:789: urb->complete = em28xx_audio_isocirq;
drivers/media/usb/em28xx/em28xx-audio.c-790- urb->number_of_packets = npackets;
--
drivers/media/usb/em28xx/em28xx-audio.c-801-
drivers/media/usb/em28xx/em28xx-audio.c:802:static int em28xx_audio_init(struct em28xx *dev)
drivers/media/usb/em28xx/em28xx-audio.c-803-{
drivers/media/usb/em28xx/em28xx-audio.c:804: struct em28xx_audio *adev = &dev->adev;
drivers/media/usb/em28xx/em28xx-audio.c-805- struct usb_device *udev = interface_to_usbdev(dev->intf);
--
drivers/media/usb/em28xx/em28xx-audio.c-824- dev_info(&dev->intf->dev,
drivers/media/usb/em28xx/em28xx-audio.c:825: "em28xx-audio.c: Copyright (C) 2006 Markus Rechberger\n");
drivers/media/usb/em28xx/em28xx-audio.c-826- dev_info(&dev->intf->dev,
drivers/media/usb/em28xx/em28xx-audio.c:827: "em28xx-audio.c: Copyright (C) 2007-2016 Mauro Carvalho Chehab\n");
drivers/media/usb/em28xx/em28xx-audio.c-828-
--
drivers/media/usb/em28xx/em28xx-audio.c-841-
drivers/media/usb/em28xx/em28xx-audio.c:842: snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_em28xx_pcm_capture);
drivers/media/usb/em28xx/em28xx-audio.c-843- snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_VMALLOC, NULL, 0, 0);
--
drivers/media/usb/em28xx/em28xx-audio.c-854- if (dev->audio_mode.ac97 != EM28XX_NO_AC97) {
drivers/media/usb/em28xx/em28xx-audio.c:855: em28xx_cvol_new(card, dev, "Video", AC97_VIDEO);
drivers/media/usb/em28xx/em28xx-audio.c:856: em28xx_cvol_new(card, dev, "Line In", AC97_LINE);
drivers/media/usb/em28xx/em28xx-audio.c:857: em28xx_cvol_new(card, dev, "Phone", AC97_PHONE);
drivers/media/usb/em28xx/em28xx-audio.c:858: em28xx_cvol_new(card, dev, "Microphone", AC97_MIC);
drivers/media/usb/em28xx/em28xx-audio.c:859: em28xx_cvol_new(card, dev, "CD", AC97_CD);
drivers/media/usb/em28xx/em28xx-audio.c:860: em28xx_cvol_new(card, dev, "AUX", AC97_AUX);
drivers/media/usb/em28xx/em28xx-audio.c:861: em28xx_cvol_new(card, dev, "PCM", AC97_PCM);
drivers/media/usb/em28xx/em28xx-audio.c-862-
drivers/media/usb/em28xx/em28xx-audio.c:863: em28xx_cvol_new(card, dev, "Master", AC97_MASTER);
drivers/media/usb/em28xx/em28xx-audio.c:864: em28xx_cvol_new(card, dev, "Line", AC97_HEADPHONE);
drivers/media/usb/em28xx/em28xx-audio.c:865: em28xx_cvol_new(card, dev, "Mono", AC97_MASTER_MONO);
drivers/media/usb/em28xx/em28xx-audio.c:866: em28xx_cvol_new(card, dev, "LFE", AC97_CENTER_LFE_MASTER);
drivers/media/usb/em28xx/em28xx-audio.c:867: em28xx_cvol_new(card, dev, "Surround", AC97_SURROUND_MASTER);
drivers/media/usb/em28xx/em28xx-audio.c-868- }
drivers/media/usb/em28xx/em28xx-audio.c-869-
drivers/media/usb/em28xx/em28xx-audio.c:870: err = em28xx_audio_urb_init(dev);
drivers/media/usb/em28xx/em28xx-audio.c-871- if (err)
--
drivers/media/usb/em28xx/em28xx-audio.c-881-urb_free:
drivers/media/usb/em28xx/em28xx-audio.c:882: em28xx_audio_free_urb(dev);
drivers/media/usb/em28xx/em28xx-audio.c-883-
--
drivers/media/usb/em28xx/em28xx-audio.c-890-
drivers/media/usb/em28xx/em28xx-audio.c:891:static int em28xx_audio_fini(struct em28xx *dev)
drivers/media/usb/em28xx/em28xx-audio.c-892-{
--
drivers/media/usb/em28xx/em28xx-audio.c-910-
drivers/media/usb/em28xx/em28xx-audio.c:911: em28xx_audio_free_urb(dev);
drivers/media/usb/em28xx/em28xx-audio.c-912-
--
drivers/media/usb/em28xx/em28xx-audio.c-916-
drivers/media/usb/em28xx/em28xx-audio.c:917: kref_put(&dev->ref, em28xx_free_device);
drivers/media/usb/em28xx/em28xx-audio.c-918- return 0;
--
drivers/media/usb/em28xx/em28xx-audio.c-920-
drivers/media/usb/em28xx/em28xx-audio.c:921:static int em28xx_audio_suspend(struct em28xx *dev)
drivers/media/usb/em28xx/em28xx-audio.c-922-{
--
drivers/media/usb/em28xx/em28xx-audio.c-929- dev_info(&dev->intf->dev, "Suspending audio extension\n");
drivers/media/usb/em28xx/em28xx-audio.c:930: em28xx_deinit_isoc_audio(dev);
drivers/media/usb/em28xx/em28xx-audio.c-931- atomic_set(&dev->adev.stream_started, 0);
--
drivers/media/usb/em28xx/em28xx-audio.c-934-
drivers/media/usb/em28xx/em28xx-audio.c:935:static int em28xx_audio_resume(struct em28xx *dev)
drivers/media/usb/em28xx/em28xx-audio.c-936-{
--
drivers/media/usb/em28xx/em28xx-audio.c-948-
drivers/media/usb/em28xx/em28xx-audio.c:949:static struct em28xx_ops audio_ops = {
drivers/media/usb/em28xx/em28xx-audio.c-950- .id = EM28XX_AUDIO,
drivers/media/usb/em28xx/em28xx-audio.c-951- .name = "Em28xx Audio Extension",
drivers/media/usb/em28xx/em28xx-audio.c:952: .init = em28xx_audio_init,
drivers/media/usb/em28xx/em28xx-audio.c:953: .fini = em28xx_audio_fini,
drivers/media/usb/em28xx/em28xx-audio.c:954: .suspend = em28xx_audio_suspend,
drivers/media/usb/em28xx/em28xx-audio.c:955: .resume = em28xx_audio_resume,
drivers/media/usb/em28xx/em28xx-audio.c-956-};
drivers/media/usb/em28xx/em28xx-audio.c-957-
drivers/media/usb/em28xx/em28xx-audio.c:958:static int __init em28xx_alsa_register(void)
drivers/media/usb/em28xx/em28xx-audio.c-959-{
drivers/media/usb/em28xx/em28xx-audio.c:960: return em28xx_register_extension(&audio_ops);
drivers/media/usb/em28xx/em28xx-audio.c-961-}
drivers/media/usb/em28xx/em28xx-audio.c-962-
drivers/media/usb/em28xx/em28xx-audio.c:963:static void __exit em28xx_alsa_unregister(void)
drivers/media/usb/em28xx/em28xx-audio.c-964-{
drivers/media/usb/em28xx/em28xx-audio.c:965: em28xx_unregister_extension(&audio_ops);
drivers/media/usb/em28xx/em28xx-audio.c-966-}
--
drivers/media/usb/em28xx/em28xx-audio.c=972=MODULE_VERSION(EM28XX_VERSION);
drivers/media/usb/em28xx/em28xx-audio.c-973-
drivers/media/usb/em28xx/em28xx-audio.c:974:module_init(em28xx_alsa_register);
drivers/media/usb/em28xx/em28xx-audio.c:975:module_exit(em28xx_alsa_unregister);
--
drivers/media/usb/em28xx/em28xx-camera.c-2-//
drivers/media/usb/em28xx/em28xx-camera.c:3:// em28xx-camera.c - driver for Empia EM25xx/27xx/28xx USB video capture devices
drivers/media/usb/em28xx/em28xx-camera.c-4-//
--
drivers/media/usb/em28xx/em28xx-camera.c-7-
drivers/media/usb/em28xx/em28xx-camera.c:8:#include "em28xx.h"
drivers/media/usb/em28xx/em28xx-camera.c-9-
--
drivers/media/usb/em28xx/em28xx-camera.c=24=static unsigned short omnivision_sensor_addrs[] = {
--
drivers/media/usb/em28xx/em28xx-camera.c-30-/* FIXME: Should be replaced by a proper mt9m111 driver */
drivers/media/usb/em28xx/em28xx-camera.c:31:static int em28xx_initialize_mt9m111(struct em28xx *dev)
drivers/media/usb/em28xx/em28xx-camera.c-32-{
--
drivers/media/usb/em28xx/em28xx-camera.c-50-/* FIXME: Should be replaced by a proper mt9m001 driver */
drivers/media/usb/em28xx/em28xx-camera.c:51:static int em28xx_initialize_mt9m001(struct em28xx *dev)
drivers/media/usb/em28xx/em28xx-camera.c-52-{
--
drivers/media/usb/em28xx/em28xx-camera.c-81- */
drivers/media/usb/em28xx/em28xx-camera.c:82:static int em28xx_probe_sensor_micron(struct em28xx *dev)
drivers/media/usb/em28xx/em28xx-camera.c-83-{
--
drivers/media/usb/em28xx/em28xx-camera.c-89-
drivers/media/usb/em28xx/em28xx-camera.c:90: dev->em28xx_sensor = EM28XX_NOSENSOR;
drivers/media/usb/em28xx/em28xx-camera.c-91- for (i = 0; micron_sensor_addrs[i] != I2C_CLIENT_END; i++) {
--
drivers/media/usb/em28xx/em28xx-camera.c-126- name = "MT9M111"; /* MI1310 */ /* 1280x1024 */
drivers/media/usb/em28xx/em28xx-camera.c:127: dev->em28xx_sensor = EM28XX_MT9M111;
drivers/media/usb/em28xx/em28xx-camera.c-128- break;
--
drivers/media/usb/em28xx/em28xx-camera.c-137- name = "MT9V011"; /* MI360 */ /* 640x480 */
drivers/media/usb/em28xx/em28xx-camera.c:138: dev->em28xx_sensor = EM28XX_MT9V011;
drivers/media/usb/em28xx/em28xx-camera.c-139- break;
--
drivers/media/usb/em28xx/em28xx-camera.c-141- name = "MT9M001"; /* 1280x1024 */
drivers/media/usb/em28xx/em28xx-camera.c:142: dev->em28xx_sensor = EM28XX_MT9M001;
drivers/media/usb/em28xx/em28xx-camera.c-143- break;
--
drivers/media/usb/em28xx/em28xx-camera.c-150-
drivers/media/usb/em28xx/em28xx-camera.c:151: if (dev->em28xx_sensor == EM28XX_NOSENSOR)
drivers/media/usb/em28xx/em28xx-camera.c-152- dev_info(&dev->intf->dev,
--
drivers/media/usb/em28xx/em28xx-camera.c-166- */
drivers/media/usb/em28xx/em28xx-camera.c:167:static int em28xx_probe_sensor_omnivision(struct em28xx *dev)
drivers/media/usb/em28xx/em28xx-camera.c-168-{
--
drivers/media/usb/em28xx/em28xx-camera.c-174-
drivers/media/usb/em28xx/em28xx-camera.c:175: dev->em28xx_sensor = EM28XX_NOSENSOR;
drivers/media/usb/em28xx/em28xx-camera.c-176- /*
--
drivers/media/usb/em28xx/em28xx-camera.c-227- name = "OV2640";
drivers/media/usb/em28xx/em28xx-camera.c:228: dev->em28xx_sensor = EM28XX_OV2640;
drivers/media/usb/em28xx/em28xx-camera.c-229- break;
--
drivers/media/usb/em28xx/em28xx-camera.c-263-
drivers/media/usb/em28xx/em28xx-camera.c:264: if (dev->em28xx_sensor == EM28XX_NOSENSOR)
drivers/media/usb/em28xx/em28xx-camera.c-265- dev_info(&dev->intf->dev,
--
drivers/media/usb/em28xx/em28xx-camera.c-276-
drivers/media/usb/em28xx/em28xx-camera.c:277:int em28xx_detect_sensor(struct em28xx *dev)
drivers/media/usb/em28xx/em28xx-camera.c-278-{
--
drivers/media/usb/em28xx/em28xx-camera.c-280-
drivers/media/usb/em28xx/em28xx-camera.c:281: ret = em28xx_probe_sensor_micron(dev);
drivers/media/usb/em28xx/em28xx-camera.c-282-
drivers/media/usb/em28xx/em28xx-camera.c:283: if (dev->em28xx_sensor == EM28XX_NOSENSOR && ret < 0)
drivers/media/usb/em28xx/em28xx-camera.c:284: ret = em28xx_probe_sensor_omnivision(dev);
drivers/media/usb/em28xx/em28xx-camera.c-285-
--
drivers/media/usb/em28xx/em28xx-camera.c-290-
drivers/media/usb/em28xx/em28xx-camera.c:291: if (dev->em28xx_sensor == EM28XX_NOSENSOR && ret < 0) {
drivers/media/usb/em28xx/em28xx-camera.c-292- dev_info(&dev->intf->dev,
--
drivers/media/usb/em28xx/em28xx-camera.c-299-
drivers/media/usb/em28xx/em28xx-camera.c:300:int em28xx_init_camera(struct em28xx *dev)
drivers/media/usb/em28xx/em28xx-camera.c-301-{
--
drivers/media/usb/em28xx/em28xx-camera.c-303- struct i2c_adapter *adap = &dev->i2c_adap[dev->def_i2c_bus];
drivers/media/usb/em28xx/em28xx-camera.c:304: struct em28xx_v4l2 *v4l2 = dev->v4l2;
drivers/media/usb/em28xx/em28xx-camera.c-305-
]
]
|
| 97/2 |
2026/05/19 14:34 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 202676
output: 395
thoughts: 648
Thoughts: **Debugging USB Device Initialization in syzkaller**
Alright, let's break this down. I'm trying to get syzkaller to trigger the `em28xx` driver in a vUSB context, but it's not a straightforward path as it's not directly defined. The challenge is in crafting the right input to `syz_usb_connect`. I see that it takes a `usb_device_descriptor` via pointer. I initially thought I could use `AUTO` with some predefined values, and while syzkaller would serialize it, the critical `idVendor` and `idProduct` fields would be zeroed out. My concern is, `init_vusb.go` patches these, and if it randomizes them, there's no guarantee I'll hit the `em28xx` ID.
Then I realized, it *only* randomizes if they are zero! So, I figured, let's bypass the random patching. The obvious route is to pass the explicit bytes directly. The `ANY` pointer seemed the key. I experimented with different `ANY` syntax: strings, integer arrays, binary blobs, and even tried to force it with `@array`. Each attempt failed with cryptic errors, but the last one gave me a vital clue: "wrong union arg for 'array'."
That "array" part is crucial! If it's a union and it's expecting an 'array' as an argument, but I'm passing a string or blob, no wonder it's failing. So, I need to represent the device descriptor as a raw byte array. Let's try it with the raw bytes, carefully constructing an array with the device descriptor bytes I need, including the correct vendor and product IDs for `em28xx`. I'm going to encode that array as `&AUTO=ANY=@array=[...]` and cross my fingers. Hopefully, this gets around the randomization.
|
| 98/2 |
2026/05/19 14:34 |
tool |
reproduce-crash |
0m
Error:
Args: map[ReproSyz:r0 = syz_usb_connect(3, 0x2b, &AUTO=ANY=@array=[0x12, 0x01, 0x00, 0x02, 0xff, 0xff, 0xff, 0x40, 0x1a, 0xeb, 0x00, 0x28, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x09, 0x02, 0x19, 0x00, 0x01, 0x01, 0x00, 0x80, 0xfa, 0x09, 0x04, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0x00, 0x07, 0x05, 0x82, 0x02, 0x00, 0x02, 0x00], &AUTO={0, 0, 0, 0, 0, []})
openat(0xffffffffffffff9c, &AUTO="/dev/video0\x00", 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO="/dev/video1\x00", 0x2, 0x0) (async)
syz_usb_disconnect(r0) (async)
]
Results: map[CoverageID: ReproducedBugTitle: ReproducedCrashReport:]
|
| 99/2 |
2026/05/19 14:34 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 204446
output: 391
thoughts: 423
Thoughts: **Debugging a Syzkaller `ANY` Type Issue**
Okay, here's what's running through my head. The error message "wrong union arg for 'array'" is throwing me. It looks like the `@array` syntax isn't a valid option for the `ANY` type, which is what I suspected. I need to figure out what *are* valid union options for `ANY`.
My first instinct is to check `prog/encoding.go`, or just try using `ANY` without any `@` prefix. But then I remember I tried something like `ANY=[0x12...]` and got "wrong int arg *prog.UnionType." That suggests the tool *expected* a `UnionType`, but got an `int`… No, wait, that's not right. It expected the `UnionType`, but got an int, because of how I was trying to specify the array!
Aha! `[0x12, 0x01, ...]` is an array of ints, so using `ANY` *requires* a union option if it's acting like a union. But that raises the question: what are the valid options?
In syzkaller, the `ANY` type is actually `ANYUNION`. That reminds me of the valid options are `ANYRES16`, `ANYRES32`, `ANYRES64`, and `ANYBLOB`.
I recall I tried `@ANYBLOB` and still got "wrong union arg for 'array'". That tells me something important – it means the type of the *argument* itself is an `array`.
Let's focus on the problem at hand: the `usb_device_descriptor` is a struct, not a union. If I try to use `ANY` in a struct context, it's not going to work. The `syz_usb_connect` system call expects `ptr[in, usb_device_descriptor]`. If I use `&AUTO=ANY=...`, it's going to try and parse `ANY` as a `usb_device_descriptor`... and that's the problem! `usb_device_descriptor` is NOT a union.
So, in *this* situation, `ANY` isn't functioning as a union. It's a special keyword in syzkaller. If I use `ANY` it means the pointer I'm supplying can point to ANY type! But how do I specify it, then? It seems the syntax should be `&ANY=...` to indicate that I'm passing a pointer to an arbitrary type! Alright, let's try `&ANY=[0x12, 0x01, ...]`.
|
| 100/2 |
2026/05/19 14:34 |
tool |
reproduce-crash |
0m
Error:
Args: map[ReproSyz:r0 = syz_usb_connect(3, 0x2b, &ANY=[0x12, 0x01, 0x00, 0x02, 0xff, 0xff, 0xff, 0x40, 0x1a, 0xeb, 0x00, 0x28, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x09, 0x02, 0x19, 0x00, 0x01, 0x01, 0x00, 0x80, 0xfa, 0x09, 0x04, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0x00, 0x07, 0x05, 0x82, 0x02, 0x00, 0x02, 0x00], &AUTO={0, 0, 0, 0, 0, []})
openat(0xffffffffffffff9c, &AUTO="/dev/video0\x00", 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO="/dev/video1\x00", 0x2, 0x0) (async)
syz_usb_disconnect(r0) (async)
]
Results: map[CoverageID: ReproducedBugTitle: ReproducedCrashReport:]
|
| 101/2 |
2026/05/19 14:34 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 206152
output: 239
thoughts: 335
Thoughts: **My Reasoning on USB Device Connection in Syzkaller**
Okay, the initial attempt with `&ANY` clearly won't fly; syntax error. Thinking strategically, what if I try using `&AUTO=""` in conjunction with `syz_usb_connect`? The idea is to let syzkaller handle the details. I recall that `syz_usb_connect` is used with a `usb_device_descriptor`, so I can use that and hopefully let syzkaller patch the details.
But hang on, `init_vusb.go` is patching that ID to something random! The good news is syzkaller runs the reproducer multiple times, so maybe eventually it will hit `0xeb1a:0x2800` - since that's a known ID. Hold up, `init_vusb.go` is randomly patching it from a list of ALL known USB IDs, hundreds of them... this could take forever. Is there a way to force it?
Okay, let's explore using `syz_usb_connect$em28xx`. I checked `vusb.txt` - no luck there, that variant isn't listed directly. But wait! `init_vusb.go` *does* patch it based on the variant of `syz_usb_connect`! If I just use `syz_usb_connect`, it's random, but if I use `syz_usb_connect$em28xx`...it should patch it to `em28xx`! But does `syz_usb_connect$em28xx` *even* exist?! Time to find out!
|
| 102/2 |
2026/05/19 14:34 |
tool |
reproduce-crash |
0m
Error:
Args: map[ReproSyz:r0 = syz_usb_connect$em28xx(3, 0x2b, &AUTO={{0x200, 0x40, [{{1, 0, 0x80, 0xfa, [{{0, 0, 0xff, 0xff, 0xff, 0, [], [{{0x82, 0x2, 0x200, 0, 0, 0, []}}]}}]}}]}}, &AUTO={0, 0, 0, 0, 0, []})
openat(0xffffffffffffff9c, &AUTO="/dev/video0\x00", 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO="/dev/video1\x00", 0x2, 0x0) (async)
syz_usb_disconnect(r0) (async)
]
Results: map[CoverageID: ReproducedBugTitle: ReproducedCrashReport:]
|
| 103/2 |
2026/05/19 14:34 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 207110
output: 397
thoughts: 1366
Thoughts: **Debugging the `syz_usb_connect` Call**
Okay, so I'm trying to craft a working `syz_usb_connect` call, and it's proving tricky. Initially, I thought I could just use the function and feed it the vendor and product IDs I need, namely `0xeb1a` and `0x2800`. But then I hit the first hurdle: the `usb_device_descriptor_t` struct has those fields set to zero!
I remember the definition of `usb_device_descriptor_t` and `usb_device_descriptor_verbose_t`, and I consider that maybe `usb_device_descriptor_verbose_t` would work better.
But wait, `usb_device_descriptor` uses the original type, which means I'm stuck, I can't just modify those values directly if I use `usb_device_descriptor`!
The next thought is to use `usb_device_descriptor_verbose_t` directly.
Could I potentially cast a pointer? But, I recall that syzkaller doesn't allow arbitrary type casting.
I remember the existence of the `ANY` pointer type in syzkaller.
I tried using `&AUTO=ANY="..."`, but it didn't work. The problem is understanding how to use that `ANY` pointer correctly. I then tried `&AUTO=ANY=[0x12, 0x01, ...]`, attempting to provide a byte array. However, that failed too, reporting a "wrong int arg *prog.UnionType" error.
It then hits me: `ANY` is a union! This explains the error! Because I'm dealing with a union, I have to provide a union option.
I need to understand what the union options are for `ANY`. I consider looking at the `prog/encoding.go` file but decide to test the syntax by trying the `@ANYBLOB` option.
I tried `@ANYBLOB` and it failed with the error `wrong union arg for "array"`.
But, it is not possible to specify an union for an `array` type.
Aha! `usb_device_descriptor` is a struct containing a field `inner` which itself is a `usb_device_descriptor_t`, which includes a field `configs` which is an `array`. If I provide `&AUTO=ANY=@ANYBLOB="..."`, I must parse `@ANYBLOB="..."` as `usb_device_descriptor`, which is a struct.
Since `@` is for unions, this syntax is wrong!
This means that `ANY` does not mean "cast to ANY". Instead, it means "this pointer points to ANY".
Now it is obvious! The syntax is `pointer-arg = "&" pointer-arg-addr ["=ANY"] "=" arg`. If I use `=ANY`, then `arg` must be parsed as a union `ANY`.
I need to know the available options for this union. I know that in syzkaller, `ANY` refers to the `any` union, whose options are `ANYRES16`, `ANYRES32`, `ANYRES64`, and `ANYBLOB`.
Maybe, I need to pass the option `ANYBLOB` and provide a byte array as value!
So, `@ANYBLOB=[0x12, 0x01, ...]`!
|
| 104/2 |
2026/05/19 14:35 |
tool |
reproduce-crash |
0m
Error:
Args: map[ReproSyz:r0 = syz_usb_connect(3, 0x2b, &AUTO=ANY=@ANYBLOB=[0x12, 0x01, 0x00, 0x02, 0xff, 0xff, 0xff, 0x40, 0x1a, 0xeb, 0x00, 0x28, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x09, 0x02, 0x19, 0x00, 0x01, 0x01, 0x00, 0x80, 0xfa, 0x09, 0x04, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0x00, 0x07, 0x05, 0x82, 0x02, 0x00, 0x02, 0x00], &AUTO={0, 0, 0, 0, 0, []})
openat(0xffffffffffffff9c, &AUTO="/dev/video0\x00", 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO="/dev/video1\x00", 0x2, 0x0) (async)
syz_usb_disconnect(r0) (async)
]
Results: map[CoverageID: ReproducedBugTitle: ReproducedCrashReport:]
|
| 105/2 |
2026/05/19 14:35 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 209925
output: 395
thoughts: 39
Thoughts: Okay, here's my interpretation of that thought process, from an expert's perspective:
**Debugging a Type Mismatch**
Right, so that "wrong union arg for 'array'" error is a classic. It's telling me the union type I've specified isn't correct for this array context. The hint is in the error message, clearly. So, `@ANYBLOB` is obviously *not* the valid type in this union, because the message wouldn't be flagging that specifically if it was. That narrows it down considerably. My gut says `@blob` is the likely candidate. It fits the typical data representation of this situation better than `@ANYBLOB`. Let's just go ahead and test that hypothesis. It's a quick change, and I'd bet that's the fix.
|
| 106/2 |
2026/05/19 14:35 |
tool |
reproduce-crash |
0m
Error:
Args: map[ReproSyz:r0 = syz_usb_connect(3, 0x2b, &AUTO=ANY=@blob=[0x12, 0x01, 0x00, 0x02, 0xff, 0xff, 0xff, 0x40, 0x1a, 0xeb, 0x00, 0x28, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x09, 0x02, 0x19, 0x00, 0x01, 0x01, 0x00, 0x80, 0xfa, 0x09, 0x04, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0x00, 0x07, 0x05, 0x82, 0x02, 0x00, 0x02, 0x00], &AUTO={0, 0, 0, 0, 0, []})
openat(0xffffffffffffff9c, &AUTO="/dev/video0\x00", 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO="/dev/video1\x00", 0x2, 0x0) (async)
syz_usb_disconnect(r0) (async)
]
Results: map[CoverageID: ReproducedBugTitle: ReproducedCrashReport:]
|
| 107/2 |
2026/05/19 14:35 |
llm |
crash-repro-finder |
1m
Model:
Tokens:
input: 210853
output: 313
thoughts: 124
Thoughts: **Debugging the Array Union**
Okay, hold on a second. This "wrong union arg for 'array'" error... does that mean the union itself is literally named "array"? No, that can't be right. It seems like it's saying it expected a union member, but received something like a `@blob` instead, and that the relevant union *is* named "array".
Wait a second… is `ANY` itself a union? In Syzkaller, `ANY` is a special type... right, it's not a standard union. If I use `ANY`, it's actually expecting an array of `ANYUNION` members! Got it!
Ah ha! I've got it now. `ANY` is effectively an array of `ANYUNION` data. So, I need to provide an array. I should be able to specify it with something like `&AUTO=ANY=[@ANYBLOB="..."]`. Now, to try this.
|
| 108/2 |
2026/05/19 14:36 |
tool |
reproduce-crash |
0m
Error:
Args: map[ReproSyz:r0 = syz_usb_connect(3, 0x2b, &AUTO=ANY=[@ANYBLOB="\x12\x01\x00\x02\xff\xff\xff\x40\x1a\xeb\x00\x28\x00\x01\x00\x00\x00\x01\x09\x02\x19\x00\x01\x01\x00\x80\xfa\x09\x04\x00\x00\x01\xff\xff\xff\x00\x07\x05\x82\x02\x00\x02\x00"], &AUTO={0, 0, 0, 0, 0, []})
openat(0xffffffffffffff9c, &AUTO="/dev/video0\x00", 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO="/dev/video1\x00", 0x2, 0x0) (async)
syz_usb_disconnect(r0) (async)
]
Results: map[CoverageID: ReproducedBugTitle: ReproducedCrashReport:]
|
| 109/2 |
2026/05/19 14:36 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 211737
output: 566
thoughts: 272
Thoughts: **Debugging the ANYBLOB Syntax**
Okay, so I'm wrestling with this `ANYBLOB` field and it seems like the system is expecting a string input. My first instinct was to wrap it in the standard `""` or `''` string syntax, which makes sense. Then I hit that "failed to parse identifier at pos 51" error and I'm thinking, "Is it the string format it doesn't like?"
Maybe it needs a byte array directly, like I sometimes see. So I thought, let me encode it into something like `&AUTO=ANY=[@ANYBLOB="1201..."]`. Nope. Okay, so now I am trying it as a hex string with `&AUTO=ANY=[@ANYBLOB="12010002ffffff401aeb00280001000000010902190001010080fa0904000001ffffff0007058202000200"]`, but syzkaller doesn't support that format.
Wait a second. What's the problem? The original assumption was correct, the error says it's a string, I am using the string notation. I must be missing something fundamental about the encoding. Alright, trying one last time with single quotes `&AUTO=ANY=[@ANYBLOB='1201...']`... still no.
Now I'm completely grasping at straws and starting to think maybe it's the wrong data type altogether. So I started thinking maybe I have to break this down into byte values, like `&AUTO=ANY=[@ANYRES8=0x12, @ANYRES8=0x01, ...]`. Wait, `ANYRES8`... that's for 8-bit integers, not a blob. Back to the drawing board!
|
| 110/2 |
2026/05/19 14:37 |
tool |
reproduce-crash |
0m
Error:
Args: map[ReproSyz:r0 = syz_usb_connect(3, 0x2b, &AUTO=ANY=[@ANYRES8=0x12, @ANYRES8=0x01, @ANYRES8=0x00, @ANYRES8=0x02, @ANYRES8=0xff, @ANYRES8=0xff, @ANYRES8=0xff, @ANYRES8=0x40, @ANYRES8=0x1a, @ANYRES8=0xeb, @ANYRES8=0x00, @ANYRES8=0x28, @ANYRES8=0x00, @ANYRES8=0x01, @ANYRES8=0x00, @ANYRES8=0x00, @ANYRES8=0x00, @ANYRES8=0x01, @ANYRES8=0x09, @ANYRES8=0x02, @ANYRES8=0x19, @ANYRES8=0x00, @ANYRES8=0x01, @ANYRES8=0x01, @ANYRES8=0x00, @ANYRES8=0x80, @ANYRES8=0xfa, @ANYRES8=0x09, @ANYRES8=0x04, @ANYRES8=0x00, @ANYRES8=0x00, @ANYRES8=0x01, @ANYRES8=0xff, @ANYRES8=0xff, @ANYRES8=0xff, @ANYRES8=0x00, @ANYRES8=0x07, @ANYRES8=0x05, @ANYRES8=0x82, @ANYRES8=0x02, @ANYRES8=0x00, @ANYRES8=0x02, @ANYRES8=0x00], &AUTO={0, 0, 0, 0, 0, []})
openat(0xffffffffffffff9c, &AUTO="/dev/video0\x00", 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO="/dev/video1\x00", 0x2, 0x0) (async)
syz_usb_disconnect(r0) (async)
]
Results: map[CoverageID: ReproducedBugTitle: ReproducedCrashReport:]
|
| 111/2 |
2026/05/19 14:37 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 213068
output: 566
thoughts: 65
Thoughts: **Debugging a String Syntax Error**
Okay, hold on a second. I'm getting a parse error, specifically `failed to parse identifier at pos 34` when working with `openat`. That's not good. Let me take a closer look... Ah, I see the problem! It looks like my string syntax is off. The value assigned to `&AUTO` is using backslashes, like `&AUTO="/dev/video0\x00"`. That's incorrect. I need to use single quotes to define my string or escape the backslash. It should be `'./dev/video0\x00'` instead, or some other appropriate syntax for my environment. That's a classic mistake, but easy to fix. Let's get that corrected and see if that resolves the issue.
|
| 112/2 |
2026/05/19 14:37 |
tool |
reproduce-crash |
1m
Args: map[ReproSyz:r0 = syz_usb_connect(3, 0x2b, &AUTO=ANY=[@ANYRES8=0x12, @ANYRES8=0x01, @ANYRES8=0x00, @ANYRES8=0x02, @ANYRES8=0xff, @ANYRES8=0xff, @ANYRES8=0xff, @ANYRES8=0x40, @ANYRES8=0x1a, @ANYRES8=0xeb, @ANYRES8=0x00, @ANYRES8=0x28, @ANYRES8=0x00, @ANYRES8=0x01, @ANYRES8=0x00, @ANYRES8=0x00, @ANYRES8=0x00, @ANYRES8=0x01, @ANYRES8=0x09, @ANYRES8=0x02, @ANYRES8=0x19, @ANYRES8=0x00, @ANYRES8=0x01, @ANYRES8=0x01, @ANYRES8=0x00, @ANYRES8=0x80, @ANYRES8=0xfa, @ANYRES8=0x09, @ANYRES8=0x04, @ANYRES8=0x00, @ANYRES8=0x00, @ANYRES8=0x01, @ANYRES8=0xff, @ANYRES8=0xff, @ANYRES8=0xff, @ANYRES8=0x00, @ANYRES8=0x07, @ANYRES8=0x05, @ANYRES8=0x82, @ANYRES8=0x02, @ANYRES8=0x00, @ANYRES8=0x02, @ANYRES8=0x00], &AUTO={0, 0, 0, 0, 0, []})
openat(0xffffffffffffff9c, &AUTO='./dev/video0\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video1\x00', 0x2, 0x0) (async)
syz_usb_disconnect(r0) (async)
]
Results: map[CoverageID: ReproducedBugTitle: ReproducedCrashReport:]
|
| 113/2 |
2026/05/19 14:38 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 213904
output: 313
thoughts: 53
Thoughts: **A Moment of Relief and a Refocus**
Okay, it didn't crash. Good. Now, let's think this through. Hang on... `ANYRES8`... that's a *resource* type, isn't it? Right. So, using `ANYRES8` probably means I'm not dealing with a simple byte here. I need to treat it accordingly. Back to the drawing board. Let's try that `@ANYBLOB='...'` approach again. This time, I'll be extra careful and use those single quotes. Maybe that was the key all along. Time to see if this tweak makes a difference.
|
| 114/2 |
2026/05/19 14:39 |
tool |
reproduce-crash |
1m
Args: map[ReproSyz:r0 = syz_usb_connect(3, 0x2b, &AUTO=ANY=[@ANYBLOB='\x12\x01\x00\x02\xff\xff\xff\x40\x1a\xeb\x00\x28\x00\x01\x00\x00\x00\x01\x09\x02\x19\x00\x01\x01\x00\x80\xfa\x09\x04\x00\x00\x01\xff\xff\xff\x00\x07\x05\x82\x02\x00\x02\x00'], &AUTO={0, 0, 0, 0, 0, []})
openat(0xffffffffffffff9c, &AUTO='./dev/video0\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video1\x00', 0x2, 0x0) (async)
syz_usb_disconnect(r0) (async)
]
Results: map[CoverageID: ReproducedBugTitle: ReproducedCrashReport:]
|
| 115/2 |
2026/05/19 14:40 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 214439
output: 387
thoughts: 1072
Thoughts: **Debugging a USB Device Connection**
Okay, it didn't crash, which is surprising. I used `ANYBLOB`, so that *should* have worked, but the bug didn't trigger. Why not? Maybe the device wasn't enumerated properly? Let me check if `em28xx_usb_probe` was actually successful. Right, the `idVendor` is `0xeb1a` and the `idProduct` is `0x2800`. Ah, wait! Those IDs are little-endian! `0x1a\xeb` is `0xeb1a` and `0x00\x28` is `0x2800`. That's right, USB descriptors are little-endian.
Let's look at the descriptors. `bMaxPacketSize0` is `0x40` which is 64. `bNumConfigurations` is `0x01`. Now, the configuration descriptor: `0x09, 0x02, 0x19\x00, 0x01, 0x01, 0x00, 0x80, 0xfa`. `wTotalLength` is `0x19\x00`, which is `0x0019`, or 25. Let me make sure that's correct...9 + 9 + 7 = 25! Okay, `wTotalLength` is right. Then the interface descriptor: `0x09, 0x04, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0x00`. And the endpoint descriptor: `0x07, 0x05, 0x82, 0x02, 0x00\x02, 0x00`. Hang on, `wMaxPacketSize` is `0x00\x02`? In little-endian, that's `0x0200`, so 512. Yes, that's right. `0x0200` is indeed 512. So, the descriptor seems completely valid!
So, why no crash? Maybe the timing of `openat` is the problem. It could be that it was called too early or too late. Remember that syzkaller executes async calls concurrently. `syz_usb_connect` waits for enumeration, so when it returns, the device *should* be enumerated. Then, `openat` and `syz_usb_disconnect` run concurrently. But, maybe `openat` gets executed *before* `syz_usb_disconnect` starts? If `openat` finishes first, it just opens and closes the device. If `syz_usb_disconnect` finishes first, then `openat` will fail with `ENOENT`. So, it looks like we need to create a race condition. To increase the chance of the race happening, let's run `openat` calls in a loop or duplicate them. I'll try that!
|
| 116/2 |
2026/05/19 14:40 |
tool |
reproduce-crash |
1m
Args: map[ReproSyz:r0 = syz_usb_connect(3, 0x2b, &AUTO=ANY=[@ANYBLOB='\x12\x01\x00\x02\xff\xff\xff\x40\x1a\xeb\x00\x28\x00\x01\x00\x00\x00\x01\x09\x02\x19\x00\x01\x01\x00\x80\xfa\x09\x04\x00\x00\x01\xff\xff\xff\x00\x07\x05\x82\x02\x00\x02\x00'], &AUTO={0, 0, 0, 0, 0, []})
openat(0xffffffffffffff9c, &AUTO='./dev/video0\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video0\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video0\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video0\x00', 0x2, 0x0) (async)
syz_usb_disconnect(r0) (async)
]
Results: map[CoverageID: ReproducedBugTitle: ReproducedCrashReport:]
|
| 117/2 |
2026/05/19 14:42 |
llm |
crash-repro-finder |
2m
Model:
Tokens:
input: 216616
output: 387
thoughts: 423
Thoughts: **Debugging the Video Device Connection**
Okay, so the program still hasn't crashed. That's good, but it means I need to adjust my hypothesis. Perhaps the camera isn't actually bound to `/dev/video0`. It's a common oversight. Let's see if there are other video devices present. I'll need to check the potential alternative device paths.
I'll try opening several video devices simultaneously. The code will open `/dev/video0`, `/dev/video1`, `/dev/video2`, and `/dev/video3` concurrently. This should cover all the usual suspects. I also need to make sure I am cleaning up the resources, so I am going to disconnect the USB after the file operations.
|
| 118/2 |
2026/05/19 14:45 |
tool |
reproduce-crash |
1m
Args: map[ReproSyz:r0 = syz_usb_connect(3, 0x2b, &AUTO=ANY=[@ANYBLOB='\x12\x01\x00\x02\xff\xff\xff\x40\x1a\xeb\x00\x28\x00\x01\x00\x00\x00\x01\x09\x02\x19\x00\x01\x01\x00\x80\xfa\x09\x04\x00\x00\x01\xff\xff\xff\x00\x07\x05\x82\x02\x00\x02\x00'], &AUTO={0, 0, 0, 0, 0, []})
openat(0xffffffffffffff9c, &AUTO='./dev/video0\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video1\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video2\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video3\x00', 0x2, 0x0) (async)
syz_usb_disconnect(r0) (async)
]
Results: map[CoverageID: ReproducedBugTitle: ReproducedCrashReport:]
|
| 119/2 |
2026/05/19 14:46 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 217614
output: 427
thoughts: 1483
Thoughts: **Analyzing the USB Device Driver Probe and Disconnect Sequence**
Okay, so the program hasn't crashed yet, which is good. The key here seems to be the timing between the USB probe and the driver loading. Specifically, I'm thinking the `em28xx_usb_probe` function might be failing, and that the `request_modules` function, which is responsible for loading the `em28xx-video` module, is asynchronous, scheduled as a workqueue. This means `syz_usb_connect` might be returning *before* `em28xx-video` is fully loaded.
Yes, `request_modules` *does* schedule a workqueue. So, when the probe returns, it's returning immediately and then calling `syz_usb_connect`. At this point `/dev/video0` *isn't* created yet. The device will be fully set up when the workqueue runs, when `em28xx-video` gets loaded, and `em28xx_v4l2_init` gets called. If I call `openat` immediately, I'll get an `ENOENT` error, which is expected. Disconnecting the device *immediately* with `syz_usb_disconnect` would disconnect it before the driver is fully initialized! So the device must be initialized before it is disconnected.
The challenge is how to introduce a delay in syzkaller to allow the async part to execute. I can't explicitly wait. The key here is not to explicitly wait, but to rely on how syzkaller executes calls. If I call `syz_usb_disconnect` immediately, the device is disconnected too soon.
So, how do I ensure a disconnect *after* the module loads? I need to make sure that the `dev->v4l2` pointer goes to NULL. I'm recalling now that `em28xx_v4l2_init` *might* fail, and if it fails, it sets `dev->v4l2 = NULL`. I need to figure out if it fails with the descriptor I'm using. Let's look at `em28xx_v4l2_init`. The function calls `video_register_device` for a V4L2 video device, and if that succeeds, it tries to register a VBI device. If registering the VBI device fails, the V4L2 video device gets unregistered, and importantly, `dev->v4l2` *is* set to NULL.
Why would the VBI registration fail? It's not the endpoint, since it uses the same one. Maybe `em28xx_vb2_setup` or `em28xx_audio_setup` could fail, but these functions happen before the VBI registration. So, in my scenario, it looks like `em28xx_v4l2_init` will *succeed* with this descriptor. If it succeeds, `dev->v4l2` is *never* `NULL`! That means I *must* call `syz_usb_disconnect` to get `dev->v4l2 = NULL`!
The problem is the timing. If I disconnect too soon, it disconnects before the driver is fully loaded. I need a way to delay the disconnect. One option is to use `syz_usb_control_io` to introduce a delay. Another option is to simply call `openat` repeatedly, which will fail with ENOENT but will consume some time, and *then* call `syz_usb_disconnect`.
The way syzkaller executes calls is key! Syzkaller executes async calls concurrently. If I don't use `async` for a set of calls, they will be executed sequentially! This gives me an idea:
```
r0 = syz_usb_connect(...)
openat(...) # This will fail with ENOENT, but takes some time
openat(...) # This will fail with ENOENT, but takes some time
...
openat(...) # Maybe now it succeeds?
syz_usb_disconnect(r0) (async)
openat(...) (async)
```
Now to implement. I'll add some dummy syscalls, `getpid()`, to create a delay. Then I'll call `syz_usb_disconnect` asynchronously. Then several `openat` calls, which will hopefully be done after the driver has loaded. Let's try this now!
|
| 120/2 |
2026/05/19 14:47 |
tool |
reproduce-crash |
1m
Args: map[ReproSyz:r0 = syz_usb_connect(3, 0x2b, &AUTO=ANY=[@ANYBLOB='\x12\x01\x00\x02\xff\xff\xff\x40\x1a\xeb\x00\x28\x00\x01\x00\x00\x00\x01\x09\x02\x19\x00\x01\x01\x00\x80\xfa\x09\x04\x00\x00\x01\xff\xff\xff\x00\x07\x05\x82\x02\x00\x02\x00'], &AUTO={0, 0, 0, 0, 0, []})
getpid()
getpid()
getpid()
getpid()
getpid()
getpid()
getpid()
getpid()
getpid()
getpid()
syz_usb_disconnect(r0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video0\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video1\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video2\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video3\x00', 0x2, 0x0) (async)
]
Results: map[CoverageID: ReproducedBugTitle: ReproducedCrashReport:]
|
| 121/2 |
2026/05/19 14:48 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 220515
output: 415
thoughts: 251
Thoughts: **Delaying Tactics**
Okay, so the program still hasn't crashed. That's unexpected. Perhaps `getpid()` is just too quick, not giving things enough time to settle. I need to introduce a deliberate delay. Now, what's the best way to do that? I was thinking about `syz_usb_control_io` as a possibility, since I'm already in this USB context, or maybe a simple `sleep`. But, ah, Syzkaller doesn't have a `sleep` primitive natively.
Hmm, what about `usleep_range`? That would be ideal for a bit of non-determinism, but no, that's a kernel internal function, so that won't work. Okay, think, think. Right, there's `nanosleep`. But wait, that's not among the default syscalls, is it? I think `clock_nanosleep` is, though. Need to double-check if `clock_nanosleep` is actually available in the current environment.
Hold on. I could also just use a really big loop calling something innocuous like `openat`. Crude, but effective... But, wait again! If the `em28xx-video` module is loaded, that could introduce a massive delay, potentially hundreds of milliseconds, which is not what I want. So that's out.
Right, back to the `clock_nanosleep` or maybe an `epoll_wait` with a timeout. Let's see... looking at the existing code, it has this: `epoll_wait(0xffffffffffffffff, 0x0, 0x0, 0x64)`. The `0x64` at the end means 100 milliseconds, doesn't it? Okay, I'll try using `epoll_wait(-1, 0, 0, 100)`. Seems like that's the cleanest option.
|
| 122/2 |
2026/05/19 14:48 |
tool |
reproduce-crash |
1m
Args: map[ReproSyz:r0 = syz_usb_connect(3, 0x2b, &AUTO=ANY=[@ANYBLOB='\x12\x01\x00\x02\xff\xff\xff\x40\x1a\xeb\x00\x28\x00\x01\x00\x00\x00\x01\x09\x02\x19\x00\x01\x01\x00\x80\xfa\x09\x04\x00\x00\x01\xff\xff\xff\x00\x07\x05\x82\x02\x00\x02\x00'], &AUTO={0, 0, 0, 0, 0, []})
epoll_wait(0xffffffffffffffff, 0x0, 0x0, 0x64)
syz_usb_disconnect(r0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video0\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video1\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video2\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video3\x00', 0x2, 0x0) (async)
]
Results: map[CoverageID: ReproducedBugTitle: ReproducedCrashReport:]
|
| 123/2 |
2026/05/19 14:50 |
llm |
crash-repro-finder |
1m
Model:
Tokens:
input: 221634
output: 405
thoughts: 94
Thoughts: Here's my thought process on the matter:
**Debugging the Non-Crashing Epoll Loop**
Okay, the program still isn't crashing as expected. Hmm, I wonder if the `-1` file descriptor in `epoll_wait` is causing an immediate return with an `EBADF` error. It's a plausible scenario. Yep, `EBADF` is exactly what I'm seeing.
So, the issue is clear. I need to make sure I'm passing a valid file descriptor to `epoll_wait`, or perhaps I should consider a different approach altogether if I don't have one readily available, such as using `poll` with an empty set of file descriptors. Let's see what `poll` thinks of that.
I'm seeing `poll(0x0, 0x0, 0x64)` in the output. Okay, let's try `poll(0, 0, 100)` and see what happens.
|
| 124/2 |
2026/05/19 14:51 |
tool |
reproduce-crash |
1m
Args: map[ReproSyz:r0 = syz_usb_connect(3, 0x2b, &AUTO=ANY=[@ANYBLOB='\x12\x01\x00\x02\xff\xff\xff\x40\x1a\xeb\x00\x28\x00\x01\x00\x00\x00\x01\x09\x02\x19\x00\x01\x01\x00\x80\xfa\x09\x04\x00\x00\x01\xff\xff\xff\x00\x07\x05\x82\x02\x00\x02\x00'], &AUTO={0, 0, 0, 0, 0, []})
poll(0x0, 0x0, 0x64)
syz_usb_disconnect(r0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video0\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video1\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video2\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video3\x00', 0x2, 0x0) (async)
]
Results: map[CoverageID: ReproducedBugTitle: ReproducedCrashReport:]
|
| 125/2 |
2026/05/19 14:53 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 222378
output: 406
thoughts: 472
Thoughts: **Debugging a Potential Race Condition**
Okay, so the last attempt didn't trigger a crash. Hmm, 100 milliseconds might be the wrong amount of time for this race to manifest. Is it too short, or maybe too long? Let's try increasing that `poll` duration to 500 milliseconds. I'll make the call:
```
poll(0x0, 0x0, 0x1f4)
```
Now, to increase the probability of hitting the race condition, I should duplicate the calls to `openat` and `syz_usb_disconnect`. That should give us a higher chance of that interaction occurring. Here's how I'm thinking of structuring the calls:
```
r0 = syz_usb_connect(3, 0x2b, &AUTO=...)
poll(0x0, 0x0, 0x1f4)
syz_usb_disconnect(r0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video0\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video1\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video2\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video3\x00', 0x2, 0x0) (async)
```
Hopefully, this will flush out the issue. Let's see what happens.
|
| 126/2 |
2026/05/19 14:53 |
tool |
reproduce-crash |
1m
Args: map[ReproSyz:r0 = syz_usb_connect(3, 0x2b, &AUTO=ANY=[@ANYBLOB='\x12\x01\x00\x02\xff\xff\xff\x40\x1a\xeb\x00\x28\x00\x01\x00\x00\x00\x01\x09\x02\x19\x00\x01\x01\x00\x80\xfa\x09\x04\x00\x00\x01\xff\xff\xff\x00\x07\x05\x82\x02\x00\x02\x00'], &AUTO={0, 0, 0, 0, 0, []})
poll(0x0, 0x0, 0x1f4)
syz_usb_disconnect(r0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video0\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video1\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video2\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video3\x00', 0x2, 0x0) (async)
]
Results: map[CoverageID: ReproducedBugTitle: ReproducedCrashReport:]
|
| 127/2 |
2026/05/19 14:54 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 223669
output: 54
thoughts: 650
Thoughts: **Debugging a USB Driver: A Deep Dive**
Okay, so the fuzzing is still not resulting in a crash. Time to critically analyze. I'm starting to suspect there's a problem with the fundamental USB connection and disconnection calls, `syz_usb_connect` and `syz_usb_disconnect`. Specifically, I need to verify that `syz_usb_connect` is correctly returning `r0`, which is supposed to be the `fd_usb` file descriptor. Similarly, `syz_usb_disconnect` relies on a valid `fd_usb`. If `r0` is invalid, the disconnect might be failing silently. I need to make sure `em28xx_usb_probe` is even succeeding in the first place, that's crucial. If it's failing, `/dev/video0` wouldn't be created, and that's a red flag.
Let's dissect why `em28xx_usb_probe` might fail. Initially, the check for `udev->speed != USB_SPEED_HIGH` seemed off, but I'm passing `3`, which *is* `USB_SPEED_HIGH`. That's not the problem. Then, I considered the `has_video` flag. I know it's supposed to be set to true since I'm passing `0x82` with `USB_ENDPOINT_XFER_BULK`. Wait, let me decode that `0x82`. It's `USB_DIR_IN | 2`. And `USB_ENDPOINT_XFER_BULK` is `2`. This is where it gets interesting, so I need to go over the `usb_endpoint_xfer_bulk` logic.
```c
static inline int usb_endpoint_xfer_bulk(
const struct usb_endpoint_descriptor *epd)
{
return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_BULK);
}
```
So `USB_ENDPOINT_XFERTYPE_MASK` is 3. The check is essentially `bmAttributes & 3 == 2`. And I'm passing `0x02` for `bmAttributes`, right? Thus, `usb_endpoint_xfer_bulk` is indeed true. Furthermore, `bEndpointAddress` is set to `0x82`, confirming `has_video` being true!
Alright, it's becoming clearer, but there's a final check within `em28xx_usb_probe`:
```c
if (has_video &&
dev->board.decoder == EM28XX_NODECODER &&
dev->em28xx_sensor == EM28XX_NOSENSOR) {
dev_err(&intf->dev,
"Currently, V4L2 is not supported on this model\n");
has_video = false;
dev->has_video = false;
}
```
Aha! `has_video` *must* be true, but, for this specific probe, either `dev->board.decoder` must *not* be `EM28XX_NODECODER` OR `dev->em28xx_sensor` must *not* be `EM28XX_NOSENSOR`! This is the likely culprit! I need to consult the `em28xx_boards` table to investigate the board ID `0xeb1a:0x2800`.
```c
{ USB_DEVICE(0xeb1a, 0x2800),
.driver_info = EM2800_BOARD_UNKNOWN },
```
Okay, the board is `EM2800_BOARD_UNKNOWN`. I need to figure out the implications of `EM2800_BOARD_UNKNOWN` in relation to the decoder and sensor checks. This could be where the probe is failing and thus not setting up the `/dev/video0` device, rendering the entire fuzzing routine moot!
|
| 128/2 |
2026/05/19 14:55 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/media/usb/em28xx/em28xx-cards.c IncludeLines:true Name:em28xx_boards]
Results: map[SourceCode: 692: /*
693: * Board definitions
694: */
695: const struct em28xx_board em28xx_boards[] = {
696: [EM2750_BOARD_UNKNOWN] = {
697: .name = "EM2710/EM2750/EM2751 webcam grabber",
698: .xclk = EM28XX_XCLK_FREQUENCY_20MHZ,
699: .tuner_type = TUNER_ABSENT,
700: .is_webcam = 1,
701: .input = { {
702: .type = EM28XX_VMUX_COMPOSITE,
703: .vmux = 0,
704: .amux = EM28XX_AMUX_VIDEO,
705: .gpio = silvercrest_reg_seq,
706: } },
707: },
708: [EM2800_BOARD_UNKNOWN] = {
709: .name = "Unknown EM2800 video grabber",
710: .is_em2800 = 1,
711: .tda9887_conf = TDA9887_PRESENT,
712: .decoder = EM28XX_SAA711X,
713: .tuner_type = TUNER_ABSENT,
714: .input = { {
715: .type = EM28XX_VMUX_COMPOSITE,
716: .vmux = SAA7115_COMPOSITE0,
717: .amux = EM28XX_AMUX_LINE_IN,
718: }, {
719: .type = EM28XX_VMUX_SVIDEO,
720: .vmux = SAA7115_SVIDEO3,
721: .amux = EM28XX_AMUX_LINE_IN,
722: } },
723: },
724: [EM2820_BOARD_UNKNOWN] = {
725: .name = "Unknown EM2750/28xx video grabber",
726: .tuner_type = TUNER_ABSENT,
727: .is_webcam = 1, /* To enable sensor probe */
728: },
729: [EM2882_BOARD_ZOLID_HYBRID_TV_STICK] = {
730: .name = ":ZOLID HYBRID TV STICK",
731: .tuner_type = TUNER_XC2028,
732: .tuner_gpio = zolid_tuner,
733: .decoder = EM28XX_TVP5150,
734: .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
735: .mts_firmware = 1,
736: .has_dvb = 1,
737: .dvb_gpio = zolid_digital,
738: },
739: [EM2750_BOARD_DLCW_130] = {
740: /* Beijing Huaqi Information Digital Technology Co., Ltd */
741: .name = "Huaqi DLCW-130",
742: .valid = EM28XX_BOARD_NOT_VALIDATED,
743: .xclk = EM28XX_XCLK_FREQUENCY_48MHZ,
744: .tuner_type = TUNER_ABSENT,
745: .is_webcam = 1,
746: .input = { {
747: .type = EM28XX_VMUX_COMPOSITE,
748: .vmux = 0,
749: .amux = EM28XX_AMUX_VIDEO,
750: } },
751: },
752: [EM2820_BOARD_KWORLD_PVRTV2800RF] = {
753: .name = "Kworld PVR TV 2800 RF",
754: .tuner_type = TUNER_TEMIC_PAL,
755: .tda9887_conf = TDA9887_PRESENT,
756: .decoder = EM28XX_SAA711X,
757: .input = { {
758: .type = EM28XX_VMUX_COMPOSITE,
759: .vmux = SAA7115_COMPOSITE0,
760: .amux = EM28XX_AMUX_LINE_IN,
761: }, {
762: .type = EM28XX_VMUX_SVIDEO,
763: .vmux = SAA7115_SVIDEO3,
764: .amux = EM28XX_AMUX_LINE_IN,
765: } },
766: },
767: [EM2820_BOARD_GADMEI_TVR200] = {
768: .name = "Gadmei TVR200",
769: .tuner_type = TUNER_LG_PAL_NEW_TAPC,
770: .tda9887_conf = TDA9887_PRESENT,
771: .decoder = EM28XX_SAA711X,
772: .input = { {
773: .type = EM28XX_VMUX_TELEVISION,
774: .vmux = SAA7115_COMPOSITE2,
775: .amux = EM28XX_AMUX_LINE_IN,
776: }, {
777: .type = EM28XX_VMUX_COMPOSITE,
778: .vmux = SAA7115_COMPOSITE0,
779: .amux = EM28XX_AMUX_LINE_IN,
780: }, {
781: .type = EM28XX_VMUX_SVIDEO,
782: .vmux = SAA7115_SVIDEO3,
783: .amux = EM28XX_AMUX_LINE_IN,
784: } },
785: },
786: [EM2820_BOARD_TERRATEC_CINERGY_250] = {
787: .name = "Terratec Cinergy 250 USB",
788: .tuner_type = TUNER_LG_PAL_NEW_TAPC,
789: .has_ir_i2c = 1,
790: .tda9887_conf = TDA9887_PRESENT,
791: .decoder = EM28XX_SAA711X,
792: .input = { {
793: .type = EM28XX_VMUX_TELEVISION,
794: .vmux = SAA7115_COMPOSITE2,
795: .amux = EM28XX_AMUX_VIDEO,
796: }, {
797: .type = EM28XX_VMUX_COMPOSITE,
798: .vmux = SAA7115_COMPOSITE0,
799: .amux = EM28XX_AMUX_LINE_IN,
800: }, {
801: .type = EM28XX_VMUX_SVIDEO,
802: .vmux = SAA7115_SVIDEO3,
803: .amux = EM28XX_AMUX_LINE_IN,
804: } },
805: },
806: [EM2820_BOARD_PINNACLE_USB_2] = {
807: .name = "Pinnacle PCTV USB 2",
808: .tuner_type = TUNER_LG_PAL_NEW_TAPC,
809: .has_ir_i2c = 1,
810: .tda9887_conf = TDA9887_PRESENT,
811: .decoder = EM28XX_SAA711X,
812: .input = { {
813: .type = EM28XX_VMUX_TELEVISION,
814: .vmux = SAA7115_COMPOSITE2,
815: .amux = EM28XX_AMUX_VIDEO,
816: }, {
817: .type = EM28XX_VMUX_COMPOSITE,
818: .vmux = SAA7115_COMPOSITE0,
819: .amux = EM28XX_AMUX_LINE_IN,
820: }, {
821: .type = EM28XX_VMUX_SVIDEO,
822: .vmux = SAA7115_SVIDEO3,
823: .amux = EM28XX_AMUX_LINE_IN,
824: } },
825: },
826: [EM2820_BOARD_HAUPPAUGE_WINTV_USB_2] = {
827: .name = "Hauppauge WinTV USB 2",
828: .tuner_type = TUNER_PHILIPS_FM1236_MK3,
829: .tda9887_conf = TDA9887_PRESENT |
830: TDA9887_PORT1_ACTIVE |
831: TDA9887_PORT2_ACTIVE,
832: .decoder = EM28XX_TVP5150,
833: .has_msp34xx = 1,
834: .has_ir_i2c = 1,
835: .input = { {
836: .type = EM28XX_VMUX_TELEVISION,
837: .vmux = TVP5150_COMPOSITE0,
838: .amux = MSP_INPUT_DEFAULT,
839: }, {
840: .type = EM28XX_VMUX_SVIDEO,
841: .vmux = TVP5150_SVIDEO,
842: .amux = MSP_INPUT(MSP_IN_SCART1, MSP_IN_TUNER1,
843: MSP_DSP_IN_SCART, MSP_DSP_IN_SCART),
844: } },
845: },
846: [EM2820_BOARD_DLINK_USB_TV] = {
847: .name = "D-Link DUB-T210 TV Tuner",
848: .valid = EM28XX_BOARD_NOT_VALIDATED,
849: .tuner_type = TUNER_LG_PAL_NEW_TAPC,
850: .tda9887_conf = TDA9887_PRESENT,
851: .decoder = EM28XX_SAA711X,
852: .input = { {
853: .type = EM28XX_VMUX_TELEVISION,
854: .vmux = SAA7115_COMPOSITE2,
855: .amux = EM28XX_AMUX_LINE_IN,
856: }, {
857: .type = EM28XX_VMUX_COMPOSITE,
858: .vmux = SAA7115_COMPOSITE0,
859: .amux = EM28XX_AMUX_LINE_IN,
860: }, {
861: .type = EM28XX_VMUX_SVIDEO,
862: .vmux = SAA7115_SVIDEO3,
863: .amux = EM28XX_AMUX_LINE_IN,
864: } },
865: },
866: [EM2820_BOARD_HERCULES_SMART_TV_USB2] = {
867: .name = "Hercules Smart TV USB 2.0",
868: .valid = EM28XX_BOARD_NOT_VALIDATED,
869: .tuner_type = TUNER_LG_PAL_NEW_TAPC,
870: .tda9887_conf = TDA9887_PRESENT,
871: .decoder = EM28XX_SAA711X,
872: .input = { {
873: .type = EM28XX_VMUX_TELEVISION,
874: .vmux = SAA7115_COMPOSITE2,
875: .amux = EM28XX_AMUX_LINE_IN,
876: }, {
877: .type = EM28XX_VMUX_COMPOSITE,
878: .vmux = SAA7115_COMPOSITE0,
879: .amux = EM28XX_AMUX_LINE_IN,
880: }, {
881: .type = EM28XX_VMUX_SVIDEO,
882: .vmux = SAA7115_SVIDEO3,
883: .amux = EM28XX_AMUX_LINE_IN,
884: } },
885: },
886: [EM2820_BOARD_PINNACLE_USB_2_FM1216ME] = {
887: .name = "Pinnacle PCTV USB 2 (Philips FM1216ME)",
888: .valid = EM28XX_BOARD_NOT_VALIDATED,
889: .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
890: .tda9887_conf = TDA9887_PRESENT,
891: .decoder = EM28XX_SAA711X,
892: .input = { {
893: .type = EM28XX_VMUX_TELEVISION,
894: .vmux = SAA7115_COMPOSITE2,
895: .amux = EM28XX_AMUX_VIDEO,
896: }, {
897: .type = EM28XX_VMUX_COMPOSITE,
898: .vmux = SAA7115_COMPOSITE0,
899: .amux = EM28XX_AMUX_LINE_IN,
900: }, {
901: .type = EM28XX_VMUX_SVIDEO,
902: .vmux = SAA7115_SVIDEO3,
903: .amux = EM28XX_AMUX_LINE_IN,
904: } },
905: },
906: [EM2820_BOARD_GADMEI_UTV310] = {
907: .name = "Gadmei UTV310",
908: .valid = EM28XX_BOARD_NOT_VALIDATED,
909: .tuner_type = TUNER_TNF_5335MF,
910: .tda9887_conf = TDA9887_PRESENT,
911: .decoder = EM28XX_SAA711X,
912: .input = { {
913: .type = EM28XX_VMUX_TELEVISION,
914: .vmux = SAA7115_COMPOSITE1,
915: .amux = EM28XX_AMUX_LINE_IN,
916: }, {
917: .type = EM28XX_VMUX_COMPOSITE,
918: .vmux = SAA7115_COMPOSITE0,
919: .amux = EM28XX_AMUX_LINE_IN,
920: }, {
921: .type = EM28XX_VMUX_SVIDEO,
922: .vmux = SAA7115_SVIDEO3,
923: .amux = EM28XX_AMUX_LINE_IN,
924: } },
925: },
926: [EM2820_BOARD_LEADTEK_WINFAST_USBII_DELUXE] = {
927: .name = "Leadtek Winfast USB II Deluxe",
928: .valid = EM28XX_BOARD_NOT_VALIDATED,
929: .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
930: .has_ir_i2c = 1,
931: .tvaudio_addr = 0x58,
932: .tda9887_conf = TDA9887_PRESENT |
933: TDA9887_PORT2_ACTIVE |
934: TDA9887_QSS,
935: .decoder = EM28XX_SAA711X,
936: .adecoder = EM28XX_TVAUDIO,
937: .input = { {
938: .type = EM28XX_VMUX_TELEVISION,
939: .vmux = SAA7115_COMPOSITE4,
940: .amux = EM28XX_AMUX_AUX,
941: }, {
942: .type = EM28XX_VMUX_COMPOSITE,
943: .vmux = SAA7115_COMPOSITE5,
944: .amux = EM28XX_AMUX_LINE_IN,
945: }, {
946: .type = EM28XX_VMUX_SVIDEO,
947: .vmux = SAA7115_SVIDEO3,
948: .amux = EM28XX_AMUX_LINE_IN,
949: } },
950: .radio = {
951: .type = EM28XX_RADIO,
952: .amux = EM28XX_AMUX_AUX,
953: }
954: },
955: [EM2820_BOARD_VIDEOLOGY_20K14XUSB] = {
956: .name = "Videology 20K14XUSB USB2.0",
957: .valid = EM28XX_BOARD_NOT_VALIDATED,
958: .tuner_type = TUNER_ABSENT,
959: .is_webcam = 1,
960: .input = { {
961: .type = EM28XX_VMUX_COMPOSITE,
962: .vmux = 0,
963: .amux = EM28XX_AMUX_VIDEO,
964: } },
965: },
966: [EM2820_BOARD_SILVERCREST_WEBCAM] = {
967: .name = "Silvercrest Webcam 1.3mpix",
968: .tuner_type = TUNER_ABSENT,
969: .is_webcam = 1,
970: .input = { {
971: .type = EM28XX_VMUX_COMPOSITE,
972: .vmux = 0,
973: .amux = EM28XX_AMUX_VIDEO,
974: .gpio = silvercrest_reg_seq,
975: } },
976: },
977: [EM2821_BOARD_SUPERCOMP_USB_2] = {
978: .name = "Supercomp USB 2.0 TV",
979: .valid = EM28XX_BOARD_NOT_VALIDATED,
980: .tuner_type = TUNER_PHILIPS_FM1236_MK3,
981: .tda9887_conf = TDA9887_PRESENT |
982: TDA9887_PORT1_ACTIVE |
983: TDA9887_PORT2_ACTIVE,
984: .decoder = EM28XX_SAA711X,
985: .input = { {
986: .type = EM28XX_VMUX_TELEVISION,
987: .vmux = SAA7115_COMPOSITE2,
988: .amux = EM28XX_AMUX_LINE_IN,
989: }, {
990: .type = EM28XX_VMUX_COMPOSITE,
991: .vmux = SAA7115_COMPOSITE0,
992: .amux = EM28XX_AMUX_VIDEO,
993: }, {
994: .type = EM28XX_VMUX_SVIDEO,
995: .vmux = SAA7115_SVIDEO3,
996: .amux = EM28XX_AMUX_LINE_IN,
997: } },
998: },
999: [EM2821_BOARD_USBGEAR_VD204] = {
1000: .name = "Usbgear VD204v9",
1001: .valid = EM28XX_BOARD_NOT_VALIDATED,
1002: .tuner_type = TUNER_ABSENT, /* Capture only device */
1003: .decoder = EM28XX_SAA711X,
1004: .input = { {
1005: .type = EM28XX_VMUX_COMPOSITE,
1006: .vmux = SAA7115_COMPOSITE0,
1007: .amux = EM28XX_AMUX_LINE_IN,
1008: }, {
1009: .type = EM28XX_VMUX_SVIDEO,
1010: .vmux = SAA7115_SVIDEO3,
1011: .amux = EM28XX_AMUX_LINE_IN,
1012: } },
1013: },
1014: [EM2860_BOARD_NETGMBH_CAM] = {
1015: /* Beijing Huaqi Information Digital Technology Co., Ltd */
1016: .name = "NetGMBH Cam",
1017: .valid = EM28XX_BOARD_NOT_VALIDATED,
1018: .tuner_type = TUNER_ABSENT,
1019: .is_webcam = 1,
1020: .input = { {
1021: .type = EM28XX_VMUX_COMPOSITE,
1022: .vmux = 0,
1023: .amux = EM28XX_AMUX_VIDEO,
1024: } },
1025: },
1026: [EM2860_BOARD_TYPHOON_DVD_MAKER] = {
1027: .name = "Typhoon DVD Maker",
1028: .decoder = EM28XX_SAA711X,
1029: .tuner_type = TUNER_ABSENT, /* Capture only device */
1030: .input = { {
1031: .type = EM28XX_VMUX_COMPOSITE,
1032: .vmux = SAA7115_COMPOSITE0,
1033: .amux = EM28XX_AMUX_LINE_IN,
1034: }, {
1035: .type = EM28XX_VMUX_SVIDEO,
1036: .vmux = SAA7115_SVIDEO3,
1037: .amux = EM28XX_AMUX_LINE_IN,
1038: } },
1039: },
1040: [EM2860_BOARD_GADMEI_UTV330] = {
1041: .name = "Gadmei UTV330",
1042: .valid = EM28XX_BOARD_NOT_VALIDATED,
1043: .tuner_type = TUNER_TNF_5335MF,
1044: .tda9887_conf = TDA9887_PRESENT,
1045: .decoder = EM28XX_SAA711X,
1046: .input = { {
1047: .type = EM28XX_VMUX_TELEVISION,
1048: .vmux = SAA7115_COMPOSITE2,
1049: .amux = EM28XX_AMUX_VIDEO,
1050: }, {
1051: .type = EM28XX_VMUX_COMPOSITE,
1052: .vmux = SAA7115_COMPOSITE0,
1053: .amux = EM28XX_AMUX_LINE_IN,
1054: }, {
1055: .type = EM28XX_VMUX_SVIDEO,
1056: .vmux = SAA7115_SVIDEO3,
1057: .amux = EM28XX_AMUX_LINE_IN,
1058: } },
1059: },
1060: [EM2861_BOARD_GADMEI_UTV330PLUS] = {
1061: .name = "Gadmei UTV330+",
1062: .tuner_type = TUNER_TNF_5335MF,
1063: .tda9887_conf = TDA9887_PRESENT,
1064: .ir_codes = RC_MAP_GADMEI_RM008Z,
1065: .decoder = EM28XX_SAA711X,
1066: .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
1067: .input = { {
1068: .type = EM28XX_VMUX_TELEVISION,
1069: .vmux = SAA7115_COMPOSITE2,
1070: .amux = EM28XX_AMUX_VIDEO,
1071: }, {
1072: .type = EM28XX_VMUX_COMPOSITE,
1073: .vmux = SAA7115_COMPOSITE0,
1074: .amux = EM28XX_AMUX_LINE_IN,
1075: }, {
1076: .type = EM28XX_VMUX_SVIDEO,
1077: .vmux = SAA7115_SVIDEO3,
1078: .amux = EM28XX_AMUX_LINE_IN,
1079: } },
1080: },
1081: [EM2860_BOARD_TERRATEC_HYBRID_XS] = {
1082: .name = "Terratec Cinergy A Hybrid XS",
1083: .valid = EM28XX_BOARD_NOT_VALIDATED,
1084: .tuner_type = TUNER_XC2028,
1085: .tuner_gpio = default_tuner_gpio,
1086: .decoder = EM28XX_TVP5150,
1087:
1088: .input = { {
1089: .type = EM28XX_VMUX_TELEVISION,
1090: .vmux = TVP5150_COMPOSITE0,
1091: .amux = EM28XX_AMUX_VIDEO,
1092: .gpio = hauppauge_wintv_hvr_900_analog,
1093: }, {
1094: .type = EM28XX_VMUX_COMPOSITE,
1095: .vmux = TVP5150_COMPOSITE1,
1096: .amux = EM28XX_AMUX_LINE_IN,
1097: .gpio = hauppauge_wintv_hvr_900_analog,
1098: }, {
1099: .type = EM28XX_VMUX_SVIDEO,
1100: .vmux = TVP5150_SVIDEO,
1101: .amux = EM28XX_AMUX_LINE_IN,
1102: .gpio = hauppauge_wintv_hvr_900_analog,
1103: } },
1104: },
1105: [EM2861_BOARD_KWORLD_PVRTV_300U] = {
1106: .name = "KWorld PVRTV 300U",
1107: .valid = EM28XX_BOARD_NOT_VALIDATED,
1108: .tuner_type = TUNER_XC2028,
1109: .tuner_gpio = default_tuner_gpio,
1110: .decoder = EM28XX_TVP5150,
1111: .input = { {
1112: .type = EM28XX_VMUX_TELEVISION,
1113: .vmux = TVP5150_COMPOSITE0,
1114: .amux = EM28XX_AMUX_VIDEO,
1115: }, {
1116: .type = EM28XX_VMUX_COMPOSITE,
1117: .vmux = TVP5150_COMPOSITE1,
1118: .amux = EM28XX_AMUX_LINE_IN,
1119: }, {
1120: .type = EM28XX_VMUX_SVIDEO,
1121: .vmux = TVP5150_SVIDEO,
1122: .amux = EM28XX_AMUX_LINE_IN,
1123: } },
1124: },
1125: [EM2861_BOARD_YAKUMO_MOVIE_MIXER] = {
1126: .name = "Yakumo MovieMixer",
1127: .tuner_type = TUNER_ABSENT, /* Capture only device */
1128: .decoder = EM28XX_TVP5150,
1129: .input = { {
1130: .type = EM28XX_VMUX_TELEVISION,
1131: .vmux = TVP5150_COMPOSITE0,
1132: .amux = EM28XX_AMUX_VIDEO,
1133: }, {
1134: .type = EM28XX_VMUX_COMPOSITE,
1135: .vmux = TVP5150_COMPOSITE1,
1136: .amux = EM28XX_AMUX_LINE_IN,
1137: }, {
1138: .type = EM28XX_VMUX_SVIDEO,
1139: .vmux = TVP5150_SVIDEO,
1140: .amux = EM28XX_AMUX_LINE_IN,
1141: } },
1142: },
1143: [EM2860_BOARD_TVP5150_REFERENCE_DESIGN] = {
1144: .name = "EM2860/TVP5150 Reference Design",
1145: .tuner_type = TUNER_ABSENT, /* Capture only device */
1146: .decoder = EM28XX_TVP5150,
1147: .input = { {
1148: .type = EM28XX_VMUX_COMPOSITE,
1149: .vmux = TVP5150_COMPOSITE1,
1150: .amux = EM28XX_AMUX_LINE_IN,
1151: }, {
1152: .type = EM28XX_VMUX_SVIDEO,
1153: .vmux = TVP5150_SVIDEO,
1154: .amux = EM28XX_AMUX_LINE_IN,
1155: } },
1156: },
1157: [EM2861_BOARD_PLEXTOR_PX_TV100U] = {
1158: .name = "Plextor ConvertX PX-TV100U",
1159: .tuner_type = TUNER_TNF_5335MF,
1160: .xclk = EM28XX_XCLK_I2S_MSB_TIMING |
1161: EM28XX_XCLK_FREQUENCY_12MHZ,
1162: .tda9887_conf = TDA9887_PRESENT,
1163: .decoder = EM28XX_TVP5150,
1164: .has_msp34xx = 1,
1165: .input = { {
1166: .type = EM28XX_VMUX_TELEVISION,
1167: .vmux = TVP5150_COMPOSITE0,
1168: .amux = EM28XX_AMUX_LINE_IN,
1169: .gpio = pinnacle_hybrid_pro_analog,
1170: }, {
1171: .type = EM28XX_VMUX_COMPOSITE,
1172: .vmux = TVP5150_COMPOSITE1,
1173: .amux = EM28XX_AMUX_LINE_IN,
1174: .gpio = pinnacle_hybrid_pro_analog,
1175: }, {
1176: .type = EM28XX_VMUX_SVIDEO,
1177: .vmux = TVP5150_SVIDEO,
1178: .amux = EM28XX_AMUX_LINE_IN,
1179: .gpio = pinnacle_hybrid_pro_analog,
1180: } },
1181: },
1182:
1183: /* Those boards with em2870 are DVB Only*/
1184:
1185: [EM2870_BOARD_TERRATEC_XS] = {
1186: .name = "Terratec Cinergy T XS",
1187: .valid = EM28XX_BOARD_NOT_VALIDATED,
1188: .tuner_type = TUNER_XC2028,
1189: .tuner_gpio = default_tuner_gpio,
1190: },
1191: [EM2870_BOARD_TERRATEC_XS_MT2060] = {
1192: .name = "Terratec Cinergy T XS (MT2060)",
1193: .xclk = EM28XX_XCLK_IR_RC5_MODE |
1194: EM28XX_XCLK_FREQUENCY_12MHZ,
1195: .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE,
1196: .tuner_type = TUNER_ABSENT, /* MT2060 */
1197: .has_dvb = 1,
1198: .tuner_gpio = default_tuner_gpio,
1199: },
1200: [EM2870_BOARD_KWORLD_350U] = {
1201: .name = "Kworld 350 U DVB-T",
1202: .valid = EM28XX_BOARD_NOT_VALIDATED,
1203: .tuner_type = TUNER_XC2028,
1204: .tuner_gpio = default_tuner_gpio,
1205: },
1206: [EM2870_BOARD_KWORLD_355U] = {
1207: .name = "Kworld 355 U DVB-T",
1208: .valid = EM28XX_BOARD_NOT_VALIDATED,
1209: .tuner_type = TUNER_ABSENT,
1210: .tuner_gpio = default_tuner_gpio,
1211: .has_dvb = 1,
1212: .dvb_gpio = default_digital,
1213: },
1214: [EM2870_BOARD_PINNACLE_PCTV_DVB] = {
1215: .name = "Pinnacle PCTV DVB-T",
1216: .valid = EM28XX_BOARD_NOT_VALIDATED,
1217: .tuner_type = TUNER_ABSENT, /* MT2060 */
1218: /* djh - I have serious doubts this is right... */
1219: .xclk = EM28XX_XCLK_IR_RC5_MODE |
1220: EM28XX_XCLK_FREQUENCY_10MHZ,
1221: },
1222: [EM2870_BOARD_COMPRO_VIDEOMATE] = {
1223: .name = "Compro, VideoMate U3",
1224: .valid = EM28XX_BOARD_NOT_VALIDATED,
1225: .tuner_type = TUNER_ABSENT, /* MT2060 */
1226: },
1227:
1228: [EM2880_BOARD_TERRATEC_HYBRID_XS_FR] = {
1229: .name = "Terratec Hybrid XS Secam",
1230: .has_msp34xx = 1,
1231: .tuner_type = TUNER_XC2028,
1232: .tuner_gpio = default_tuner_gpio,
1233: .decoder = EM28XX_TVP5150,
1234: .has_dvb = 1,
1235: .dvb_gpio = terratec_cinergy_USB_XS_FR_digital,
1236: .input = { {
1237: .type = EM28XX_VMUX_TELEVISION,
1238: .vmux = TVP5150_COMPOSITE0,
1239: .amux = EM28XX_AMUX_VIDEO,
1240: .gpio = terratec_cinergy_USB_XS_FR_analog,
1241: }, {
1242: .type = EM28XX_VMUX_COMPOSITE,
1243: .vmux = TVP5150_COMPOSITE1,
1244: .amux = EM28XX_AMUX_LINE_IN,
1245: .gpio = terratec_cinergy_USB_XS_FR_analog,
1246: }, {
1247: .type = EM28XX_VMUX_SVIDEO,
1248: .vmux = TVP5150_SVIDEO,
1249: .amux = EM28XX_AMUX_LINE_IN,
1250: .gpio = terratec_cinergy_USB_XS_FR_analog,
1251: } },
1252: },
1253: [EM2884_BOARD_TERRATEC_H5] = {
1254: .name = "Terratec Cinergy H5",
1255: .has_dvb = 1,
1256: #if 0
1257: .tuner_type = TUNER_PHILIPS_TDA8290,
1258: .tuner_addr = 0x41,
1259: .dvb_gpio = terratec_h5_digital, /* FIXME: probably wrong */
1260: .tuner_gpio = terratec_h5_gpio,
1261: #else
1262: .tuner_type = TUNER_ABSENT,
1263: #endif
1264: .def_i2c_bus = 1,
1265: .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
1266: EM28XX_I2C_FREQ_400_KHZ,
1267: },
1268: [EM2884_BOARD_TERRATEC_H6] = {
1269: .name = "Terratec Cinergy H6 rev. 2",
1270: .has_dvb = 1,
1271: .ir_codes = RC_MAP_NEC_TERRATEC_CINERGY_XS,
1272: #if 0
1273: .tuner_type = TUNER_PHILIPS_TDA8290,
1274: .tuner_addr = 0x41,
1275: .dvb_gpio = terratec_h5_digital, /* FIXME: probably wrong */
1276: .tuner_gpio = terratec_h5_gpio,
1277: #else
1278: .tuner_type = TUNER_ABSENT,
1279: #endif
1280: .def_i2c_bus = 1,
1281: .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
1282: EM28XX_I2C_FREQ_400_KHZ,
1283: },
1284: [EM2884_BOARD_HAUPPAUGE_WINTV_HVR_930C] = {
1285: .name = "Hauppauge WinTV HVR 930C",
1286: .has_dvb = 1,
1287: #if 0 /* FIXME: Add analog support */
1288: .tuner_type = TUNER_XC5000,
1289: .tuner_addr = 0x41,
1290: .dvb_gpio = hauppauge_930c_digital,
1291: .tuner_gpio = hauppauge_930c_gpio,
1292: #else
1293: .tuner_type = TUNER_ABSENT,
1294: #endif
1295: .ir_codes = RC_MAP_HAUPPAUGE,
1296: .def_i2c_bus = 1,
1297: .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
1298: EM28XX_I2C_FREQ_400_KHZ,
1299: },
1300: [EM2884_BOARD_C3TECH_DIGITAL_DUO] = {
1301: .name = "C3 Tech Digital Duo HDTV/SDTV USB",
1302: .has_dvb = 1,
1303: /* FIXME: Add analog support - need a saa7136 driver */
1304: .tuner_type = TUNER_ABSENT, /* Digital-only TDA18271HD */
1305: .ir_codes = RC_MAP_EMPTY,
1306: .def_i2c_bus = 1,
1307: .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE,
1308: .dvb_gpio = c3tech_digital_duo_digital,
1309: },
1310: [EM2884_BOARD_CINERGY_HTC_STICK] = {
1311: .name = "Terratec Cinergy HTC Stick",
1312: .has_dvb = 1,
1313: .ir_codes = RC_MAP_NEC_TERRATEC_CINERGY_XS,
1314: .tuner_type = TUNER_ABSENT,
1315: .def_i2c_bus = 1,
1316: .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
1317: EM28XX_I2C_FREQ_400_KHZ,
1318: },
1319: [EM2884_BOARD_ELGATO_EYETV_HYBRID_2008] = {
1320: .name = "Elgato EyeTV Hybrid 2008 INT",
1321: .has_dvb = 1,
1322: .ir_codes = RC_MAP_NEC_TERRATEC_CINERGY_XS,
1323: .tuner_type = TUNER_ABSENT,
1324: .def_i2c_bus = 1,
1325: .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
1326: EM28XX_I2C_FREQ_400_KHZ,
1327: },
1328: [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900] = {
1329: .name = "Hauppauge WinTV HVR 900",
1330: .tda9887_conf = TDA9887_PRESENT,
1331: .tuner_type = TUNER_XC2028,
1332: .tuner_gpio = default_tuner_gpio,
1333: .mts_firmware = 1,
1334: .has_dvb = 1,
1335: .dvb_gpio = hauppauge_wintv_hvr_900_digital,
1336: .ir_codes = RC_MAP_HAUPPAUGE,
1337: .decoder = EM28XX_TVP5150,
1338: .input = { {
1339: .type = EM28XX_VMUX_TELEVISION,
1340: .vmux = TVP5150_COMPOSITE0,
1341: .amux = EM28XX_AMUX_VIDEO,
1342: .gpio = hauppauge_wintv_hvr_900_analog,
1343: }, {
1344: .type = EM28XX_VMUX_COMPOSITE,
1345: .vmux = TVP5150_COMPOSITE1,
1346: .amux = EM28XX_AMUX_LINE_IN,
1347: .gpio = hauppauge_wintv_hvr_900_analog,
1348: }, {
1349: .type = EM28XX_VMUX_SVIDEO,
1350: .vmux = TVP5150_SVIDEO,
1351: .amux = EM28XX_AMUX_LINE_IN,
1352: .gpio = hauppauge_wintv_hvr_900_analog,
1353: } },
1354: },
1355: [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2] = {
1356: .name = "Hauppauge WinTV HVR 900 (R2)",
1357: .tda9887_conf = TDA9887_PRESENT,
1358: .tuner_type = TUNER_XC2028,
1359: .tuner_gpio = default_tuner_gpio,
1360: .mts_firmware = 1,
1361: .has_dvb = 1,
1362: .dvb_gpio = hauppauge_wintv_hvr_900R2_digital,
1363: .ir_codes = RC_MAP_HAUPPAUGE,
1364: .decoder = EM28XX_TVP5150,
1365: .input = { {
1366: .type = EM28XX_VMUX_TELEVISION,
1367: .vmux = TVP5150_COMPOSITE0,
1368: .amux = EM28XX_AMUX_VIDEO,
1369: .gpio = hauppauge_wintv_hvr_900_analog,
1370: }, {
1371: .type = EM28XX_VMUX_COMPOSITE,
1372: .vmux = TVP5150_COMPOSITE1,
1373: .amux = EM28XX_AMUX_LINE_IN,
1374: .gpio = hauppauge_wintv_hvr_900_analog,
1375: }, {
1376: .type = EM28XX_VMUX_SVIDEO,
1377: .vmux = TVP5150_SVIDEO,
1378: .amux = EM28XX_AMUX_LINE_IN,
1379: .gpio = hauppauge_wintv_hvr_900_analog,
1380: } },
1381: },
1382: [EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850] = {
1383: .name = "Hauppauge WinTV HVR 850",
1384: .tuner_type = TUNER_XC2028,
1385: .tuner_gpio = default_tuner_gpio,
1386: .mts_firmware = 1,
1387: .has_dvb = 1,
1388: .dvb_gpio = hauppauge_wintv_hvr_900_digital,
1389: .ir_codes = RC_MAP_HAUPPAUGE,
1390: .decoder = EM28XX_TVP5150,
1391: .input = { {
1392: .type = EM28XX_VMUX_TELEVISION,
1393: .vmux = TVP5150_COMPOSITE0,
1394: .amux = EM28XX_AMUX_VIDEO,
1395: .gpio = hauppauge_wintv_hvr_900_analog,
1396: }, {
1397: .type = EM28XX_VMUX_COMPOSITE,
1398: .vmux = TVP5150_COMPOSITE1,
1399: .amux = EM28XX_AMUX_LINE_IN,
1400: .gpio = hauppauge_wintv_hvr_900_analog,
1401: }, {
1402: .type = EM28XX_VMUX_SVIDEO,
1403: .vmux = TVP5150_SVIDEO,
1404: .amux = EM28XX_AMUX_LINE_IN,
1405: .gpio = hauppauge_wintv_hvr_900_analog,
1406: } },
1407: },
1408: [EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950] = {
1409: .name = "Hauppauge WinTV HVR 950",
1410: .tuner_type = TUNER_XC2028,
1411: .tuner_gpio = default_tuner_gpio,
1412: .mts_firmware = 1,
1413: .has_dvb = 1,
1414: .dvb_gpio = hauppauge_wintv_hvr_900_digital,
1415: .ir_codes = RC_MAP_HAUPPAUGE,
1416: .decoder = EM28XX_TVP5150,
1417: .input = { {
1418: .type = EM28XX_VMUX_TELEVISION,
1419: .vmux = TVP5150_COMPOSITE0,
1420: .amux = EM28XX_AMUX_VIDEO,
1421: .gpio = hauppauge_wintv_hvr_900_analog,
1422: }, {
1423: .type = EM28XX_VMUX_COMPOSITE,
1424: .vmux = TVP5150_COMPOSITE1,
1425: .amux = EM28XX_AMUX_LINE_IN,
1426: .gpio = hauppauge_wintv_hvr_900_analog,
1427: }, {
1428: .type = EM28XX_VMUX_SVIDEO,
1429: .vmux = TVP5150_SVIDEO,
1430: .amux = EM28XX_AMUX_LINE_IN,
1431: .gpio = hauppauge_wintv_hvr_900_analog,
1432: } },
1433: },
1434: [EM2880_BOARD_PINNACLE_PCTV_HD_PRO] = {
1435: .name = "Pinnacle PCTV HD Pro Stick",
1436: .tuner_type = TUNER_XC2028,
1437: .tuner_gpio = default_tuner_gpio,
1438: .mts_firmware = 1,
1439: .has_dvb = 1,
1440: .dvb_gpio = hauppauge_wintv_hvr_900_digital,
1441: .ir_codes = RC_MAP_PINNACLE_PCTV_HD,
1442: .decoder = EM28XX_TVP5150,
1443: .input = { {
1444: .type = EM28XX_VMUX_TELEVISION,
1445: .vmux = TVP5150_COMPOSITE0,
1446: .amux = EM28XX_AMUX_VIDEO,
1447: .gpio = hauppauge_wintv_hvr_900_analog,
1448: }, {
1449: .type = EM28XX_VMUX_COMPOSITE,
1450: .vmux = TVP5150_COMPOSITE1,
1451: .amux = EM28XX_AMUX_LINE_IN,
1452: .gpio = hauppauge_wintv_hvr_900_analog,
1453: }, {
1454: .type = EM28XX_VMUX_SVIDEO,
1455: .vmux = TVP5150_SVIDEO,
1456: .amux = EM28XX_AMUX_LINE_IN,
1457: .gpio = hauppauge_wintv_hvr_900_analog,
1458: } },
1459: },
1460: [EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600] = {
1461: .name = "AMD ATI TV Wonder HD 600",
1462: .tuner_type = TUNER_XC2028,
1463: .tuner_gpio = default_tuner_gpio,
1464: .mts_firmware = 1,
1465: .has_dvb = 1,
1466: .dvb_gpio = hauppauge_wintv_hvr_900_digital,
1467: .ir_codes = RC_MAP_ATI_TV_WONDER_HD_600,
1468: .decoder = EM28XX_TVP5150,
1469: .input = { {
1470: .type = EM28XX_VMUX_TELEVISION,
1471: .vmux = TVP5150_COMPOSITE0,
1472: .amux = EM28XX_AMUX_VIDEO,
1473: .gpio = hauppauge_wintv_hvr_900_analog,
1474: }, {
1475: .type = EM28XX_VMUX_COMPOSITE,
1476: .vmux = TVP5150_COMPOSITE1,
1477: .amux = EM28XX_AMUX_LINE_IN,
1478: .gpio = hauppauge_wintv_hvr_900_analog,
1479: }, {
1480: .type = EM28XX_VMUX_SVIDEO,
1481: .vmux = TVP5150_SVIDEO,
1482: .amux = EM28XX_AMUX_LINE_IN,
1483: .gpio = hauppauge_wintv_hvr_900_analog,
1484: } },
1485: },
1486: [EM2880_BOARD_TERRATEC_HYBRID_XS] = {
1487: .name = "Terratec Hybrid XS",
1488: .tuner_type = TUNER_XC2028,
1489: .tuner_gpio = default_tuner_gpio,
1490: .decoder = EM28XX_TVP5150,
1491: .has_dvb = 1,
1492: .dvb_gpio = default_digital,
1493: .ir_codes = RC_MAP_TERRATEC_CINERGY_XS,
1494: .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, /* NEC IR */
1495: .input = { {
1496: .type = EM28XX_VMUX_TELEVISION,
1497: .vmux = TVP5150_COMPOSITE0,
1498: .amux = EM28XX_AMUX_VIDEO,
1499: .gpio = default_analog,
1500: }, {
1501: .type = EM28XX_VMUX_COMPOSITE,
1502: .vmux = TVP5150_COMPOSITE1,
1503: .amux = EM28XX_AMUX_LINE_IN,
1504: .gpio = default_analog,
1505: }, {
1506: .type = EM28XX_VMUX_SVIDEO,
1507: .vmux = TVP5150_SVIDEO,
1508: .amux = EM28XX_AMUX_LINE_IN,
1509: .gpio = default_analog,
1510: } },
1511: },
1512: /*
1513: * maybe there's a reason behind it why Terratec sells the Hybrid XS
1514: * as Prodigy XS with a different PID, let's keep it separated for now
1515: * maybe we'll need it later on
1516: */
1517: [EM2880_BOARD_TERRATEC_PRODIGY_XS] = {
1518: .name = "Terratec Prodigy XS",
1519: .tuner_type = TUNER_XC2028,
1520: .tuner_gpio = default_tuner_gpio,
1521: .decoder = EM28XX_TVP5150,
1522: .input = { {
1523: .type = EM28XX_VMUX_TELEVISION,
1524: .vmux = TVP5150_COMPOSITE0,
1525: .amux = EM28XX_AMUX_VIDEO,
1526: .gpio = hauppauge_wintv_hvr_900_analog,
1527: }, {
1528: .type = EM28XX_VMUX_COMPOSITE,
1529: .vmux = TVP5150_COMPOSITE1,
1530: .amux = EM28XX_AMUX_LINE_IN,
1531: .gpio = hauppauge_wintv_hvr_900_analog,
1532: }, {
1533: .type = EM28XX_VMUX_SVIDEO,
1534: .vmux = TVP5150_SVIDEO,
1535: .amux = EM28XX_AMUX_LINE_IN,
1536: .gpio = hauppauge_wintv_hvr_900_analog,
1537: } },
1538: },
1539: [EM2820_BOARD_MSI_VOX_USB_2] = {
1540: .name = "MSI VOX USB 2.0",
1541: .tuner_type = TUNER_LG_PAL_NEW_TAPC,
1542: .tda9887_conf = TDA9887_PRESENT |
1543: TDA9887_PORT1_ACTIVE |
1544: TDA9887_PORT2_ACTIVE,
1545: .max_range_640_480 = 1,
1546: .decoder = EM28XX_SAA711X,
1547: .input = { {
1548: .type = EM28XX_VMUX_TELEVISION,
1549: .vmux = SAA7115_COMPOSITE4,
1550: .amux = EM28XX_AMUX_VIDEO,
1551: }, {
1552: .type = EM28XX_VMUX_COMPOSITE,
1553: .vmux = SAA7115_COMPOSITE0,
1554: .amux = EM28XX_AMUX_LINE_IN,
1555: }, {
1556: .type = EM28XX_VMUX_SVIDEO,
1557: .vmux = SAA7115_SVIDEO3,
1558: .amux = EM28XX_AMUX_LINE_IN,
1559: } },
1560: },
1561: [EM2800_BOARD_TERRATEC_CINERGY_200] = {
1562: .name = "Terratec Cinergy 200 USB",
1563: .is_em2800 = 1,
1564: .has_ir_i2c = 1,
1565: .tuner_type = TUNER_LG_TALN,
1566: .tda9887_conf = TDA9887_PRESENT,
1567: .decoder = EM28XX_SAA711X,
1568: .input = { {
1569: .type = EM28XX_VMUX_TELEVISION,
1570: .vmux = SAA7115_COMPOSITE2,
1571: .amux = EM28XX_AMUX_VIDEO,
1572: }, {
1573: .type = EM28XX_VMUX_COMPOSITE,
1574: .vmux = SAA7115_COMPOSITE0,
1575: .amux = EM28XX_AMUX_LINE_IN,
1576: }, {
1577: .type = EM28XX_VMUX_SVIDEO,
1578: .vmux = SAA7115_SVIDEO3,
1579: .amux = EM28XX_AMUX_LINE_IN,
1580: } },
1581: },
1582: [EM2800_BOARD_GRABBEEX_USB2800] = {
1583: .name = "eMPIA Technology, Inc. GrabBeeX+ Video Encoder",
1584: .is_em2800 = 1,
1585: .decoder = EM28XX_SAA711X,
1586: .tuner_type = TUNER_ABSENT, /* capture only board */
1587: .input = { {
1588: .type = EM28XX_VMUX_COMPOSITE,
1589: .vmux = SAA7115_COMPOSITE0,
1590: .amux = EM28XX_AMUX_LINE_IN,
1591: }, {
1592: .type = EM28XX_VMUX_SVIDEO,
1593: .vmux = SAA7115_SVIDEO3,
1594: .amux = EM28XX_AMUX_LINE_IN,
1595: } },
1596: },
1597: [EM2800_BOARD_VC211A] = {
1598: .name = "Actionmaster/LinXcel/Digitus VC211A",
1599: .is_em2800 = 1,
1600: .tuner_type = TUNER_ABSENT, /* Capture-only board */
1601: .decoder = EM28XX_SAA711X,
1602: .input = { {
1603: .type = EM28XX_VMUX_COMPOSITE,
1604: .vmux = SAA7115_COMPOSITE0,
1605: .amux = EM28XX_AMUX_LINE_IN,
1606: .gpio = vc211a_enable,
1607: }, {
1608: .type = EM28XX_VMUX_SVIDEO,
1609: .vmux = SAA7115_SVIDEO3,
1610: .amux = EM28XX_AMUX_LINE_IN,
1611: .gpio = vc211a_enable,
1612: } },
1613: },
1614: [EM2800_BOARD_LEADTEK_WINFAST_USBII] = {
1615: .name = "Leadtek Winfast USB II",
1616: .is_em2800 = 1,
1617: .tuner_type = TUNER_LG_PAL_NEW_TAPC,
1618: .tda9887_conf = TDA9887_PRESENT,
1619: .decoder = EM28XX_SAA711X,
1620: .input = { {
1621: .type = EM28XX_VMUX_TELEVISION,
1622: .vmux = SAA7115_COMPOSITE2,
1623: .amux = EM28XX_AMUX_VIDEO,
1624: }, {
1625: .type = EM28XX_VMUX_COMPOSITE,
1626: .vmux = SAA7115_COMPOSITE0,
1627: .amux = EM28XX_AMUX_LINE_IN,
1628: }, {
1629: .type = EM28XX_VMUX_SVIDEO,
1630: .vmux = SAA7115_SVIDEO3,
1631: .amux = EM28XX_AMUX_LINE_IN,
1632: } },
1633: },
1634: [EM2800_BOARD_KWORLD_USB2800] = {
1635: .name = "Kworld USB2800",
1636: .is_em2800 = 1,
1637: .tuner_type = TUNER_PHILIPS_FCV1236D,
1638: .tda9887_conf = TDA9887_PRESENT,
1639: .decoder = EM28XX_SAA711X,
1640: .input = { {
1641: .type = EM28XX_VMUX_TELEVISION,
1642: .vmux = SAA7115_COMPOSITE2,
1643: .amux = EM28XX_AMUX_VIDEO,
1644: }, {
1645: .type = EM28XX_VMUX_COMPOSITE,
1646: .vmux = SAA7115_COMPOSITE0,
1647: .amux = EM28XX_AMUX_LINE_IN,
1648: }, {
1649: .type = EM28XX_VMUX_SVIDEO,
1650: .vmux = SAA7115_SVIDEO3,
1651: .amux = EM28XX_AMUX_LINE_IN,
1652: } },
1653: },
1654: [EM2820_BOARD_PINNACLE_DVC_90] = {
1655: .name = "Pinnacle Dazzle DVC 90/100/101/107 / Kaiser Baas Video to DVD maker / Kworld DVD Maker 2 / Plextor ConvertX PX-AV100U",
1656: .tuner_type = TUNER_ABSENT, /* capture only board */
1657: .decoder = EM28XX_SAA711X,
1658: .input = { {
1659: .type = EM28XX_VMUX_COMPOSITE,
1660: .vmux = SAA7115_COMPOSITE0,
1661: .amux = EM28XX_AMUX_LINE_IN,
1662: }, {
1663: .type = EM28XX_VMUX_SVIDEO,
1664: .vmux = SAA7115_SVIDEO3,
1665: .amux = EM28XX_AMUX_LINE_IN,
1666: } },
1667: },
1668: [EM2800_BOARD_VGEAR_POCKETTV] = {
1669: .name = "V-Gear PocketTV",
1670: .is_em2800 = 1,
1671: .tuner_type = TUNER_LG_PAL_NEW_TAPC,
1672: .tda9887_conf = TDA9887_PRESENT,
1673: .decoder = EM28XX_SAA711X,
1674: .input = { {
1675: .type = EM28XX_VMUX_TELEVISION,
1676: .vmux = SAA7115_COMPOSITE2,
1677: .amux = EM28XX_AMUX_VIDEO,
1678: }, {
1679: .type = EM28XX_VMUX_COMPOSITE,
1680: .vmux = SAA7115_COMPOSITE0,
1681: .amux = EM28XX_AMUX_LINE_IN,
1682: }, {
1683: .type = EM28XX_VMUX_SVIDEO,
1684: .vmux = SAA7115_SVIDEO3,
1685: .amux = EM28XX_AMUX_LINE_IN,
1686: } },
1687: },
1688: [EM2820_BOARD_PROLINK_PLAYTV_BOX4_USB2] = {
1689: .name = "Pixelview PlayTV Box 4 USB 2.0",
1690: .tda9887_conf = TDA9887_PRESENT,
1691: .tuner_type = TUNER_YMEC_TVF_5533MF,
1692: .decoder = EM28XX_SAA711X,
1693: .input = { {
1694: .type = EM28XX_VMUX_TELEVISION,
1695: .vmux = SAA7115_COMPOSITE2,
1696: .amux = EM28XX_AMUX_VIDEO,
1697: .aout = EM28XX_AOUT_MONO | /* I2S */
1698: EM28XX_AOUT_MASTER, /* Line out pin */
1699: }, {
1700: .type = EM28XX_VMUX_COMPOSITE,
1701: .vmux = SAA7115_COMPOSITE0,
1702: .amux = EM28XX_AMUX_LINE_IN,
1703: }, {
1704: .type = EM28XX_VMUX_SVIDEO,
1705: .vmux = SAA7115_SVIDEO3,
1706: .amux = EM28XX_AMUX_LINE_IN,
1707: } },
1708: },
1709: [EM2820_BOARD_PROLINK_PLAYTV_USB2] = {
1710: .name = "SIIG AVTuner-PVR / Pixelview Prolink PlayTV USB 2.0",
1711: .buttons = std_snapshot_button,
1712: .tda9887_conf = TDA9887_PRESENT,
1713: .tuner_type = TUNER_YMEC_TVF_5533MF,
1714: .tuner_addr = 0x60,
1715: .decoder = EM28XX_SAA711X,
1716: .input = { {
1717: .type = EM28XX_VMUX_TELEVISION,
1718: .vmux = SAA7115_COMPOSITE2,
1719: .amux = EM28XX_AMUX_VIDEO,
1720: .aout = EM28XX_AOUT_MONO | /* I2S */
1721: EM28XX_AOUT_MASTER, /* Line out pin */
1722: }, {
1723: .type = EM28XX_VMUX_COMPOSITE,
1724: .vmux = SAA7115_COMPOSITE0,
1725: .amux = EM28XX_AMUX_LINE_IN,
1726: }, {
1727: .type = EM28XX_VMUX_SVIDEO,
1728: .vmux = SAA7115_SVIDEO3,
1729: .amux = EM28XX_AMUX_LINE_IN,
1730: } },
1731: },
1732: [EM2860_BOARD_SAA711X_REFERENCE_DESIGN] = {
1733: .name = "EM2860/SAA711X Reference Design",
1734: .buttons = std_snapshot_button,
1735: .tuner_type = TUNER_ABSENT,
1736: .decoder = EM28XX_SAA711X,
1737: .input = { {
1738: .type = EM28XX_VMUX_SVIDEO,
1739: .vmux = SAA7115_SVIDEO3,
1740: }, {
1741: .type = EM28XX_VMUX_COMPOSITE,
1742: .vmux = SAA7115_COMPOSITE0,
1743: } },
1744: },
1745:
1746: [EM2874_BOARD_LEADERSHIP_ISDBT] = {
1747: .def_i2c_bus = 1,
1748: .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
1749: EM28XX_I2C_FREQ_100_KHZ,
1750: .xclk = EM28XX_XCLK_FREQUENCY_10MHZ,
1751: .name = "EM2874 Leadership ISDBT",
1752: .tuner_type = TUNER_ABSENT,
1753: .tuner_gpio = leadership_reset,
1754: .dvb_gpio = leadership_digital,
1755: .has_dvb = 1,
1756: },
1757:
1758: [EM2880_BOARD_MSI_DIGIVOX_AD] = {
1759: .name = "MSI DigiVox A/D",
1760: .valid = EM28XX_BOARD_NOT_VALIDATED,
1761: .tuner_type = TUNER_XC2028,
1762: .tuner_gpio = default_tuner_gpio,
1763: .decoder = EM28XX_TVP5150,
1764: .input = { {
1765: .type = EM28XX_VMUX_TELEVISION,
1766: .vmux = TVP5150_COMPOSITE0,
1767: .amux = EM28XX_AMUX_VIDEO,
1768: .gpio = em2880_msi_digivox_ad_analog,
1769: }, {
1770: .type = EM28XX_VMUX_COMPOSITE,
1771: .vmux = TVP5150_COMPOSITE1,
1772: .amux = EM28XX_AMUX_LINE_IN,
1773: .gpio = em2880_msi_digivox_ad_analog,
1774: }, {
1775: .type = EM28XX_VMUX_SVIDEO,
1776: .vmux = TVP5150_SVIDEO,
1777: .amux = EM28XX_AMUX_LINE_IN,
1778: .gpio = em2880_msi_digivox_ad_analog,
1779: } },
1780: },
1781: [EM2880_BOARD_MSI_DIGIVOX_AD_II] = {
1782: .name = "MSI DigiVox A/D II",
1783: .valid = EM28XX_BOARD_NOT_VALIDATED,
1784: .tuner_type = TUNER_XC2028,
1785: .tuner_gpio = default_tuner_gpio,
1786: .decoder = EM28XX_TVP5150,
1787: .input = { {
1788: .type = EM28XX_VMUX_TELEVISION,
1789: .vmux = TVP5150_COMPOSITE0,
1790: .amux = EM28XX_AMUX_VIDEO,
1791: .gpio = em2880_msi_digivox_ad_analog,
1792: }, {
1793: .type = EM28XX_VMUX_COMPOSITE,
1794: .vmux = TVP5150_COMPOSITE1,
1795: .amux = EM28XX_AMUX_LINE_IN,
1796: .gpio = em2880_msi_digivox_ad_analog,
1797: }, {
1798: .type = EM28XX_VMUX_SVIDEO,
1799: .vmux = TVP5150_SVIDEO,
1800: .amux = EM28XX_AMUX_LINE_IN,
1801: .gpio = em2880_msi_digivox_ad_analog,
1802: } },
1803: },
1804: [EM2880_BOARD_KWORLD_DVB_305U] = {
1805: .name = "KWorld DVB-T 305U",
1806: .tuner_type = TUNER_XC2028,
1807: .tuner_gpio = default_tuner_gpio,
1808: .decoder = EM28XX_TVP5150,
1809: .input = { {
1810: .type = EM28XX_VMUX_TELEVISION,
1811: .vmux = TVP5150_COMPOSITE0,
1812: .amux = EM28XX_AMUX_VIDEO,
1813: }, {
1814: .type = EM28XX_VMUX_COMPOSITE,
1815: .vmux = TVP5150_COMPOSITE1,
1816: .amux = EM28XX_AMUX_LINE_IN,
1817: }, {
1818: .type = EM28XX_VMUX_SVIDEO,
1819: .vmux = TVP5150_SVIDEO,
1820: .amux = EM28XX_AMUX_LINE_IN,
1821: } },
1822: },
1823: [EM2880_BOARD_KWORLD_DVB_310U] = {
1824: .name = "KWorld DVB-T 310U",
1825: .tuner_type = TUNER_XC2028,
1826: .tuner_gpio = default_tuner_gpio,
1827: .has_dvb = 1,
1828: .dvb_gpio = default_digital,
1829: .mts_firmware = 1,
1830: .decoder = EM28XX_TVP5150,
1831: .input = { {
1832: .type = EM28XX_VMUX_TELEVISION,
1833: .vmux = TVP5150_COMPOSITE0,
1834: .amux = EM28XX_AMUX_VIDEO,
1835: .gpio = default_analog,
1836: }, {
1837: .type = EM28XX_VMUX_COMPOSITE,
1838: .vmux = TVP5150_COMPOSITE1,
1839: .amux = EM28XX_AMUX_LINE_IN,
1840: .gpio = default_analog,
1841: }, { /* S-video has not been tested yet */
1842: .type = EM28XX_VMUX_SVIDEO,
1843: .vmux = TVP5150_SVIDEO,
1844: .amux = EM28XX_AMUX_LINE_IN,
1845: .gpio = default_analog,
1846: } },
1847: },
1848: [EM2882_BOARD_KWORLD_ATSC_315U] = {
1849: .name = "KWorld ATSC 315U HDTV TV Box",
1850: .valid = EM28XX_BOARD_NOT_VALIDATED,
1851: .tuner_type = TUNER_THOMSON_DTT761X,
1852: .tuner_gpio = em2882_kworld_315u_tuner_gpio,
1853: .tda9887_conf = TDA9887_PRESENT,
1854: .decoder = EM28XX_SAA711X,
1855: .has_dvb = 1,
1856: .dvb_gpio = em2882_kworld_315u_digital,
1857: .ir_codes = RC_MAP_KWORLD_315U,
1858: .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
1859: .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE,
1860: #if 0
1861: /* FIXME: Analog mode - still not ready */
1862: .input = { {
1863: .type = EM28XX_VMUX_TELEVISION,
1864: .vmux = SAA7115_COMPOSITE2,
1865: .amux = EM28XX_AMUX_VIDEO,
1866: .gpio = em2882_kworld_315u_analog,
1867: .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
1868: }, {
1869: .type = EM28XX_VMUX_COMPOSITE,
1870: .vmux = SAA7115_COMPOSITE0,
1871: .amux = EM28XX_AMUX_LINE_IN,
1872: .gpio = em2882_kworld_315u_analog1,
1873: .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
1874: }, {
1875: .type = EM28XX_VMUX_SVIDEO,
1876: .vmux = SAA7115_SVIDEO3,
1877: .amux = EM28XX_AMUX_LINE_IN,
1878: .gpio = em2882_kworld_315u_analog1,
1879: .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
1880: } },
1881: #endif
1882: },
1883: [EM2880_BOARD_EMPIRE_DUAL_TV] = {
1884: .name = "Empire dual TV",
1885: .tuner_type = TUNER_XC2028,
1886: .tuner_gpio = default_tuner_gpio,
1887: .has_dvb = 1,
1888: .dvb_gpio = default_digital,
1889: .mts_firmware = 1,
1890: .decoder = EM28XX_TVP5150,
1891: .input = { {
1892: .type = EM28XX_VMUX_TELEVISION,
1893: .vmux = TVP5150_COMPOSITE0,
1894: .amux = EM28XX_AMUX_VIDEO,
1895: .gpio = default_analog,
1896: }, {
1897: .type = EM28XX_VMUX_COMPOSITE,
1898: .vmux = TVP5150_COMPOSITE1,
1899: .amux = EM28XX_AMUX_LINE_IN,
1900: .gpio = default_analog,
1901: }, {
1902: .type = EM28XX_VMUX_SVIDEO,
1903: .vmux = TVP5150_SVIDEO,
1904: .amux = EM28XX_AMUX_LINE_IN,
1905: .gpio = default_analog,
1906: } },
1907: },
1908: [EM2881_BOARD_DNT_DA2_HYBRID] = {
1909: .name = "DNT DA2 Hybrid",
1910: .valid = EM28XX_BOARD_NOT_VALIDATED,
1911: .tuner_type = TUNER_XC2028,
1912: .tuner_gpio = default_tuner_gpio,
1913: .decoder = EM28XX_TVP5150,
1914: .input = { {
1915: .type = EM28XX_VMUX_TELEVISION,
1916: .vmux = TVP5150_COMPOSITE0,
1917: .amux = EM28XX_AMUX_VIDEO,
1918: .gpio = default_analog,
1919: }, {
1920: .type = EM28XX_VMUX_COMPOSITE,
1921: .vmux = TVP5150_COMPOSITE1,
1922: .amux = EM28XX_AMUX_LINE_IN,
1923: .gpio = default_analog,
1924: }, {
1925: .type = EM28XX_VMUX_SVIDEO,
1926: .vmux = TVP5150_SVIDEO,
1927: .amux = EM28XX_AMUX_LINE_IN,
1928: .gpio = default_analog,
1929: } },
1930: },
1931: [EM2881_BOARD_PINNACLE_HYBRID_PRO] = {
1932: .name = "Pinnacle Hybrid Pro",
1933: .tuner_type = TUNER_XC2028,
1934: .tuner_gpio = default_tuner_gpio,
1935: .decoder = EM28XX_TVP5150,
1936: .has_dvb = 1,
1937: .dvb_gpio = pinnacle_hybrid_pro_digital,
1938: .input = { {
1939: .type = EM28XX_VMUX_TELEVISION,
1940: .vmux = TVP5150_COMPOSITE0,
1941: .amux = EM28XX_AMUX_VIDEO,
1942: .gpio = pinnacle_hybrid_pro_analog,
1943: }, {
1944: .type = EM28XX_VMUX_COMPOSITE,
1945: .vmux = TVP5150_COMPOSITE1,
1946: .amux = EM28XX_AMUX_LINE_IN,
1947: .gpio = pinnacle_hybrid_pro_analog,
1948: }, {
1949: .type = EM28XX_VMUX_SVIDEO,
1950: .vmux = TVP5150_SVIDEO,
1951: .amux = EM28XX_AMUX_LINE_IN,
1952: .gpio = pinnacle_hybrid_pro_analog,
1953: } },
1954: },
1955: [EM2882_BOARD_PINNACLE_HYBRID_PRO_330E] = {
1956: .name = "Pinnacle Hybrid Pro (330e)",
1957: .tuner_type = TUNER_XC2028,
1958: .tuner_gpio = default_tuner_gpio,
1959: .mts_firmware = 1,
1960: .has_dvb = 1,
1961: .dvb_gpio = hauppauge_wintv_hvr_900R2_digital,
1962: .ir_codes = RC_MAP_PINNACLE_PCTV_HD,
1963: .decoder = EM28XX_TVP5150,
1964: .input = { {
1965: .type = EM28XX_VMUX_TELEVISION,
1966: .vmux = TVP5150_COMPOSITE0,
1967: .amux = EM28XX_AMUX_VIDEO,
1968: .gpio = hauppauge_wintv_hvr_900_analog,
1969: }, {
1970: .type = EM28XX_VMUX_COMPOSITE,
1971: .vmux = TVP5150_COMPOSITE1,
1972: .amux = EM28XX_AMUX_LINE_IN,
1973: .gpio = hauppauge_wintv_hvr_900_analog,
1974: }, {
1975: .type = EM28XX_VMUX_SVIDEO,
1976: .vmux = TVP5150_SVIDEO,
1977: .amux = EM28XX_AMUX_LINE_IN,
1978: .gpio = hauppauge_wintv_hvr_900_analog,
1979: } },
1980: },
1981: [EM2882_BOARD_KWORLD_VS_DVBT] = {
1982: .name = "Kworld VS-DVB-T 323UR",
1983: .tuner_type = TUNER_XC2028,
1984: .tuner_gpio = default_tuner_gpio,
1985: .decoder = EM28XX_TVP5150,
1986: .mts_firmware = 1,
1987: .has_dvb = 1,
1988: .dvb_gpio = kworld_330u_digital,
1989: .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, /* NEC IR */
1990: .ir_codes = RC_MAP_KWORLD_315U,
1991: .input = { {
1992: .type = EM28XX_VMUX_TELEVISION,
1993: .vmux = TVP5150_COMPOSITE0,
1994: .amux = EM28XX_AMUX_VIDEO,
1995: }, {
1996: .type = EM28XX_VMUX_COMPOSITE,
1997: .vmux = TVP5150_COMPOSITE1,
1998: .amux = EM28XX_AMUX_LINE_IN,
1999: }, {
2000: .type = EM28XX_VMUX_SVIDEO,
2001: .vmux = TVP5150_SVIDEO,
2002: .amux = EM28XX_AMUX_LINE_IN,
2003: } },
2004: },
2005: [EM2882_BOARD_TERRATEC_HYBRID_XS] = {
2006: .name = "Terratec Cinergy Hybrid T USB XS (em2882)",
2007: .tuner_type = TUNER_XC2028,
2008: .tuner_gpio = default_tuner_gpio,
2009: .mts_firmware = 1,
2010: .decoder = EM28XX_TVP5150,
2011: .has_dvb = 1,
2012: .dvb_gpio = hauppauge_wintv_hvr_900_digital,
2013: .ir_codes = RC_MAP_TERRATEC_CINERGY_XS,
2014: .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
2015: .input = { {
2016: .type = EM28XX_VMUX_TELEVISION,
2017: .vmux = TVP5150_COMPOSITE0,
2018: .amux = EM28XX_AMUX_VIDEO,
2019: .gpio = hauppauge_wintv_hvr_900_analog,
2020: }, {
2021: .type = EM28XX_VMUX_COMPOSITE,
2022: .vmux = TVP5150_COMPOSITE1,
2023: .amux = EM28XX_AMUX_LINE_IN,
2024: .gpio = hauppauge_wintv_hvr_900_analog,
2025: }, {
2026: .type = EM28XX_VMUX_SVIDEO,
2027: .vmux = TVP5150_SVIDEO,
2028: .amux = EM28XX_AMUX_LINE_IN,
2029: .gpio = hauppauge_wintv_hvr_900_analog,
2030: } },
2031: },
2032: [EM2882_BOARD_DIKOM_DK300] = {
2033: .name = "Dikom DK300",
2034: .tuner_type = TUNER_XC2028,
2035: .tuner_gpio = default_tuner_gpio,
2036: .decoder = EM28XX_TVP5150,
2037: .mts_firmware = 1,
2038: .has_dvb = 1,
2039: .dvb_gpio = dikom_dk300_digital,
2040: .input = { {
2041: .type = EM28XX_VMUX_TELEVISION,
2042: .vmux = TVP5150_COMPOSITE0,
2043: .amux = EM28XX_AMUX_VIDEO,
2044: .gpio = default_analog,
2045: } },
2046: },
2047: [EM2883_BOARD_KWORLD_HYBRID_330U] = {
2048: .name = "Kworld PlusTV HD Hybrid 330",
2049: .tuner_type = TUNER_XC2028,
2050: .tuner_gpio = default_tuner_gpio,
2051: .decoder = EM28XX_TVP5150,
2052: .mts_firmware = 1,
2053: .has_dvb = 1,
2054: .dvb_gpio = kworld_330u_digital,
2055: .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
2056: .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
2057: EM28XX_I2C_EEPROM_ON_BOARD |
2058: EM28XX_I2C_EEPROM_KEY_VALID,
2059: .input = { {
2060: .type = EM28XX_VMUX_TELEVISION,
2061: .vmux = TVP5150_COMPOSITE0,
2062: .amux = EM28XX_AMUX_VIDEO,
2063: .gpio = kworld_330u_analog,
2064: .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
2065: }, {
2066: .type = EM28XX_VMUX_COMPOSITE,
2067: .vmux = TVP5150_COMPOSITE1,
2068: .amux = EM28XX_AMUX_LINE_IN,
2069: .gpio = kworld_330u_analog,
2070: .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,
2071: }, {
2072: .type = EM28XX_VMUX_SVIDEO,
2073: .vmux = TVP5150_SVIDEO,
2074: .amux = EM28XX_AMUX_LINE_IN,
2075: .gpio = kworld_330u_analog,
2076: } },
2077: },
2078: [EM2820_BOARD_COMPRO_VIDEOMATE_FORYOU] = {
2079: .name = "Compro VideoMate ForYou/Stereo",
2080: .tuner_type = TUNER_LG_PAL_NEW_TAPC,
2081: .tvaudio_addr = 0xb0,
2082: .tda9887_conf = TDA9887_PRESENT,
2083: .decoder = EM28XX_TVP5150,
2084: .adecoder = EM28XX_TVAUDIO,
2085: .mute_gpio = compro_mute_gpio,
2086: .input = { {
2087: .type = EM28XX_VMUX_TELEVISION,
2088: .vmux = TVP5150_COMPOSITE0,
2089: .amux = EM28XX_AMUX_VIDEO,
2090: .gpio = compro_unmute_tv_gpio,
2091: }, {
2092: .type = EM28XX_VMUX_SVIDEO,
2093: .vmux = TVP5150_SVIDEO,
2094: .amux = EM28XX_AMUX_LINE_IN,
2095: .gpio = compro_unmute_svid_gpio,
2096: } },
2097: },
2098: [EM2860_BOARD_KAIOMY_TVNPC_U2] = {
2099: .name = "Kaiomy TVnPC U2",
2100: .vchannels = 3,
2101: .tuner_type = TUNER_XC2028,
2102: .tuner_addr = 0x61,
2103: .mts_firmware = 1,
2104: .decoder = EM28XX_TVP5150,
2105: .tuner_gpio = default_tuner_gpio,
2106: .ir_codes = RC_MAP_KAIOMY,
2107: .input = { {
2108: .type = EM28XX_VMUX_TELEVISION,
2109: .vmux = TVP5150_COMPOSITE0,
2110: .amux = EM28XX_AMUX_VIDEO,
2111:
2112: }, {
2113: .type = EM28XX_VMUX_COMPOSITE,
2114: .vmux = TVP5150_COMPOSITE1,
2115: .amux = EM28XX_AMUX_LINE_IN,
2116: }, {
2117: .type = EM28XX_VMUX_SVIDEO,
2118: .vmux = TVP5150_SVIDEO,
2119: .amux = EM28XX_AMUX_LINE_IN,
2120: } },
2121: .radio = {
2122: .type = EM28XX_RADIO,
2123: .amux = EM28XX_AMUX_LINE_IN,
2124: }
2125: },
2126: [EM2860_BOARD_EASYCAP] = {
2127: .name = "Easy Cap Capture DC-60",
2128: .vchannels = 2,
2129: .tuner_type = TUNER_ABSENT,
2130: .decoder = EM28XX_SAA711X,
2131: .input = { {
2132: .type = EM28XX_VMUX_COMPOSITE,
2133: .vmux = SAA7115_COMPOSITE0,
2134: .amux = EM28XX_AMUX_LINE_IN,
2135: }, {
2136: .type = EM28XX_VMUX_SVIDEO,
2137: .vmux = SAA7115_SVIDEO3,
2138: .amux = EM28XX_AMUX_LINE_IN,
2139: } },
2140: },
2141: [EM2820_BOARD_IODATA_GVMVP_SZ] = {
2142: .name = "IO-DATA GV-MVP/SZ",
2143: .tuner_type = TUNER_PHILIPS_FM1236_MK3,
2144: .tuner_gpio = default_tuner_gpio,
2145: .tda9887_conf = TDA9887_PRESENT,
2146: .decoder = EM28XX_TVP5150,
2147: .input = { {
2148: .type = EM28XX_VMUX_TELEVISION,
2149: .vmux = TVP5150_COMPOSITE0,
2150: .amux = EM28XX_AMUX_VIDEO,
2151: }, { /* Composite has not been tested yet */
2152: .type = EM28XX_VMUX_COMPOSITE,
2153: .vmux = TVP5150_COMPOSITE1,
2154: .amux = EM28XX_AMUX_VIDEO,
2155: }, { /* S-video has not been tested yet */
2156: .type = EM28XX_VMUX_SVIDEO,
2157: .vmux = TVP5150_SVIDEO,
2158: .amux = EM28XX_AMUX_VIDEO,
2159: } },
2160: },
2161: [EM2860_BOARD_TERRATEC_GRABBY] = {
2162: .name = "Terratec Grabby",
2163: .vchannels = 2,
2164: .tuner_type = TUNER_ABSENT,
2165: .decoder = EM28XX_SAA711X,
2166: .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
2167: .input = { {
2168: .type = EM28XX_VMUX_COMPOSITE,
2169: .vmux = SAA7115_COMPOSITE0,
2170: .amux = EM28XX_AMUX_LINE_IN,
2171: }, {
2172: .type = EM28XX_VMUX_SVIDEO,
2173: .vmux = SAA7115_SVIDEO3,
2174: .amux = EM28XX_AMUX_LINE_IN,
2175: } },
2176: .buttons = std_snapshot_button,
2177: .leds = terratec_grabby_leds,
2178: },
2179: [EM2860_BOARD_TERRATEC_AV350] = {
2180: .name = "Terratec AV350",
2181: .vchannels = 2,
2182: .tuner_type = TUNER_ABSENT,
2183: .decoder = EM28XX_TVP5150,
2184: .xclk = EM28XX_XCLK_FREQUENCY_12MHZ,
2185: .mute_gpio = terratec_av350_mute_gpio,
2186: .input = { {
2187: .type = EM28XX_VMUX_COMPOSITE,
2188: .vmux = TVP5150_COMPOSITE1,
2189: .amux = EM28XX_AMUX_LINE_IN,
2190: .gpio = terratec_av350_unmute_gpio,
2191:
2192: }, {
2193: .type = EM28XX_VMUX_SVIDEO,
2194: .vmux = TVP5150_SVIDEO,
2195: .amux = EM28XX_AMUX_LINE_IN,
2196: .gpio = terratec_av350_unmute_gpio,
2197: } },
2198: },
2199:
2200: [EM2860_BOARD_ELGATO_VIDEO_CAPTURE] = {
2201: .name = "Elgato Video Capture",
2202: .decoder = EM28XX_SAA711X,
2203: .tuner_type = TUNER_ABSENT, /* Capture only device */
2204: .input = { {
2205: .type = EM28XX_VMUX_COMPOSITE,
2206: .vmux = SAA7115_COMPOSITE0,
2207: .amux = EM28XX_AMUX_LINE_IN,
2208: }, {
2209: .type = EM28XX_VMUX_SVIDEO,
2210: .vmux = SAA7115_SVIDEO3,
2211: .amux = EM28XX_AMUX_LINE_IN,
2212: } },
2213: },
2214:
2215: [EM2882_BOARD_EVGA_INDTUBE] = {
2216: .name = "Evga inDtube",
2217: .tuner_type = TUNER_XC2028,
2218: .tuner_gpio = default_tuner_gpio,
2219: .decoder = EM28XX_TVP5150,
2220: .xclk = EM28XX_XCLK_FREQUENCY_12MHZ, /* NEC IR */
2221: .mts_firmware = 1,
2222: .has_dvb = 1,
2223: .dvb_gpio = evga_indtube_digital,
2224: .ir_codes = RC_MAP_EVGA_INDTUBE,
2225: .input = { {
2226: .type = EM28XX_VMUX_TELEVISION,
2227: .vmux = TVP5150_COMPOSITE0,
2228: .amux = EM28XX_AMUX_VIDEO,
2229: .gpio = evga_indtube_analog,
2230: }, {
2231: .type = EM28XX_VMUX_COMPOSITE,
2232: .vmux = TVP5150_COMPOSITE1,
2233: .amux = EM28XX_AMUX_LINE_IN,
2234: .gpio = evga_indtube_analog,
2235: }, {
2236: .type = EM28XX_VMUX_SVIDEO,
2237: .vmux = TVP5150_SVIDEO,
2238: .amux = EM28XX_AMUX_LINE_IN,
2239: .gpio = evga_indtube_analog,
2240: } },
2241: },
2242: /*
2243: * eb1a:2868 Empia EM2870 + Philips CU1216L NIM
2244: * (Philips TDA10023 + Infineon TUA6034)
2245: */
2246: [EM2870_BOARD_REDDO_DVB_C_USB_BOX] = {
2247: .name = "Reddo DVB-C USB TV Box",
2248: .tuner_type = TUNER_ABSENT,
2249: .tuner_gpio = reddo_dvb_c_usb_box,
2250: .has_dvb = 1,
2251: },
2252: /*
2253: * 1b80:a340 - Empia EM2870, NXP TDA18271HD and LG DT3304, sold
2254: * initially as the KWorld PlusTV 340U, then as the UB435-Q.
2255: * Early variants have a TDA18271HD/C1, later ones a TDA18271HD/C2
2256: */
2257: [EM2870_BOARD_KWORLD_A340] = {
2258: .name = "KWorld PlusTV 340U or UB435-Q (ATSC)",
2259: .tuner_type = TUNER_ABSENT, /* Digital-only TDA18271HD */
2260: .has_dvb = 1,
2261: .dvb_gpio = kworld_a340_digital,
2262: .tuner_gpio = default_tuner_gpio,
2263: },
2264: /*
2265: * 2013:024f PCTV nanoStick T2 290e.
2266: * Empia EM28174, Sony CXD2820R and NXP TDA18271HD/C2
2267: */
2268: [EM28174_BOARD_PCTV_290E] = {
2269: .name = "PCTV nanoStick T2 290e",
2270: .def_i2c_bus = 1,
2271: .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
2272: EM28XX_I2C_FREQ_100_KHZ,
2273: .tuner_type = TUNER_ABSENT,
2274: .tuner_gpio = pctv_290e,
2275: .has_dvb = 1,
2276: .ir_codes = RC_MAP_PINNACLE_PCTV_HD,
2277: },
2278: /*
2279: * 2013:024f PCTV DVB-S2 Stick 460e
2280: * Empia EM28174, NXP TDA10071, Conexant CX24118A and Allegro A8293
2281: */
2282: [EM28174_BOARD_PCTV_460E] = {
2283: .def_i2c_bus = 1,
2284: .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
2285: EM28XX_I2C_FREQ_400_KHZ,
2286: .name = "PCTV DVB-S2 Stick (460e)",
2287: .tuner_type = TUNER_ABSENT,
2288: .tuner_gpio = pctv_460e,
2289: .has_dvb = 1,
2290: .ir_codes = RC_MAP_PINNACLE_PCTV_HD,
2291: },
2292: /*
2293: * eb1a:5006 Honestech VIDBOX NW03
2294: * Empia EM2860, Philips SAA7113, Empia EMP202, No Tuner
2295: */
2296: [EM2860_BOARD_HT_VIDBOX_NW03] = {
2297: .name = "Honestech Vidbox NW03",
2298: .tuner_type = TUNER_ABSENT,
2299: .decoder = EM28XX_SAA711X,
2300: .input = { {
2301: .type = EM28XX_VMUX_COMPOSITE,
2302: .vmux = SAA7115_COMPOSITE0,
2303: .amux = EM28XX_AMUX_LINE_IN,
2304: }, {
2305: .type = EM28XX_VMUX_SVIDEO,
2306: .vmux = SAA7115_SVIDEO3, /* S-VIDEO needs check */
2307: .amux = EM28XX_AMUX_LINE_IN,
2308: } },
2309: },
2310: /*
2311: * 1b80:e425 MaxMedia UB425-TC
2312: * Empia EM2874B + Micronas DRX 3913KA2 + NXP TDA18271HDC2
2313: */
2314: [EM2874_BOARD_MAXMEDIA_UB425_TC] = {
2315: .name = "MaxMedia UB425-TC",
2316: .tuner_type = TUNER_ABSENT,
2317: .tuner_gpio = maxmedia_ub425_tc,
2318: .has_dvb = 1,
2319: .ir_codes = RC_MAP_REDDO,
2320: .def_i2c_bus = 1,
2321: .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
2322: EM28XX_I2C_FREQ_400_KHZ,
2323: },
2324: /*
2325: * 2304:0242 PCTV QuatroStick (510e)
2326: * Empia EM2884 + Micronas DRX 3926K + NXP TDA18271HDC2
2327: */
2328: [EM2884_BOARD_PCTV_510E] = {
2329: .name = "PCTV QuatroStick (510e)",
2330: .tuner_type = TUNER_ABSENT,
2331: .tuner_gpio = pctv_510e,
2332: .has_dvb = 1,
2333: .ir_codes = RC_MAP_PINNACLE_PCTV_HD,
2334: .def_i2c_bus = 1,
2335: .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
2336: EM28XX_I2C_FREQ_400_KHZ,
2337: },
2338: /*
2339: * 2013:0251 PCTV QuatroStick nano (520e)
2340: * Empia EM2884 + Micronas DRX 3926K + NXP TDA18271HDC2
2341: */
2342: [EM2884_BOARD_PCTV_520E] = {
2343: .name = "PCTV QuatroStick nano (520e)",
2344: .tuner_type = TUNER_ABSENT,
2345: .tuner_gpio = pctv_520e,
2346: .has_dvb = 1,
2347: .ir_codes = RC_MAP_PINNACLE_PCTV_HD,
2348: .def_i2c_bus = 1,
2349: .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
2350: EM28XX_I2C_FREQ_400_KHZ,
2351: },
2352: [EM2884_BOARD_TERRATEC_HTC_USB_XS] = {
2353: .name = "Terratec Cinergy HTC USB XS",
2354: .has_dvb = 1,
2355: .ir_codes = RC_MAP_NEC_TERRATEC_CINERGY_XS,
2356: .tuner_type = TUNER_ABSENT,
2357: .def_i2c_bus = 1,
2358: .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
2359: EM28XX_I2C_FREQ_400_KHZ,
2360: },
2361: /*
2362: * 1b80:e1cc Delock 61959
2363: * Empia EM2874B + Micronas DRX 3913KA2 + NXP TDA18271HDC2
2364: * mostly the same as MaxMedia UB-425-TC but different remote
2365: */
2366: [EM2874_BOARD_DELOCK_61959] = {
2367: .name = "Delock 61959",
2368: .tuner_type = TUNER_ABSENT,
2369: .tuner_gpio = maxmedia_ub425_tc,
2370: .has_dvb = 1,
2371: .ir_codes = RC_MAP_DELOCK_61959,
2372: .def_i2c_bus = 1,
2373: .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
2374: EM28XX_I2C_FREQ_400_KHZ,
2375: },
2376: /*
2377: * 1b80:e346 KWorld USB ATSC TV Stick UB435-Q V2
2378: * Empia EM2874B + LG DT3305 + NXP TDA18271HDC2
2379: */
2380: [EM2874_BOARD_KWORLD_UB435Q_V2] = {
2381: .name = "KWorld USB ATSC TV Stick UB435-Q V2",
2382: .tuner_type = TUNER_ABSENT,
2383: .has_dvb = 1,
2384: .dvb_gpio = kworld_a340_digital,
2385: .tuner_gpio = default_tuner_gpio,
2386: .def_i2c_bus = 1,
2387: },
2388: /*
2389: * 1b80:e34c KWorld USB ATSC TV Stick UB435-Q V3
2390: * Empia EM2874B + LG DT3305 + NXP TDA18271HDC2
2391: */
2392: [EM2874_BOARD_KWORLD_UB435Q_V3] = {
2393: .name = "KWorld USB ATSC TV Stick UB435-Q V3",
2394: .tuner_type = TUNER_ABSENT,
2395: .has_dvb = 1,
2396: .tuner_gpio = kworld_ub435q_v3_digital,
2397: .def_i2c_bus = 1,
2398: .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
2399: EM28XX_I2C_FREQ_100_KHZ,
2400: .leds = kworld_ub435q_v3_leds,
2401: },
2402: [EM2874_BOARD_PCTV_HD_MINI_80E] = {
2403: .name = "Pinnacle PCTV HD Mini",
2404: .tuner_type = TUNER_ABSENT,
2405: .has_dvb = 1,
2406: .dvb_gpio = em2874_pctv_80e_digital,
2407: .decoder = EM28XX_NODECODER,
2408: .ir_codes = RC_MAP_PINNACLE_PCTV_HD,
2409: .leds = pctv_80e_leds,
2410: },
2411: /*
2412: * 1ae7:9003/9004 SpeedLink Vicious And Devine Laplace webcam
2413: * Empia EM2765 + OmniVision OV2640
2414: */
2415: [EM2765_BOARD_SPEEDLINK_VAD_LAPLACE] = {
2416: .name = "SpeedLink Vicious And Devine Laplace webcam",
2417: .xclk = EM28XX_XCLK_FREQUENCY_24MHZ,
2418: .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
2419: EM28XX_I2C_FREQ_100_KHZ,
2420: .def_i2c_bus = 1,
2421: .tuner_type = TUNER_ABSENT,
2422: .is_webcam = 1,
2423: .input = { {
2424: .type = EM28XX_VMUX_COMPOSITE,
2425: .amux = EM28XX_AMUX_VIDEO,
2426: .gpio = speedlink_vad_laplace_reg_seq,
2427: } },
2428: .buttons = speedlink_vad_laplace_buttons,
2429: .leds = speedlink_vad_laplace_leds,
2430: },
2431: /*
2432: * 2013:0258 PCTV DVB-S2 Stick (461e)
2433: * Empia EM28178, Montage M88DS3103, Montage M88TS2022, Allegro A8293
2434: */
2435: [EM28178_BOARD_PCTV_461E] = {
2436: .def_i2c_bus = 1,
2437: .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
2438: EM28XX_I2C_FREQ_400_KHZ,
2439: .name = "PCTV DVB-S2 Stick (461e)",
2440: .tuner_type = TUNER_ABSENT,
2441: .tuner_gpio = pctv_461e,
2442: .has_dvb = 1,
2443: .ir_codes = RC_MAP_PINNACLE_PCTV_HD,
2444: },
2445: /*
2446: * 2013:0259 PCTV DVB-S2 Stick (461e_v2)
2447: * Empia EM28178, Montage M88DS3103b, Montage M88TS2022, Allegro A8293
2448: */
2449: [EM28178_BOARD_PCTV_461E_V2] = {
2450: .def_i2c_bus = 1,
2451: .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
2452: EM28XX_I2C_FREQ_400_KHZ,
2453: .name = "PCTV DVB-S2 Stick (461e v2)",
2454: .tuner_type = TUNER_ABSENT,
2455: .tuner_gpio = pctv_461e,
2456: .has_dvb = 1,
2457: .ir_codes = RC_MAP_PINNACLE_PCTV_HD,
2458: },
2459: /*
2460: * 2013:025f PCTV tripleStick (292e).
2461: * Empia EM28178, Silicon Labs Si2168, Silicon Labs Si2157
2462: */
2463: [EM28178_BOARD_PCTV_292E] = {
2464: .name = "PCTV tripleStick (292e)",
2465: .def_i2c_bus = 1,
2466: .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
2467: EM28XX_I2C_FREQ_400_KHZ,
2468: .tuner_type = TUNER_ABSENT,
2469: .tuner_gpio = pctv_292e,
2470: .has_dvb = 1,
2471: .ir_codes = RC_MAP_PINNACLE_PCTV_HD,
2472: },
2473: [EM2861_BOARD_LEADTEK_VC100] = {
2474: .name = "Leadtek VC100",
2475: .tuner_type = TUNER_ABSENT, /* Capture only device */
2476: .decoder = EM28XX_TVP5150,
2477: .input = { {
2478: .type = EM28XX_VMUX_COMPOSITE,
2479: .vmux = TVP5150_COMPOSITE1,
2480: .amux = EM28XX_AMUX_LINE_IN,
2481: }, {
2482: .type = EM28XX_VMUX_SVIDEO,
2483: .vmux = TVP5150_SVIDEO,
2484: .amux = EM28XX_AMUX_LINE_IN,
2485: } },
2486: },
2487: /*
2488: * eb1a:8179 Terratec Cinergy T2 Stick HD.
2489: * Empia EM28178, Silicon Labs Si2168, Silicon Labs Si2146
2490: */
2491: [EM28178_BOARD_TERRATEC_T2_STICK_HD] = {
2492: .name = "Terratec Cinergy T2 Stick HD",
2493: .def_i2c_bus = 1,
2494: .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
2495: EM28XX_I2C_FREQ_400_KHZ,
2496: .tuner_type = TUNER_ABSENT,
2497: .tuner_gpio = terratec_t2_stick_hd,
2498: .has_dvb = 1,
2499: .ir_codes = RC_MAP_TERRATEC_SLIM_2,
2500: },
2501:
2502: /*
2503: * 3275:0085 PLEX PX-BCUD.
2504: * Empia EM28178, TOSHIBA TC90532XBG, Sharp QM1D1C0042
2505: */
2506: [EM28178_BOARD_PLEX_PX_BCUD] = {
2507: .name = "PLEX PX-BCUD",
2508: .xclk = EM28XX_XCLK_FREQUENCY_4_3MHZ,
2509: .def_i2c_bus = 1,
2510: .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE,
2511: .tuner_type = TUNER_ABSENT,
2512: .tuner_gpio = plex_px_bcud,
2513: .has_dvb = 1,
2514: },
2515: /*
2516: * 2040:0265 Hauppauge WinTV-dualHD (DVB version) Isoc.
2517: * 2040:8265 Hauppauge WinTV-dualHD (DVB version) Bulk.
2518: * Empia EM28274, 2x Silicon Labs Si2168, 2x Silicon Labs Si2157
2519: */
2520: [EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_DVB] = {
2521: .name = "Hauppauge WinTV-dualHD DVB",
2522: .def_i2c_bus = 1,
2523: .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
2524: EM28XX_I2C_FREQ_400_KHZ,
2525: .tuner_type = TUNER_SI2157,
2526: .tuner_gpio = hauppauge_dualhd_dvb,
2527: .has_dvb = 1,
2528: .has_dual_ts = 1,
2529: .ir_codes = RC_MAP_HAUPPAUGE,
2530: .leds = hauppauge_dualhd_leds,
2531: .input = { {
2532: .type = EM28XX_VMUX_COMPOSITE,
2533: .vmux = TVP5150_COMPOSITE1,
2534: .amux = EM28XX_AMUX_LINE_IN,
2535: } },
2536: },
2537: /*
2538: * 2040:026d Hauppauge WinTV-dualHD (model 01595 - ATSC/QAM) Isoc.
2539: * 2040:826d Hauppauge WinTV-dualHD (model 01595 - ATSC/QAM) Bulk.
2540: * Empia EM28274, 2x LG LGDT3306A, 2x Silicon Labs Si2157
2541: */
2542: [EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_01595] = {
2543: .name = "Hauppauge WinTV-dualHD 01595 ATSC/QAM",
2544: .def_i2c_bus = 1,
2545: .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE |
2546: EM28XX_I2C_FREQ_400_KHZ,
2547: .tuner_type = TUNER_ABSENT,
2548: .tuner_gpio = hauppauge_dualhd_dvb,
2549: .has_dvb = 1,
2550: .has_dual_ts = 1,
2551: .ir_codes = RC_MAP_HAUPPAUGE,
2552: .leds = hauppauge_dualhd_leds,
2553: },
2554: /*
2555: * 1b80:e349 Magix USB Videowandler-2
2556: * (same chips as Honestech VIDBOX NW03)
2557: * Empia EM2860, Philips SAA7113, Empia EMP202, No Tuner
2558: */
2559: [EM2861_BOARD_MAGIX_VIDEOWANDLER2] = {
2560: .name = "Magix USB Videowandler-2",
2561: .tuner_type = TUNER_ABSENT,
2562: .decoder = EM28XX_SAA711X,
2563: .input = { {
2564: .type = EM28XX_VMUX_COMPOSITE,
2565: .vmux = SAA7115_COMPOSITE0,
2566: .amux = EM28XX_AMUX_LINE_IN,
2567: }, {
2568: .type = EM28XX_VMUX_SVIDEO,
2569: .amux = EM28XX_AMUX_LINE_IN,
2570: } },
2571: },
2572: /*
2573: * 1f4d:1abe MyGica iGrabber
2574: * (same as several other EM2860 devices)
2575: * Empia EM2860, Philips SAA7113, Empia EMP202, No Tuner
2576: */
2577: [EM2860_BOARD_MYGICA_IGRABBER] = {
2578: .name = "MyGica iGrabber",
2579: .vchannels = 2,
2580: .tuner_type = TUNER_ABSENT,
2581: .decoder = EM28XX_SAA711X,
2582: .input = { {
2583: .type = EM28XX_VMUX_COMPOSITE,
2584: .vmux = SAA7115_COMPOSITE0,
2585: .amux = EM28XX_AMUX_LINE_IN,
2586: }, {
2587: .type = EM28XX_VMUX_SVIDEO,
2588: .vmux = SAA7115_SVIDEO3,
2589: .amux = EM28XX_AMUX_LINE_IN,
2590: } },
2591: },
2592: /* 2040:826d Hauppauge USB QuadHD
2593: * Empia 28274, Max Linear 692 ATSC combo demod/tuner
2594: */
2595: [EM2874_BOARD_HAUPPAUGE_USB_QUADHD] = {
2596: .name = "Hauppauge USB QuadHD ATSC",
2597: .def_i2c_bus = 1,
2598: .has_dual_ts = 1,
2599: .has_dvb = 1,
2600: .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE | EM28XX_I2C_FREQ_100_KHZ,
2601: .tuner_type = TUNER_ABSENT,
2602: .tuner_gpio = hauppauge_usb_quadhd_atsc_reg_seq,
2603: .leds = hauppauge_usb_quadhd_leds,
2604: },
2605: /*
2606: * eb1a:2860 MyGica UTV3 Analog USB2.0 TV Box
2607: * Empia EM2860, Philips SAA7113, NXP TDA9801T demod,
2608: * Tena TNF931D-DFDR1 tuner (contains NXP TDA6509A),
2609: * ST HCF4052 demux (switches audio to line out),
2610: * no audio over USB
2611: */
2612: [EM2860_BOARD_MYGICA_UTV3] = {
2613: .name = "MyGica UTV3 Analog USB2.0 TV Box",
2614: .xclk = EM28XX_XCLK_IR_RC5_MODE | EM28XX_XCLK_FREQUENCY_12MHZ,
2615: .tuner_type = TUNER_TENA_TNF_931D_DFDR1,
2616: .ir_codes = RC_MAP_MYGICA_UTV3,
2617: .decoder = EM28XX_SAA711X,
2618: .suspend_gpio = mygica_utv3_suspend_gpio,
2619: .input = { {
2620: .type = EM28XX_VMUX_COMPOSITE,
2621: .vmux = SAA7115_COMPOSITE0,
2622: .amux = EM28XX_AMUX_VIDEO,
2623: .gpio = mygica_utv3_composite_audio_gpio,
2624: }, {
2625: .type = EM28XX_VMUX_TELEVISION,
2626: .vmux = SAA7115_COMPOSITE2,
2627: .amux = EM28XX_AMUX_VIDEO,
2628: .gpio = mygica_utv3_tuner_audio_gpio,
2629: } },
2630: },
2631: };
SourceFile:drivers/media/usb/em28xx/em28xx-cards.c]
|
| 129/2 |
2026/05/19 14:55 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 264879
output: 406
thoughts: 1136
Thoughts: **Debugging a Kernel Module Loading Race Condition**
Okay, so I'm looking at this `EM2800_BOARD_UNKNOWN` board, and the `decoder` is set to `EM28XX_SAA711X` and the `tuner_type` is `TUNER_ABSENT`. That means the `dev->board.decoder` is definitely not going to be `EM28XX_NODECODER`, which means `has_video` won't be set to false. Right, so `em28xx_usb_probe` should succeed and `em28xx-video` will get loaded, creating `/dev/video0`. But... why didn't it crash?
Maybe the timing with `poll(0, 0, 500)` is off. It's either too short or too long. I need to get this to reproduce reliably. Let's try a different approach, with a loop of `openat` and `syz_usb_disconnect` called from different threads. Syzkaller, with its asynchronous calls in different threads, should be ideal for this.
I'm thinking if I set up a sequence like this:
```
r0 = syz_usb_connect(...)
openat(...) (async)
openat(...) (async)
openat(...) (async)
openat(...) (async)
syz_usb_disconnect(r0) (async)
```
... these would all run concurrently. But, `syz_usb_connect` loads modules and might take some time to do that. If `openat` and `syz_usb_disconnect` run immediately after `syz_usb_connect` returns, they might run *before* the workqueue finishes loading `em28xx-video`!
That's it! `request_modules` schedules a workqueue! And `syz_usb_connect` returns immediately after `em28xx_usb_probe` finishes, *not* waiting for the workqueue. So `/dev/video0` won't be created when `syz_usb_connect` returns. If I call `openat` immediately, it fails with `ENOENT`, or `syz_usb_disconnect` disconnects the device before `em28xx-video` even loads. Then, when `em28xx-video` *does* load, the device is gone! That means `em28xx_v4l2_init` will never be called, which could be the source of the bug.
I *have* to wait for `/dev/video0` to exist. I can't use syzkaller's lack of looping to wait for a file, so a series of `openat` calls, like:
```
r0 = syz_usb_connect(...)
openat(...)
openat(...)
openat(...)
...
```
might work, but they would block sequentially, possibly taking enough time to do the load, but I need `syz_usb_disconnect` to race with a *successful* `openat` call. This could be tricky. It's like:
```
r0 = syz_usb_connect(...)
openat(...)
openat(...)
...
syz_usb_disconnect(r0) (async)
openat(...) (async)
openat(...) (async)
```
I don't know exactly *when* the device file will be created. I can't use `inotify` or `fanotify` in syzkaller; they're too complex, and trying to use `syz_usb_control_io` to delay might be unreliable.
Wait... `poll(0, 0, 500)` sleeps for 500ms! If I sleep for, say, a full second, the workqueue *definitely* should finish. Let's see if `poll(0, 0, 500)` really does what I think it does. In syzkaller, `poll` is a standard syscall. If I pass zero for both `fds` and `nfds`, it *should* sleep for the `timeout`!
So, let's try a one-second delay: `poll(0, 0, 1000)`:
```
r0 = syz_usb_connect(...)
poll(0x0, 0x0, 0x3e8) // 1000ms
syz_usb_disconnect(r0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video0\x00', 0x2,
|
| 130/2 |
2026/05/19 14:55 |
tool |
reproduce-crash |
1m
Args: map[ReproSyz:r0 = syz_usb_connect(3, 0x2b, &AUTO=ANY=[@ANYBLOB='\x12\x01\x00\x02\xff\xff\xff\x40\x1a\xeb\x00\x28\x00\x01\x00\x00\x00\x01\x09\x02\x19\x00\x01\x01\x00\x80\xfa\x09\x04\x00\x00\x01\xff\xff\xff\x00\x07\x05\x82\x02\x00\x02\x00'], &AUTO={0, 0, 0, 0, 0, []})
poll(0x0, 0x0, 0x3e8)
syz_usb_disconnect(r0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video0\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video0\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video0\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video0\x00', 0x2, 0x0) (async)
]
Results: map[CoverageID: ReproducedBugTitle: ReproducedCrashReport:]
|
| 131/2 |
2026/05/19 14:57 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 267477
output: 406
thoughts: 478
Thoughts: **Debugging a Potentially Interrupted USB Test**
Okay, so the program *still* hasn't crashed. That's a bit perplexing. My initial thought is that the `poll` call might be getting interrupted by a signal, a common occurrence in Syzkaller-generated programs. These tests are often designed to be asynchronous and handle various interrupt scenarios. We need to account for this.
To investigate that hypothesis, maybe I should introduce a delay using a loop of `getpid()` calls to see if that gives things time to settle.
Alternatively, there's another possibility: maybe `/dev/video0` isn't actually the device being targeted. If other tests are concurrently running, it's very likely the device could be `/dev/video1`, `/dev/video2`, or even beyond. To cover this potential source of error, I'll open multiple device nodes; I'll open `/dev/video0` through `/dev/video3` to ensure we capture the correct device, whatever the underlying setup is. This should help to account for device enumeration issues when using these programs.
|
| 132/2 |
2026/05/19 14:57 |
tool |
reproduce-crash |
1m
Args: map[ReproSyz:r0 = syz_usb_connect(3, 0x2b, &AUTO=ANY=[@ANYBLOB='\x12\x01\x00\x02\xff\xff\xff\x40\x1a\xeb\x00\x28\x00\x01\x00\x00\x00\x01\x09\x02\x19\x00\x01\x01\x00\x80\xfa\x09\x04\x00\x00\x01\xff\xff\xff\x00\x07\x05\x82\x02\x00\x02\x00'], &AUTO={0, 0, 0, 0, 0, []})
poll(0x0, 0x0, 0x3e8)
syz_usb_disconnect(r0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video0\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video1\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video2\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video3\x00', 0x2, 0x0) (async)
]
Results: map[CoverageID: ReproducedBugTitle: ReproducedCrashReport:]
|
| 133/2 |
2026/05/19 14:58 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 268624
output: 57
thoughts: 1720
Thoughts: **Debugging a USB Driver Probe**
Okay, so the crash isn't happening, which means the device descriptor is likely being parsed correctly. Let's step through this meticulously. The device is reporting a valid descriptor: `0x12` for the size, `0x01` as a DEVICE descriptor. I'm seeing the correct USB version (2.00), the vendor and product IDs (both `0xff`), the device class is `0x40`, and the device and revision numbers are also present (`0xeb1a`, `0x2800` and `0.01` with `bcdDevice` as `0x01 0x00`). The string descriptors are empty, and it has one configuration.
The configuration descriptor looks sane too (`0x09` for size, `0x02` for CONFIGURATION), with a total length of 25 bytes. It has one interface, with configuration value 1, no configuration string, and attributes `0x80` indicating self-powered, and 500mA of power requested.
The interface descriptor also looks good (`0x09` size, `0x04` for INTERFACE). It has interface number 0, alternative setting 0, one endpoint, vendor-specific class (`0xff`), and no interface string.
Now the endpoint descriptor (`0x07` size, `0x05` for ENDPOINT). This is an IN bulk endpoint (`0x82`), BULK transfer (`0x02`), with a max packet size of 512, and zero for interval.
Now, let's trace through the driver's logic. `em28xx_usb_probe` is key. It's skipping the audio interfaces check because the class is vendor-specific. Good.
It iterates through endpoints. The `em28xx_check_usb_descriptor` function is doing the real work. It is checking for the endpoint address (`0x82`) and bulk transfer type, which is present in my descriptor. This sets `has_video`, so that part is correct.
It also checks the USB speed and doesn't do a speed check since speed is USB_SPEED_HIGH (3).
The next check confirms the decoder is `EM28XX_SAA711X` and that it passes.
Then comes the module loading, which is where things get interesting. `request_modules` is scheduled, calling `request_module_async`. This is where I have to be careful. The code only conditionally loads `snd-usb-audio`, `em28xx-alsa`, `em28xx-dvb`, and `em28xx-rc`. But crucially, it is not loading `em28xx-video`. This is a MAJOR issue, right? Where is `em28xx-video` being loaded then?
If `em28xx-video` isn't loaded, `/dev/video0` will NEVER be created! I'm pretty sure that syzkaller usually either builds this module in or loads it. If it's built-in, is `em28xx_v4l2_init` called during `em28xx_usb_probe`? This must be the case, and I need to confirm this. If `em28xx-video` is built-in, how is the extension registered? Looking at the code:
```c
static int __init em28xx_v4l2_register(void)
{
return em28xx_register_extension(&v4l2_ops);
}
module_init(em28xx_v4l2_register);
```
Ah, `em28xx_v4l2_register` is called during boot when the module is built-in, and it registers the extension, `em28xx_register_extension`.
Does `em28xx_usb_probe` call `em28xx_init_extension`? No. This seems to be the critical detail. I need to figure out where and *when* `em28xx_init_extension` is being called to know whether the initialization of the extension is happening correctly, either at boot or at probe time.
|
| 134/2 |
2026/05/19 14:59 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:drivers/media/usb/em28xx/em28xx-core.c IncludeSnippetLines:0 Name:em28xx_init_extension]
Results: map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:em28xx_init_dev SourceFile:drivers/media/usb/em28xx/em28xx-cards.c SourceLine:3679] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:request_module_async SourceFile:drivers/media/usb/em28xx/em28xx-cards.c SourceLine:3457]] TruncatedOutput:false]
|
| 135/2 |
2026/05/19 14:59 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 271474
output: 53
thoughts: 33
Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience:
**Analyzing the Module Loading Sequence**
Right, so, I see `request_module_async` is involved. My initial hunch, given the context, is that it's likely responsible for handling the asynchronous module loading for the `em28xx` driver. That makes sense, especially in a modern kernel. Okay, so I want to understand what's going on within that call. The fact that it calls `em28xx_init_extension` immediately flags a critical linkage point. I need to understand this part. So the logical next step is to carefully examine the implementation of `request_module_async` to verify this initial assessment. What are the calling parameters of `em28xx_init_extension`? What can go wrong? Let's dig in.
|
| 136/2 |
2026/05/19 15:00 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/media/usb/em28xx/em28xx-cards.c IncludeLines:true Name:request_module_async]
Results: map[SourceCode:3434: static void request_module_async(struct work_struct *work)
3435: {
3436: struct em28xx *dev = container_of(work,
3437: struct em28xx, request_module_wk);
3438:
3439: /*
3440: * The em28xx extensions can be modules or builtin. If the
3441: * modules are already loaded or are built in, those extensions
3442: * can be initialised right now. Otherwise, the module init
3443: * code will do it.
3444: */
3445:
3446: /*
3447: * Devices with an audio-only intf also have a V4L/DVB/RC
3448: * intf. Don't register extensions twice on those devices.
3449: */
3450: if (dev->is_audio_only) {
3451: #if defined(CONFIG_MODULES) && defined(MODULE)
3452: request_module("em28xx-alsa");
3453: #endif
3454: return;
3455: }
3456:
3457: em28xx_init_extension(dev);
3458:
3459: #if defined(CONFIG_MODULES) && defined(MODULE)
3460: if (dev->has_video)
3461: request_module("em28xx-v4l");
3462: if (dev->usb_audio_type == EM28XX_USB_AUDIO_CLASS)
3463: request_module("snd-usb-audio");
3464: else if (dev->usb_audio_type == EM28XX_USB_AUDIO_VENDOR)
3465: request_module("em28xx-alsa");
3466: if (dev->board.has_dvb)
3467: request_module("em28xx-dvb");
3468: if (dev->board.buttons ||
3469: ((dev->board.ir_codes || dev->board.has_ir_i2c) && !disable_ir))
3470: request_module("em28xx-rc");
3471: #endif /* CONFIG_MODULES */
3472: }
SourceFile:drivers/media/usb/em28xx/em28xx-cards.c]
|
| 137/2 |
2026/05/19 15:00 |
llm |
crash-repro-finder |
0m
Model:
Tokens:
input: 272414
output: 431
thoughts: 4192
Thoughts: **The Race Condition in em28xx Driver**
Okay, so here's what I've figured out. `request_module_async` kicks off the initialization (`em28xx_init_extension` and subsequently `em28xx_v4l2_init`) in a workqueue. This means it's happening asynchronously. If we trigger the USB disconnect too soon, before the `/dev/video0` device is created, we have a problem. If we call `openat` immediately after connect, we get `ENOENT`. If we disconnect immediately, the device might not even be initialized, or initialization might fail. This points to a race condition. I originally thought a `poll` or a short loop would be sufficient to wait for the device to appear. Testing this, it appears the disconnect and `openat` can execute concurrently with the device's setup.
My first thought was that `syz_usb_disconnect` wasn't actually disconnecting, so I went back to the documentation, and confirmed that it does disconnect the device. It calls `em28xx_usb_disconnect` which leads to `em28xx_close_extension` then finally `em28xx_v4l2_fini`. This, importantly, sets `dev->v4l2 = NULL` by calling `video_unregister_device`. So, if the open call happens at the same time, we're likely to have a use-after-free situation, but the initial attempt did not cause an obvious crash.
The lock `dev->lock` in both `em28xx_v4l2_open` and `em28xx_v4l2_fini` seemed to offer protection. If `em28xx_v4l2_open` gets the lock first, then all should be well and it would read a valid `dev->v4l2`. However, I now see the following scenario. `em28xx_v4l2_open` reads `v4l2 = dev->v4l2` *before* acquiring the lock. If, in the meantime, `em28xx_v4l2_fini` runs, sets `dev->v4l2` to `NULL`, and frees the memory, then when `em28xx_v4l2_open` acquires the lock, it is a use-after-free, since `v4l2` has been released. The crash report said the GPF was not what I would have expected from reading NULL.
The KASAN crash occurred at `0x1aa0`, which is the `norm` field in `em28xx_v4l2`. This should only happen if `v4l2` is `0`. I checked the structure offset. If `v4l2` is `NULL`, then `v4l2->norm` will evaluate to `0x0000000000001aa0`.
The key is that, during device teardown, while `em28xx_v4l2_open` is trying to run, and the crash happens in `em28xx_resolution_set`, `dev->v4l2` must be `NULL`. It's only possible because the code reads `dev->v4l2` before it acquires the lock. So the crash occurs because the initialization is interrupted.
I ruled out other possibilities like the `dev` pointer being `NULL`, or an interrupt clobbering `dev->v4l2`. The URB completion handlers don't touch `dev->v4l2`.
It's clear that the race lies in the concurrent execution of `em28xx_v4l2_fini` and parts of the `em28xx_v4l2_open` sequence. We have a read of `dev->v4l2` that is *not* protected.
|
| 138/2 |
2026/05/19 15:00 |
tool |
set-results |
0m
Args: map[CandidateReproSyz:r0 = syz_usb_connect(3, 0x2b, &AUTO=ANY=[@ANYBLOB='\x12\x01\x00\x02\xff\xff\xff\x40\x1a\xeb\x00\x28\x00\x01\x00\x00\x00\x01\x09\x02\x19\x00\x01\x01\x00\x80\xfa\x09\x04\x00\x00\x01\xff\xff\xff\x00\x07\x05\x82\x02\x00\x02\x00'], &AUTO={0, 0, 0, 0, 0, []})
poll(0x0, 0x0, 0x3e8)
syz_usb_disconnect(r0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video0\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video1\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video2\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video3\x00', 0x2, 0x0) (async)
ReproOpts:{"threaded":true,"collide":true,"repeat":true,"procs":6}]
Results: map[CandidateReproSyz:r0 = syz_usb_connect(3, 0x2b, &AUTO=ANY=[@ANYBLOB='\x12\x01\x00\x02\xff\xff\xff\x40\x1a\xeb\x00\x28\x00\x01\x00\x00\x00\x01\x09\x02\x19\x00\x01\x01\x00\x80\xfa\x09\x04\x00\x00\x01\xff\xff\xff\x00\x07\x05\x82\x02\x00\x02\x00'], &AUTO={0, 0, 0, 0, 0, []})
poll(0x0, 0x0, 0x3e8)
syz_usb_disconnect(r0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video0\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video1\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video2\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &AUTO='./dev/video3\x00', 0x2, 0x0) (async)
ReproOpts:{"threaded":true,"collide":true,"repeat":true,"procs":6}]
|
| 139/1 |
2026/05/19 15:00 |
action |
syzlang-format |
0m
Results: map[ReproSyz:r0 = syz_usb_connect(0x3, 0x2b, &(0x7f0000000040)=ANY=[@ANYBLOB="12010002ffffff401aeb00280001000000010902190001010080fa0904000001ffffff0007058202000200"], &(0x7f0000000080)={0x0, 0x0, 0x0, 0x0})
poll(0x0, 0x0, 0x3e8)
syz_usb_disconnect(r0) (async)
openat(0xffffffffffffff9c, &(0x7f00000000c0)='./dev/video0\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &(0x7f0000000100)='./dev/video1\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &(0x7f0000000140)='./dev/video2\x00', 0x2, 0x0) (async)
openat(0xffffffffffffff9c, &(0x7f0000000180)='./dev/video3\x00', 0x2, 0x0) (async)
]
|
| 140/1 |
2026/05/19 15:00 |
action |
crash-reproducer |
1m
Results: map[OtherCrashReports:<nil> ReproducedBugTitle:KASAN: slab-use-after-free Read in v4l2_fh_open ReproducedCrashReport:==================================================================
BUG: KASAN: slab-use-after-free in v4l2_fh_init drivers/media/v4l2-core/v4l2-fh.c:25 [inline]
BUG: KASAN: slab-use-after-free in v4l2_fh_open+0xac/0x420 drivers/media/v4l2-core/v4l2-fh.c:64
Read of size 8 at addr ffff88812ede0740 by task v4l_id/7317
CPU: 0 UID: 0 PID: 7317 Comm: v4l_id Not tainted syzkaller #1 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:378 [inline]
print_report+0xba/0x230 mm/kasan/report.c:482
kasan_report+0x117/0x150 mm/kasan/report.c:595
v4l2_fh_init drivers/media/v4l2-core/v4l2-fh.c:25 [inline]
v4l2_fh_open+0xac/0x420 drivers/media/v4l2-core/v4l2-fh.c:64
em28xx_v4l2_open+0x157/0x9a0 drivers/media/usb/em28xx/em28xx-video.c:2153
v4l2_open+0x1bf/0x3a0 drivers/media/v4l2-core/v4l2-dev.c:433
chrdev_open+0x4cd/0x5e0 fs/char_dev.c:411
do_dentry_open+0x805/0x1380 fs/open.c:949
vfs_open+0x3b/0x340 fs/open.c:1081
do_open fs/namei.c:4671 [inline]
path_openat+0x2e08/0x3860 fs/namei.c:4830
do_file_open+0x23e/0x4a0 fs/namei.c:4859
do_sys_openat2+0x113/0x200 fs/open.c:1366
do_sys_open fs/open.c:1372 [inline]
__do_sys_openat fs/open.c:1388 [inline]
__se_sys_openat fs/open.c:1383 [inline]
__x64_sys_openat+0x138/0x170 fs/open.c:1383
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x14d/0x500 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f7bb5487407
Code: 48 89 fa 4c 89 df e8 38 aa 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
RSP: 002b:00007ffc71d4f770 EFLAGS: 00000202 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f7bb5399880 RCX: 00007f7bb5487407
RDX: 0000000000000000 RSI: 00007ffc71d50f27 RDI: ffffffffffffff9c
RBP: 0000000000000002 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000000
R13: 00007ffc71d4f9c0 R14: 00007f7bb5c1d000 R15: 0000563d0ded04d8
</TASK>
Allocated by task 7278:
kasan_save_stack mm/kasan/common.c:57 [inline]
kasan_save_track+0x3e/0x80 mm/kasan/common.c:78
poison_kmalloc_redzone mm/kasan/common.c:398 [inline]
__kasan_kmalloc+0x72/0x90 mm/kasan/common.c:415
kasan_kmalloc include/linux/kasan.h:263 [inline]
__kmalloc_cache_noprof+0x317/0x630 mm/slub.c:5380
kmalloc_noprof include/linux/slab.h:950 [inline]
kzalloc_noprof include/linux/slab.h:1188 [inline]
em28xx_v4l2_init+0x10b/0x2e70 drivers/media/usb/em28xx/em28xx-video.c:2532
em28xx_init_extension+0x120/0x1c0 drivers/media/usb/em28xx/em28xx-core.c:1117
process_one_work kernel/workqueue.c:3276 [inline]
process_scheduled_works+0xb6e/0x18c0 kernel/workqueue.c:3359
worker_thread+0x8a2/0xda0 kernel/workqueue.c:3440
kthread+0x388/0x470 kernel/kthread.c:436
ret_from_fork+0x49b/0xb00 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
Freed by task 7278:
kasan_save_stack mm/kasan/common.c:57 [inline]
kasan_save_track+0x3e/0x80 mm/kasan/common.c:78
kasan_save_free_info+0x46/0x50 mm/kasan/generic.c:584
poison_slab_object mm/kasan/common.c:253 [inline]
__kasan_slab_free+0x3a/0x60 mm/kasan/common.c:285
kasan_slab_free include/linux/kasan.h:235 [inline]
slab_free_hook mm/slub.c:2685 [inline]
slab_free mm/slub.c:6165 [inline]
kfree+0x1c3/0x630 mm/slub.c:6483
em28xx_free_v4l2 drivers/media/usb/em28xx/em28xx-video.c:2118 [inline]
kref_put include/linux/kref.h:65 [inline]
em28xx_v4l2_init+0x1683/0x2e70 drivers/media/usb/em28xx/em28xx-video.c:2901
em28xx_init_extension+0x120/0x1c0 drivers/media/usb/em28xx/em28xx-core.c:1117
process_one_work kernel/workqueue.c:3276 [inline]
process_scheduled_works+0xb6e/0x18c0 kernel/workqueue.c:3359
worker_thread+0x8a2/0xda0 kernel/workqueue.c:3440
kthread+0x388/0x470 kernel/kthread.c:436
ret_from_fork+0x49b/0xb00 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
The buggy address belongs to the object at ffff88812ede0000
which belongs to the cache kmalloc-8k of size 8192
The buggy address is located 1856 bytes inside of
freed 8192-byte region [ffff88812ede0000, ffff88812ede2000)
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x12ede0
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0x200000000000040(head|node=0|zone=2)
page_type: f5(slab)
raw: 0200000000000040 ffff888100042280 dead000000000100 dead000000000122
raw: 0000000000000000 0000000800020002 00000000f5000000 0000000000000000
head: 0200000000000040 ffff888100042280 dead000000000100 dead000000000122
head: 0000000000000000 0000000800020002 00000000f5000000 0000000000000000
head: 0200000000000003 ffffea0004bb7801 00000000ffffffff 00000000ffffffff
head: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000008
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 3023, tgid 3023 (syz-executor), ts 32623573289, free_ts 31659308077
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x231/0x280 mm/page_alloc.c:1889
prep_new_page mm/page_alloc.c:1897 [inline]
get_page_from_freelist+0x230c/0x2430 mm/page_alloc.c:3962
__alloc_frozen_pages_noprof+0x18d/0x380 mm/page_alloc.c:5250
alloc_slab_page mm/slub.c:3292 [inline]
allocate_slab+0x77/0x660 mm/slub.c:3481
new_slab mm/slub.c:3539 [inline]
refill_objects+0x331/0x3c0 mm/slub.c:7175
refill_sheaf mm/slub.c:2812 [inline]
__pcs_replace_empty_main+0x2e6/0x6f0 mm/slub.c:4615
alloc_from_pcs mm/slub.c:4717 [inline]
slab_alloc_node mm/slub.c:4851 [inline]
__kmalloc_cache_noprof+0x38d/0x630 mm/slub.c:5375
kmalloc_noprof include/linux/slab.h:950 [inline]
kzalloc_noprof include/linux/slab.h:1188 [inline]
ipv4_sysctl_init_net+0x2af/0x3e0 net/ipv4/sysctl_net_ipv4.c:1680
ops_init+0x35c/0x5c0 net/core/net_namespace.c:137
setup_net+0x118/0x340 net/core/net_namespace.c:446
copy_net_ns+0x3e9/0x5c0 net/core/net_namespace.c:581
create_new_namespaces+0x404/0x790 kernel/nsproxy.c:130
unshare_nsproxy_namespaces+0x11a/0x160 kernel/nsproxy.c:226
ksys_unshare+0x51d/0x930 kernel/fork.c:3173
__do_sys_unshare kernel/fork.c:3244 [inline]
__se_sys_unshare kernel/fork.c:3242 [inline]
__x64_sys_unshare+0x38/0x50 kernel/fork.c:3242
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x14d/0x500 arch/x86/entry/syscall_64.c:94
page last free pid 3009 tgid 3009 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
__free_pages_prepare mm/page_alloc.c:1433 [inline]
__free_frozen_pages+0x9d9/0xb30 mm/page_alloc.c:2978
__folio_put+0x22a/0x2c0 mm/swap.c:112
put_netmem include/net/netmem.h:420 [inline]
skb_page_unref include/linux/skbuff_ref.h:43 [inline]
__skb_frag_unref include/linux/skbuff_ref.h:56 [inline]
skb_release_data+0x51b/0x810 net/core/skbuff.c:1122
skb_release_all net/core/skbuff.c:1203 [inline]
__kfree_skb net/core/skbuff.c:1217 [inline]
napi_consume_skb+0x1aa/0x2a0 net/core/skbuff.c:1546
skb_defer_free_flush+0x191/0x260 net/core/dev.c:6820
net_rx_action+0x4a6/0xe30 net/core/dev.c:7893
handle_softirqs+0x21b/0x850 kernel/softirq.c:622
do_softirq+0x76/0xd0 kernel/softirq.c:523
__local_bh_enable_ip+0xf8/0x130 kernel/softirq.c:450
local_bh_enable include/linux/bottom_half.h:33 [inline]
rcu_read_unlock_bh include/linux/rcupdate.h:924 [inline]
__dev_queue_xmit+0x1a05/0x31e0 net/core/dev.c:4873
dev_queue_xmit include/linux/netdevice.h:3384 [inline]
neigh_hh_output include/net/neighbour.h:540 [inline]
neigh_output include/net/neighbour.h:554 [inline]
ip_finish_output2+0xc13/0x1000 net/ipv4/ip_output.c:237
NF_HOOK_COND include/linux/netfilter.h:307 [inline]
ip_output+0x29f/0x450 net/ipv4/ip_output.c:438
__ip_queue_xmit+0x1112/0x1c10 net/ipv4/ip_output.c:534
__tcp_transmit_skb+0x2b17/0x43d0 net/ipv4/tcp_output.c:1693
tcp_transmit_skb net/ipv4/tcp_output.c:1711 [inline]
tcp_write_xmit+0x15bd/0x66c0 net/ipv4/tcp_output.c:3064
tcp_sendmsg_locked+0x2c04/0x5440 net/ipv4/tcp.c:1408
Memory state around the buggy address:
ffff88812ede0600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88812ede0680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88812ede0700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88812ede0780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88812ede0800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
ReproducedFaultInjection:]
|
| 141/1 |
2026/05/19 15:02 |
action |
compare |
0m
Results:
|