| 0/0 |
2026/09/06 00:00 |
flow |
assessment-security |
44m
Results: map[DenialOfService:true Explanation:Based on the analysis of the bug report and the kernel source code, here is the
assessment of the vulnerability:
**Root Cause Analysis:**
The bug is located in the `vub300` USB SDIO host controller driver. The driver
uses a kernel timer (`vub300->inactivity_timer`) which executes its callback
`vub300_inactivity_timer_expired()` in softirq context.
If the USB device has been disconnected (`!vub300->interface`), the timer
callback drops its reference to the device by calling `kref_put(&vub300->kref,
vub300_delete)`. If this happens to be the last reference, the cleanup function
`vub300_delete()` is executed directly within the softirq context.
`vub300_delete()` calls `mmc_free_host()`, which eventually calls
`wakeup_source_unregister()` and `synchronize_srcu()`.
`synchronize_srcu()` is a blocking function that must be called from a sleepable
process context. Calling it from an atomic softirq context violates kernel
assumptions, triggering the `BUG: sleeping function called from invalid context`
warning.
**Exploitability:**
This bug is **Exploitable**.
When `synchronize_srcu()` blocks, it calls `wait_for_completion()`, which in
turn calls `schedule()`. On architectures like x86, softirqs run on a dedicated
per-CPU IRQ stack rather than the task's own stack.
When `schedule()` is forced from the IRQ stack, the scheduler saves the task's
context (including the stack pointer `%rsp`) pointing directly into the shared
IRQ stack. While the task is put to sleep waiting for the SRCU grace period,
subsequent hardware interrupts or softirqs on the same CPU will reuse and
overwrite the contents of that IRQ stack.
When the sleeping task is eventually woken up, it will pop corrupted registers
and a corrupted return address from the overwritten IRQ stack. An attacker can
exploit this by intentionally spraying the IRQ stack with controlled data (e.g.,
by sending a flood of network packets or triggering other interrupts) while the
task is sleeping, leading to a full control-flow hijack (ROP) and privilege
escalation.
**Trigger Vectors:**
The vulnerable code is in a USB device driver (`drivers/mmc/host/vub300.c`). To
trigger the bug, an attacker needs to introduce a device matching the `vub300`
USB IDs and then disconnect it at the right time to race with the inactivity
timer.
In a standard Linux environment, this requires physical access to plug in a
malicious USB device (or root privileges to emulate one via
`dummy_hcd`/`raw-gadget`). Therefore, it is classified as a **Peripheral
Trigger**. It is not accessible to unprivileged local users or remote attackers. Exploitable:true FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:true RemoteTrigger:false Unprivileged:false UserNamespace:false VMGuestTrigger:false VMHostTrigger:false]
|
| 1/1 |
2026/09/06 00:00 |
action |
syz-repro-to-c-repro |
0m
Results:
|
| 2/1 |
2026/09/06 00:00 |
action |
kernel-checkouter |
1m
Results: map[KernelSrc:/app/workdir/cache/src/aa98a73d3de081d3fc16043e1ff9e100d090b407]
|
| 3/1 |
2026/09/06 00:01 |
action |
kernel-builder |
24m
Results: map[KernelObj:/app/workdir/cache/build/1233aa80e3de1f6904758e9534b7eb64ab5f9680]
|
| 4/1 |
2026/09/06 00:25 |
action |
codesearch-prepare |
16m
Results: map[Index:codesearch-index]
|
| 5/1 |
2026/09/06 00:42 |
agent |
expert |
2m
Model:
Results: map[DenialOfService:true Exploitable:true FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:true RemoteTrigger:false Unprivileged:false UserNamespace:false VMGuestTrigger:false VMHostTrigger:false]
Instruction: You are an experienced Linux kernel security engineer. Your task is to analyze given kernel bug report
and determine its security impact based on the following dimensions.
Use the provided tools to examine the source code, check for capability checks (e.g., capable(), ns_capable()),
and understand the nature of the bug. Analyze the given kernel build and configuration.
You can check the kernel config by grepping ".config" file; you can check kernel cmdline by grepping
".config" file for "CONFIG_CMDLINE=". Assume sysctl parameters have default values.
But analyze for the corresponding production build w/o debugging tools enabled (like KASAN, KMSAN, UBSAN).
Try different strategies when analyzing the bug:
- think of ways in which the vulnerable code is unreachable
- or the other way around: try to come up with different ideas of how an unprivileged user can reach the bug
If still unsure err on the side of the bug being non-exploitable/not-accessible.
In the final reply, provide a reasoning for your assessment.
Analysis dimensions:
* Exploitable:
Determine if the bug can result in memory corruption, elevated privileges, or an information leak.
Memory safety issues are almost always exploitable (KASAN or UBSAN reports for use-after-free, out-of-bounds;
refcounting issues, corrupted lists, etc). When kernel is crashing on a completely wild pointer access
(e.g. user-space address, or non-canonical address, but not on NULL or address corresponding to KASAN shadow
for NULL address), including both data accesses and control transfers, that also usually implies possibility
of exploitation. Such reports usually say "unable to handle kernel paging request".
Uses of uninitialized values detected by KMSAN may be exploitable b/c attacker frequently can affect uninit
values with spraying techniques. However, for these exploitability depends on how exactly the uninit value
is used in the code, and what it affects.
Information leaks are exploitable on their own and should be classified as such. A bug that copies kernel
memory contents to userspace (e.g. an out-of-bounds read whose result is returned to the caller, or
uninitialized stack/heap bytes written to a user buffer) is exploitable: it can reveal kernel pointer
values and defeat KASLR, expose sensitive data such as cryptographic keys or other processes' memory, and
serves as a necessary building block in most modern kernel privilege-escalation exploit chains. Do not classify
an information leak as non-exploitable solely because it does not directly cause a memory write or control-flow
hijack; the leak itself is the exploit primitive.
Think of what happens after the bug is triggered. Some bugs cause kernel panic and halt execution,
they are harder to exploit. For example, BUG reports halts the kernel. However, WARNING reports don't halt
execution in production builds. Debug bug detection tools (like KASAN, KMSAN, KCSAN, UBSAN) are also not enabled
in production builds, so attacker can freely exploit these bugs w/o being detected by these tools.
If you see an integer overflow, think how the overflowed value used later (if it's used as allocation size,
or an array index). If you see an out-of-bounds read, think if it's followed by an out-of-bounds write as well.
Some KCSAN data-races may be exploitable by skilled attackers as well. Think what data structures got corrupted
as the result of data races and how. However, note that kernel has lots of "benign" data races that don't lead
to any runtime misbehavior at all.
* Denial Of Service:
Determine if the bug can result in denial-of-service. Most bugs can, since they cause system crash,
hangs, deadlocks, or resource leaks. This is mostly applicable to WARNING bugs that won't cause system crash
in production. For these think what will be consequences of the violation of the kernel assumptions flagged
by the WARNING. In some cases the unexpected condition is also properly handled by the normal control flow
(e.g. with "if (WARN_ON(...))"), these won't cause denial-of-service. If the condition is not handled,
then it may or may not cause denial-of-service.
* Accessible From Unprivileged Processes:
Determine if the bug can be reached from a typical (non-root) user process that does NOT have any special capabilities
(like CAP_SYS_ADMIN, CAP_NET_ADMIN, CAP_NET_RAW, CAP_PERFMON) or access to device nodes restricted to root.
Assume that unprivileged_bpf_disabled=1, that is eBPF loading is not accessible. However, cBPF (classical BPF)
is still accessible to non-root processes.
Assume that user namespaces are not accessible, that is, the process cannot get the mentioned capabilities even
within a new user namespace (checked by ns_capable() function in the kernel sources).
* Accessible From User Namespaces:
Determine if the bug can be reached within a user-namespace where the process has all capabilities
(including CAP_SYS_ADMIN, CAP_NET_ADMIN, CAP_NET_RAW, CAP_PERFMON). Such capabilities are checked with ns_capable()
function in the kernel sources.
* VM Guest Trigger:
Determine if the bug can be triggered from the context of a typical KVM guest (e.g., set up by a QEMU VMM).
Consider accesses to standard Linux host paravirtualized features (virtio-blk, virtio-net, etc.),
and handling of VM exits in the KVM code.
* VM Host Trigger in The Confidential Computing Context:
Determine if the bug can be triggered in a confidential computing guest kernel from the context of a KVM host.
Consider access to standard Linux guest paravirtualized features (virtio-blk, virtio-net, etc.).
* Ethernet Network Trigger:
Determine if the bug can be triggered by processing ingress network Ethernet traffic, either directly (network stack)
or via drivers exposed to network data.
* Other Remote Trigger:
Determine if the bug can be triggered by processing remote traffic other than Ethernet (Wifi, Bluetooth, NFC, etc).
* Peripheral Trigger:
Determine if the bug can be triggered via an untrusted peripheral device that can be physically plugged
into a system, such as a USB device or a niche hardware driver handling external hardware inputs.
This is particularly important for mobile and desktop environments where users can plug in unknown devices.
* Malicious Filesystem Trigger:
Determine if the bug can be triggered by the kernel mounting and parsing a malicious filesystem image.
This is highly critical for Desktop and Mobile environments where external media or downloaded images
might be auto-mounted.
Don't make assumptions about the kernel source code (it may be different from what you assume it is).
Extensively use the provided code access tools (codesearch-*, git-*, grepper, etc)
to examine the actual source code, and confirm any assumptions.
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:
The kernel bug report is:
RBP: 00007fdafa94fdec R08: 0000000000000000 R09: 0000000000000001
R10: 000055558fe747d0 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000000927c0 R14: 0000000000076876 R15: 00007fdafa94fe40
</TASK>
=============================
WARNING: suspicious RCU usage
syzkaller #0 Tainted: G W L
-----------------------------
kernel/rcu/srcutree.c:1468 Illegal synchronize_srcu() in same-type SRCU (or in RCU) read-side critical section!
other info that might help us debug this:
rcu_scheduler_active = 2, debug_locks = 1
locks held by syz-executor/5675: 5, last CPU#0:
#0: ffffffff8ee35c10 (dup_mmap_sem){.+.+}-{0:0}, at: dup_mm kernel/fork.c:1542 [inline]
#0: ffffffff8ee35c10 (dup_mmap_sem){.+.+}-{0:0}, at: copy_mm+0x10f/0x480 kernel/fork.c:1595
#1: ffff88807ed2c378 (&mm->mmap_lock){++++}-{4:4}, at: mmap_write_lock_killable include/linux/mmap_lock.h:562 [inline]
#1: ffff88807ed2c378 (&mm->mmap_lock){++++}-{4:4}, at: dup_mmap+0x195/0x1dc0 mm/mmap.c:1716
#2: ffff888025d09078 (&mm->mmap_lock/1){+.+.}-{4:4}, at: mmap_write_lock_nested include/linux/mmap_lock.h:552 [inline]
#2: ffff888025d09078 (&mm->mmap_lock/1){+.+.}-{4:4}, at: dup_mmap+0x221/0x1dc0 mm/mmap.c:1723
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:309 [inline]
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:849 [inline]
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: __pte_offset_map+0x29/0x240 mm/pgtable-generic.c:290
#4: ffffc90000007cc0 ((&vub300->inactivity_timer)){+.-.}-{0:0}, at: call_timer_fn+0xd5/0x5f0 kernel/time/timer.c:1745
stack backtrace:
CPU: 0 UID: 0 PID: 5675 Comm: syz-executor Tainted: G W L syzkaller #0 PREEMPT(full)
Tainted: [W]=WARN, [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
Call Trace:
<IRQ>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
lockdep_rcu_suspicious+0x140/0x1d0 kernel/locking/lockdep.c:6938
__synchronize_srcu+0x157/0x2f0 kernel/rcu/srcutree.c:1464
wakeup_source_remove drivers/base/power/wakeup.c:201 [inline]
wakeup_source_unregister+0x129/0x3f0 drivers/base/power/wakeup.c:237
mmc_host_classdev_release+0x47/0x100 drivers/mmc/core/host.c:69
device_release+0xc4/0x1f0 drivers/base/core.c:-1
kobject_cleanup lib/kobject.c:689 [inline]
kobject_release lib/kobject.c:720 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x222/0x550 lib/kobject.c:737
call_timer_fn+0x18d/0x5f0 kernel/time/timer.c:1748
expire_timers kernel/time/timer.c:1799 [inline]
__run_timers kernel/time/timer.c:2374 [inline]
__run_timer_base+0x652/0x8b0 kernel/time/timer.c:2386
run_timer_base kernel/time/timer.c:2395 [inline]
run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2405
handle_softirqs+0x226/0x860 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0xcb/0x220 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1062
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:finish_task_switch+0x413/0xc60 kernel/sched/core.c:5371
Code: 04 00 00 41 c7 84 24 20 0e 00 00 00 00 00 00 0f 1f 44 00 00 49 83 c4 48 4c 89 e7 e8 f7 ed 50 0a e8 d2 00 3a 00 fb 4c 8b 65 c8 <49> 8d bc 24 10 17 00 00 48 89 f8 48 c1 e8 03 42 0f b6 04 30 84 c0
RSP: 0018:ffffc90004327020 EFLAGS: 00000206
RAX: 00000000000f564d RBX: ffff8880b863c8e0 RCX: 8000000000000001
RDX: 0000000000000006 RSI: ffffffff8e4744cc RDI: ffffffff8c6d9480
RBP: ffffc90004327070 R08: ffffffff907a167f R09: 1ffffffff20f42cf
R10: dffffc0000000000 R11: fffffbfff20f42d0 R12: ffff88803588ddc0
R13: ffff8880b863c8b8 R14: dffffc0000000000 R15: 1ffff110170c791c
context_switch kernel/sched/core.c:5523 [inline]
__schedule+0x17e3/0x58f0 kernel/sched/core.c:7270
preempt_schedule_common+0x7f/0xd0 kernel/sched/core.c:7449
preempt_schedule_thunk+0x16/0x40 arch/x86/entry/thunk.S:12
__raw_spin_unlock include/linux/spinlock_api_smp.h:201 [inline]
_raw_spin_unlock+0x41/0x50 kernel/locking/spinlock.c:213
spin_unlock include/linux/spinlock.h:401 [inline]
copy_pte_range mm/memory.c:1429 [inline]
copy_pmd_range+0x5176/0x5c10 mm/memory.c:1490
copy_pud_range mm/memory.c:1527 [inline]
copy_p4d_range mm/memory.c:1551 [inline]
copy_page_range+0xc82/0x1290 mm/memory.c:1637
dup_mmap+0xf17/0x1dc0 mm/mmap.c:1819
dup_mm kernel/fork.c:1543 [inline]
copy_mm+0x11a/0x480 kernel/fork.c:1595
copy_process+0x1e75/0x43e0 kernel/fork.c:2307
kernel_clone+0x2d7/0x940 kernel/fork.c:2766
__do_sys_clone kernel/fork.c:2908 [inline]
__se_sys_clone kernel/fork.c:2892 [inline]
__x64_sys_clone+0x1b6/0x230 kernel/fork.c:2892
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fdafa5c6bd2
Code: 89 e7 e8 71 8b f7 ff 45 31 c0 31 d2 31 f6 64 48 8b 04 25 10 00 00 00 bf 11 00 20 01 4c 8d 90 d0 02 00 00 b8 38 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 66 89 c5 85 c0 75 3b 64 48 8b 04 25 10 00 00
RSP: 002b:00007fdafa94fc60 EFLAGS: 00000246 ORIG_RAX: 0000000000000038
RAX: ffffffffffffffda RBX: 00007fdafa94fc60 RCX: 00007fdafa5c6bd2
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011
RBP: 00007fdafa94fdec R08: 0000000000000000 R09: 0000000000000001
R10: 000055558fe747d0 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000000927c0 R14: 0000000000076876 R15: 00007fdafa94fe40
</TASK>
BUG: sleeping function called from invalid context at kernel/rcu/srcutree.c:1472
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 5675, name: syz-executor
preempt_count: 101, expected: 0
RCU nest depth: 1, expected: 0
locks held by syz-executor/5675: 5, last CPU#0:
#0: ffffffff8ee35c10 (dup_mmap_sem){.+.+}-{0:0}, at: dup_mm kernel/fork.c:1542 [inline]
#0: ffffffff8ee35c10 (dup_mmap_sem){.+.+}-{0:0}, at: copy_mm+0x10f/0x480 kernel/fork.c:1595
#1: ffff88807ed2c378 (&mm->mmap_lock){++++}-{4:4}, at: mmap_write_lock_killable include/linux/mmap_lock.h:562 [inline]
#1: ffff88807ed2c378 (&mm->mmap_lock){++++}-{4:4}, at: dup_mmap+0x195/0x1dc0 mm/mmap.c:1716
#2: ffff888025d09078 (&mm->mmap_lock/1){+.+.}-{4:4}, at: mmap_write_lock_nested include/linux/mmap_lock.h:552 [inline]
#2: ffff888025d09078 (&mm->mmap_lock/1){+.+.}-{4:4}, at: dup_mmap+0x221/0x1dc0 mm/mmap.c:1723
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:309 [inline]
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:849 [inline]
#3: ffffffff8ed5c6e0 (rcu_read_lock){....}-{1:3}, at: __pte_offset_map+0x29/0x240 mm/pgtable-generic.c:290
#4: ffffc90000007cc0 ((&vub300->inactivity_timer)){+.-.}-{0:0}, at: call_timer_fn+0xd5/0x5f0 kernel/time/timer.c:1745
Preemption disabled at:
[<ffffffff81336576>] preempt_schedule_thunk+0x16/0x40 arch/x86/entry/thunk.S:12
CPU: 0 UID: 0 PID: 5675 Comm: syz-executor Tainted: G W L syzkaller #0 PREEMPT(full)
Tainted: [W]=WARN, [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
Call Trace:
<IRQ>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
__might_resched+0x36a/0x4c0 kernel/sched/core.c:9234
__synchronize_srcu+0x1a1/0x2f0 kernel/rcu/srcutree.c:1472
wakeup_source_remove drivers/base/power/wakeup.c:201 [inline]
wakeup_source_unregister+0x129/0x3f0 drivers/base/power/wakeup.c:237
mmc_host_classdev_release+0x47/0x100 drivers/mmc/core/host.c:69
device_release+0xc4/0x1f0 drivers/base/core.c:-1
kobject_cleanup lib/kobject.c:689 [inline]
kobject_release lib/kobject.c:720 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x222/0x550 lib/kobject.c:737
call_timer_fn+0x18d/0x5f0 kernel/time/timer.c:1748
expire_timers kernel/time/timer.c:1799 [inline]
__run_timers kernel/time/timer.c:2374 [inline]
__run_timer_base+0x652/0x8b0 kernel/time/timer.c:2386
run_timer_base kernel/time/timer.c:2395 [inline]
run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2405
handle_softirqs+0x226/0x860 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0xcb/0x220 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1062
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:finish_task_switch+0x413/0xc60 kernel/sched/core.c:5371
Code: 04 00 00 41 c7 84 24 20 0e 00 00 00 00 00 00 0f 1f 44 00 00 49 83 c4 48 4c 89 e7 e8 f7 ed 50 0a e8 d2 00 3a 00 fb 4c 8b 65 c8 <49> 8d bc 24 10 17 00 00 48 89 f8 48 c1 e8 03 42 0f b6 04 30 84 c0
RSP: 0018:ffffc90004327020 EFLAGS: 00000206
RAX: 00000000000f564d RBX: ffff8880b863c8e0 RCX: 8000000000000001
RDX: 0000000000000006 RSI: ffffffff8e4744cc RDI: ffffffff8c6d9480
RBP: ffffc90004327070 R08: ffffffff907a167f R09: 1ffffffff20f42cf
R10: dffffc0000000000 R11: fffffbfff20f42d0 R12: ffff88803588ddc0
R13: ffff8880b863c8b8 R14: dffffc0000000000 R15: 1ffff110170c791c
context_switch kernel/sched/core.c:5523 [inline]
__schedule+0x17e3/0x58f0 kernel/sched/core.c:7270
preempt_schedule_common+0x7f/0xd0 kernel/sched/core.c:7449
preempt_schedule_thunk+0x16/0x40 arch/x86/entry/thunk.S:12
__raw_spin_unlock include/linux/spinlock_api_smp.h:201 [inline]
_raw_spin_unlock+0x41/0x50 kernel/locking/spinlock.c:213
spin_unlock include/linux/spinlock.h:401 [inline]
copy_pte_range mm/memory.c:1429 [inline]
copy_pmd_range+0x5176/0x5c10 mm/memory.c:1490
copy_pud_range mm/memory.c:1527 [inline]
copy_p4d_range mm/memory.c:1551 [inline]
copy_page_range+0xc82/0x1290 mm/memory.c:1637
dup_mmap+0xf17/0x1dc0 mm/mmap.c:1819
dup_mm kernel/fork.c:1543 [inline]
copy_mm+0x11a/0x480 kernel/fork.c:1595
copy_process+0x1e75/0x43e0 kernel/fork.c:2307
kernel_clone+0x2d7/0x940 kernel/fork.c:2766
__do_sys_clone kernel/fork.c:2908 [inline]
__se_sys_clone kernel/fork.c:2892 [inline]
__x64_sys_clone+0x1b6/0x230 kernel/fork.c:2892
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fdafa5c6bd2
Code: 89 e7 e8 71 8b f7 ff 45 31 c0 31 d2 31 f6 64 48 8b 04 25 10 00 00 00 bf 11 00 20 01 4c 8d 90 d0 02 00 00 b8 38 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 66 89 c5 85 c0 75 3b 64 48 8b 04 25 10 00 00
RSP: 002b:00007fdafa94fc60 EFLAGS: 00000246 ORIG_RAX: 0000000000000038
RAX: ffffffffffffffda RBX: 00007fdafa94fc60 RCX: 00007fdafa5c6bd2
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011
RBP: 00007fdafa94fdec R08: 0000000000000000 R09: 0000000000000001
R10: 000055558fe747d0 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000000927c0 R14: 0000000000076876 R15: 00007fdafa94fe40
</TASK>
ODEBUG: object ffffc90000007a80 is NOT on stack ffffc90004320000, but annotated.
------------[ cut here ]------------
1
WARNING: lib/debugobjects.c:672 at debug_object_is_on_stack lib/debugobjects.c:672 [inline], CPU#0: syz-executor/5675
WARNING: lib/debugobjects.c:672 at lookup_object_or_alloc lib/debugobjects.c:705 [inline], CPU#0: syz-executor/5675
WARNING: lib/debugobjects.c:672 at __debug_object_init+0x2c4/0x3c0 lib/debugobjects.c:798, CPU#0: syz-executor/5675
Modules linked in:
CPU: 0 UID: 0 PID: 5675 Comm: syz-executor Tainted: G W L syzkaller #0 PREEMPT(full)
Tainted: [W]=WARN, [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
RIP: 0010:debug_object_is_on_stack lib/debugobjects.c:672 [inline]
RIP: 0010:lookup_object_or_alloc lib/debugobjects.c:705 [inline]
RIP: 0010:__debug_object_init+0x2c4/0x3c0 lib/debugobjects.c:798
Code: cc cc cc 41 ff c7 44 89 3d c9 75 e8 15 48 c7 c1 80 9d 6d 8c 48 c7 c7 e0 9d 6d 8c 84 c0 48 0f 45 f9 48 89 de e8 4d fa 3d fc 90 <0f> 0b 90 e9 c0 fe ff ff e8 4f 1c 00 00 8b 05 a1 cd 6e 0a 3b 05 9f
RSP: 0018:ffffc900000079b8 EFLAGS: 00010046
RAX: 0000000000000050 RBX: ffffc90000007a80 RCX: 0978036a12caea00
RDX: 0000000000000100 RSI: 0000000000000100 RDI: 0000000000000000
RBP: ffff88803588dde0 R08: 0000000000000100 R09: 0000000000080000
R10: 0000000000008000 R11: ffffffff8ec362b8 R12: 1ffff92000000f4c
R13: ffff888021b995e8 R14: dffffc0000000000 R15: 0000000000000001
FS: 000055558fe74500(0000) GS:ffff888124cd9000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fdafb3556c8 CR3: 00000000640ca000 CR4: 00000000003526f0
Call Trace:
<IRQ>
__synchronize_srcu+0x1d5/0x2f0 kernel/rcu/srcutree.c:1475
wakeup_source_remove drivers/base/power/wakeup.c:201 [inline]
wakeup_source_unregister+0x129/0x3f0 drivers/base/power/wakeup.c:237
mmc_host_classdev_release+0x47/0x100 drivers/mmc/core/host.c:69
device_release+0xc4/0x1f0 drivers/base/core.c:-1
kobject_cleanup lib/kobject.c:689 [inline]
kobject_release lib/kobject.c:720 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x222/0x550 lib/kobject.c:737
call_timer_fn+0x18d/0x5f0 kernel/time/timer.c:1748
expire_timers kernel/time/timer.c:1799 [inline]
__run_timers kernel/time/timer.c:2374 [inline]
__run_timer_base+0x652/0x8b0 kernel/time/timer.c:2386
run_timer_base kernel/time/timer.c:2395 [inline]
run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2405
handle_softirqs+0x226/0x860 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0xcb/0x220 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1062
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:finish_task_switch+0x413/0xc60 kernel/sched/core.c:5371
Code: 04 00 00 41 c7 84 24 20 0e 00 00 00 00 00 00 0f 1f 44 00 00 49 83 c4 48 4c 89 e7 e8 f7 ed 50 0a e8 d2 00 3a 00 fb 4c 8b 65 c8 <49> 8d bc 24 10 17 00 00 48 89 f8 48 c1 e8 03 42 0f b6 04 30 84 c0
RSP: 0018:ffffc90004327020 EFLAGS: 00000206
RAX: 00000000000f564d RBX: ffff8880b863c8e0 RCX: 8000000000000001
RDX: 0000000000000006 RSI: ffffffff8e4744cc RDI: ffffffff8c6d9480
RBP: ffffc90004327070 R08: ffffffff907a167f R09: 1ffffffff20f42cf
R10: dffffc0000000000 R11: fffffbfff20f42d0 R12: ffff88803588ddc0
R13: ffff8880b863c8b8 R14: dffffc0000000000 R15: 1ffff110170c791c
context_switch kernel/sched/core.c:5523 [inline]
__schedule+0x17e3/0x58f0 kernel/sched/core.c:7270
preempt_schedule_common+0x7f/0xd0 kernel/sched/core.c:7449
preempt_schedule_thunk+0x16/0x40 arch/x86/entry/thunk.S:12
__raw_spin_unlock include/linux/spinlock_api_smp.h:201 [inline]
_raw_spin_unlock+0x41/0x50 kernel/locking/spinlock.c:213
spin_unlock include/linux/spinlock.h:401 [inline]
copy_pte_range mm/memory.c:1429 [inline]
copy_pmd_range+0x5176/0x5c10 mm/memory.c:1490
copy_pud_range mm/memory.c:1527 [inline]
copy_p4d_range mm/memory.c:1551 [inline]
copy_page_range+0xc82/0x1290 mm/memory.c:1637
dup_mmap+0xf17/0x1dc0 mm/mmap.c:1819
dup_mm kernel/fork.c:1543 [inline]
copy_mm+0x11a/0x480 kernel/fork.c:1595
copy_process+0x1e75/0x43e0 kernel/fork.c:2307
kernel_clone+0x2d7/0x940 kernel/fork.c:2766
__do_sys_clone kernel/fork.c:2908 [inline]
__se_sys_clone kernel/fork.c:2892 [inline]
__x64_sys_clone+0x1b6/0x230 kernel/fork.c:2892
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fdafa5c6bd2
Code: 89 e7 e8 71 8b f7 ff 45 31 c0 31 d2 31 f6 64 48 8b 04 25 10 00 00 00 bf 11 00 20 01 4c 8d 90 d0 02 00 00 b8 38 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 66 89 c5 85 c0 75 3b 64 48 8b 04 25 10 00 00
RSP: 002b:00007fdafa94fc60 EFLAGS: 00000246 ORIG_RAX: 0000000000000038
RAX: ffffffffffffffda RBX: 00007fdafa94fc60 RCX: 00007fdafa5c6bd2
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011
RBP: 00007fdafa94fdec R08: 0000000000000000 R09: 0000000000000001
R10: 000055558fe747d0 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000000927c0 R14: 0000000000076876 R15: 00007fdafa94fe40
</TASK>
----------------
Code disassembly (best guess), 1 bytes skipped:
0: 00 00 add %al,(%rax)
2: 41 c7 84 24 20 0e 00 movl $0x0,0xe20(%r12)
9: 00 00 00 00 00
e: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
13: 49 83 c4 48 add $0x48,%r12
17: 4c 89 e7 mov %r12,%rdi
1a: e8 f7 ed 50 0a call 0xa50ee16
1f: e8 d2 00 3a 00 call 0x3a00f6
24: fb sti
25: 4c 8b 65 c8 mov -0x38(%rbp),%r12
* 29: 49 8d bc 24 10 17 00 lea 0x1710(%r12),%rdi <-- trapping instruction
30: 00
31: 48 89 f8 mov %rdi,%rax
34: 48 c1 e8 03 shr $0x3,%rax
38: 42 0f b6 04 30 movzbl (%rax,%r14,1),%eax
3d: 84 c0 test %al,%al
Reply: Based on the analysis of the bug report and the kernel source code, here is the assessment of the vulnerability:
**Root Cause Analysis:**
The bug is located in the `vub300` USB SDIO host controller driver. The driver uses a kernel timer (`vub300->inactivity_timer`) which executes its callback `vub300_inactivity_timer_expired()` in softirq context.
If the USB device has been disconnected (`!vub300->interface`), the timer callback drops its reference to the device by calling `kref_put(&vub300->kref, vub300_delete)`. If this happens to be the last reference, the cleanup function `vub300_delete()` is executed directly within the softirq context.
`vub300_delete()` calls `mmc_free_host()`, which eventually calls `wakeup_source_unregister()` and `synchronize_srcu()`.
`synchronize_srcu()` is a blocking function that must be called from a sleepable process context. Calling it from an atomic softirq context violates kernel assumptions, triggering the `BUG: sleeping function called from invalid context` warning.
**Exploitability:**
This bug is **Exploitable**.
When `synchronize_srcu()` blocks, it calls `wait_for_completion()`, which in turn calls `schedule()`. On architectures like x86, softirqs run on a dedicated per-CPU IRQ stack rather than the task's own stack.
When `schedule()` is forced from the IRQ stack, the scheduler saves the task's context (including the stack pointer `%rsp`) pointing directly into the shared IRQ stack. While the task is put to sleep waiting for the SRCU grace period, subsequent hardware interrupts or softirqs on the same CPU will reuse and overwrite the contents of that IRQ stack.
When the sleeping task is eventually woken up, it will pop corrupted registers and a corrupted return address from the overwritten IRQ stack. An attacker can exploit this by intentionally spraying the IRQ stack with controlled data (e.g., by sending a flood of network packets or triggering other interrupts) while the task is sleeping, leading to a full control-flow hijack (ROP) and privilege escalation.
**Trigger Vectors:**
The vulnerable code is in a USB device driver (`drivers/mmc/host/vub300.c`). To trigger the bug, an attacker needs to introduce a device matching the `vub300` USB IDs and then disconnect it at the right time to race with the inactivity timer.
In a standard Linux environment, this requires physical access to plug in a malicious USB device (or root privileges to emulate one via `dummy_hcd`/`raw-gadget`). Therefore, it is classified as a **Peripheral Trigger**. It is not accessible to unprivileged local users or remote attackers.
|
| 6/2 |
2026/09/06 00:42 |
llm |
expert |
0m
Model:
Tokens:
input: 16002
output: 19
thoughts: 623
Thoughts: **RCU, Timers, and a Suspect Driver: Let's Investigate**
Okay, so I've got a syzkaller report flagged with "suspicious RCU usage" and a clear indication of a conflict within `srcutree.c`. Specifically, the warning flags an illegal `synchronize_srcu()` call within a read-side critical section. And then, there's a kernel panic, another bug, and an indication that a sleeping function is being called from an invalid context, also in `srcutree.c`. What a mess!
The stack trace is pointing directly to `__synchronize_srcu`, and then it leads me through `wakeup_source_unregister`, which is interesting. It then goes through `mmc_host_classdev_release`, which makes me think this is probably an mmc driver issue. I'm seeing timers involved, which adds another layer of complexity. Based on the stack, it looks like a timer is expiring, leading us through the usual timer infrastructure - `call_timer_fn`, `expire_timers`, and so on. Specifically I'm seeing `((&vub300->inactivity_timer))` as the timer's object.
So, let's connect the dots. The stack trace strongly hints at a connection between the RCU problem, this timer, and some kind of MMC device. Since I see `wakeup_source_unregister` is called, my suspicion is now at `vub300`, I need to dig deeper into the `vub300` driver. I'll need to check how it's using RCU and timers and see if there's an obvious synchronization issue that could trigger this kind of conflict. My hunch is, there's a race condition between the RCU read-side critical section, the timer's callback, and how the device is unregistered. Time to dive into the code...
|
| 7/2 |
2026/09/06 00:42 |
tool |
grepper |
0m
Args:
Results: map[Output:
Full output is too long, showing 500 out of 1644 lines.
Use more precise expression if possible.
MAINTAINERS=29293=S: Orphan
MAINTAINERS:29294:F: drivers/mmc/host/vub300.c
MAINTAINERS-29295-
--
drivers/mmc/host/Kconfig=920=config MMC_VUB300
--
drivers/mmc/host/Kconfig-944- To compile this mmc host controller driver as a module,
drivers/mmc/host/Kconfig:945: choose M here: the module will be called vub300.
drivers/mmc/host/Kconfig-946-
--
drivers/mmc/host/Makefile=62=obj-$(CONFIG_MMC_JZ4740) += jz4740_mmc.o
drivers/mmc/host/Makefile:63:obj-$(CONFIG_MMC_VUB300) += vub300.o
drivers/mmc/host/Makefile-64-obj-$(CONFIG_MMC_USHC) += ushc.o
--
drivers/mmc/host/vub300.c=260=MODULE_PARM_DESC(firmware_rom_wait_states,
--
drivers/mmc/host/vub300.c-265-#define VUB300_PRODUCT_ID 0x012C
drivers/mmc/host/vub300.c:266:static const struct usb_device_id vub300_table[] = {
drivers/mmc/host/vub300.c-267- {USB_DEVICE(ELAN_VENDOR_ID, VUB300_PRODUCT_ID)},
--
drivers/mmc/host/vub300.c-270-};
drivers/mmc/host/vub300.c:271:MODULE_DEVICE_TABLE(usb, vub300_table);
drivers/mmc/host/vub300.c-272-
--
drivers/mmc/host/vub300.c=286=struct sdio_register {
--
drivers/mmc/host/vub300.c-295-
drivers/mmc/host/vub300.c:296:struct vub300_mmc_host {
drivers/mmc/host/vub300.c-297- struct usb_device *udev;
--
drivers/mmc/host/vub300.c-354-
drivers/mmc/host/vub300.c:355:#define kref_to_vub300_mmc_host(d) container_of(d, struct vub300_mmc_host, kref)
drivers/mmc/host/vub300.c-356-#define SET_TRANSFER_PSEUDOCODE 21
--
drivers/mmc/host/vub300.c-368-
drivers/mmc/host/vub300.c:369:static void vub300_delete(struct kref *kref)
drivers/mmc/host/vub300.c-370-{ /* kref callback - softirq */
drivers/mmc/host/vub300.c:371: struct vub300_mmc_host *vub300 = kref_to_vub300_mmc_host(kref);
drivers/mmc/host/vub300.c:372: struct mmc_host *mmc = vub300->mmc;
drivers/mmc/host/vub300.c-373-
drivers/mmc/host/vub300.c:374: usb_free_urb(vub300->command_out_urb);
drivers/mmc/host/vub300.c:375: vub300->command_out_urb = NULL;
drivers/mmc/host/vub300.c:376: usb_free_urb(vub300->command_res_urb);
drivers/mmc/host/vub300.c:377: vub300->command_res_urb = NULL;
drivers/mmc/host/vub300.c:378: usb_put_dev(vub300->udev);
drivers/mmc/host/vub300.c-379- mmc_free_host(mmc);
drivers/mmc/host/vub300.c-380- /*
drivers/mmc/host/vub300.c:381: * and hence also frees vub300
drivers/mmc/host/vub300.c-382- * which is contained at the end of struct mmc
--
drivers/mmc/host/vub300.c-385-
drivers/mmc/host/vub300.c:386:static void vub300_queue_cmnd_work(struct vub300_mmc_host *vub300)
drivers/mmc/host/vub300.c-387-{
drivers/mmc/host/vub300.c:388: kref_get(&vub300->kref);
drivers/mmc/host/vub300.c:389: if (queue_work(cmndworkqueue, &vub300->cmndwork)) {
drivers/mmc/host/vub300.c-390- /*
--
drivers/mmc/host/vub300.c-401- */
drivers/mmc/host/vub300.c:402: kref_put(&vub300->kref, vub300_delete);
drivers/mmc/host/vub300.c-403- }
--
drivers/mmc/host/vub300.c-405-
drivers/mmc/host/vub300.c:406:static void vub300_queue_poll_work(struct vub300_mmc_host *vub300, int delay)
drivers/mmc/host/vub300.c-407-{
drivers/mmc/host/vub300.c:408: kref_get(&vub300->kref);
drivers/mmc/host/vub300.c:409: if (queue_delayed_work(pollworkqueue, &vub300->pollwork, delay)) {
drivers/mmc/host/vub300.c-410- /*
--
drivers/mmc/host/vub300.c-421- */
drivers/mmc/host/vub300.c:422: kref_put(&vub300->kref, vub300_delete);
drivers/mmc/host/vub300.c-423- }
--
drivers/mmc/host/vub300.c-425-
drivers/mmc/host/vub300.c:426:static void vub300_queue_dead_work(struct vub300_mmc_host *vub300)
drivers/mmc/host/vub300.c-427-{
drivers/mmc/host/vub300.c:428: kref_get(&vub300->kref);
drivers/mmc/host/vub300.c:429: if (queue_work(deadworkqueue, &vub300->deadwork)) {
drivers/mmc/host/vub300.c-430- /*
--
drivers/mmc/host/vub300.c-441- */
drivers/mmc/host/vub300.c:442: kref_put(&vub300->kref, vub300_delete);
drivers/mmc/host/vub300.c-443- }
--
drivers/mmc/host/vub300.c=446=static void irqpoll_res_completed(struct urb *urb)
drivers/mmc/host/vub300.c-447-{ /* urb completion handler - hardirq */
drivers/mmc/host/vub300.c:448: struct vub300_mmc_host *vub300 = (struct vub300_mmc_host *)urb->context;
drivers/mmc/host/vub300.c-449- if (urb->status)
drivers/mmc/host/vub300.c:450: vub300->usb_transport_fail = urb->status;
drivers/mmc/host/vub300.c:451: complete(&vub300->irqpoll_complete);
drivers/mmc/host/vub300.c-452-}
--
drivers/mmc/host/vub300.c=454=static void irqpoll_out_completed(struct urb *urb)
drivers/mmc/host/vub300.c-455-{ /* urb completion handler - hardirq */
drivers/mmc/host/vub300.c:456: struct vub300_mmc_host *vub300 = (struct vub300_mmc_host *)urb->context;
drivers/mmc/host/vub300.c-457- if (urb->status) {
drivers/mmc/host/vub300.c:458: vub300->usb_transport_fail = urb->status;
drivers/mmc/host/vub300.c:459: complete(&vub300->irqpoll_complete);
drivers/mmc/host/vub300.c-460- return;
--
drivers/mmc/host/vub300.c-463- unsigned int pipe =
drivers/mmc/host/vub300.c:464: usb_rcvbulkpipe(vub300->udev, vub300->cmnd_res_ep);
drivers/mmc/host/vub300.c:465: usb_fill_bulk_urb(vub300->command_res_urb, vub300->udev, pipe,
drivers/mmc/host/vub300.c:466: &vub300->resp, sizeof(vub300->resp),
drivers/mmc/host/vub300.c:467: irqpoll_res_completed, vub300);
drivers/mmc/host/vub300.c:468: vub300->command_res_urb->actual_length = 0;
drivers/mmc/host/vub300.c:469: ret = usb_submit_urb(vub300->command_res_urb, GFP_ATOMIC);
drivers/mmc/host/vub300.c-470- if (ret) {
drivers/mmc/host/vub300.c:471: vub300->usb_transport_fail = ret;
drivers/mmc/host/vub300.c:472: complete(&vub300->irqpoll_complete);
drivers/mmc/host/vub300.c-473- }
--
drivers/mmc/host/vub300.c-477-
drivers/mmc/host/vub300.c:478:static void send_irqpoll(struct vub300_mmc_host *vub300)
drivers/mmc/host/vub300.c-479-{
drivers/mmc/host/vub300.c:480: /* cmd_mutex is held by vub300_pollwork_thread */
drivers/mmc/host/vub300.c-481- int retval;
drivers/mmc/host/vub300.c-482- int timeout = 0xFFFF & (0x0001FFFF - firmware_irqpoll_timeout);
drivers/mmc/host/vub300.c:483: vub300->cmnd.poll.header_size = 22;
drivers/mmc/host/vub300.c:484: vub300->cmnd.poll.header_type = 1;
drivers/mmc/host/vub300.c:485: vub300->cmnd.poll.port_number = 0;
drivers/mmc/host/vub300.c:486: vub300->cmnd.poll.command_type = 2;
drivers/mmc/host/vub300.c:487: vub300->cmnd.poll.poll_timeout_lsb = 0xFF & (unsigned)timeout;
drivers/mmc/host/vub300.c:488: vub300->cmnd.poll.poll_timeout_msb = 0xFF & (unsigned)(timeout >> 8);
drivers/mmc/host/vub300.c:489: usb_fill_bulk_urb(vub300->command_out_urb, vub300->udev,
drivers/mmc/host/vub300.c:490: usb_sndbulkpipe(vub300->udev, vub300->cmnd_out_ep)
drivers/mmc/host/vub300.c:491: , &vub300->cmnd, sizeof(vub300->cmnd)
drivers/mmc/host/vub300.c:492: , irqpoll_out_completed, vub300);
drivers/mmc/host/vub300.c:493: retval = usb_submit_urb(vub300->command_out_urb, GFP_KERNEL);
drivers/mmc/host/vub300.c-494- if (0 > retval) {
drivers/mmc/host/vub300.c:495: vub300->usb_transport_fail = retval;
drivers/mmc/host/vub300.c:496: vub300_queue_poll_work(vub300, 1);
drivers/mmc/host/vub300.c:497: complete(&vub300->irqpoll_complete);
drivers/mmc/host/vub300.c-498- return;
--
drivers/mmc/host/vub300.c-503-
drivers/mmc/host/vub300.c:504:static void new_system_port_status(struct vub300_mmc_host *vub300)
drivers/mmc/host/vub300.c-505-{
drivers/mmc/host/vub300.c:506: int old_card_present = vub300->card_present;
drivers/mmc/host/vub300.c-507- int new_card_present =
drivers/mmc/host/vub300.c:508: (0x0001 & vub300->system_port_status.port_flags) ? 1 : 0;
drivers/mmc/host/vub300.c:509: vub300->read_only =
drivers/mmc/host/vub300.c:510: (0x0010 & vub300->system_port_status.port_flags) ? 1 : 0;
drivers/mmc/host/vub300.c-511- if (new_card_present && !old_card_present) {
drivers/mmc/host/vub300.c:512: dev_info(&vub300->udev->dev, "card just inserted\n");
drivers/mmc/host/vub300.c:513: vub300->card_present = 1;
drivers/mmc/host/vub300.c:514: vub300->bus_width = 0;
drivers/mmc/host/vub300.c-515- if (disable_offload_processing)
drivers/mmc/host/vub300.c:516: strscpy(vub300->vub_name, "EMPTY Processing Disabled",
drivers/mmc/host/vub300.c:517: sizeof(vub300->vub_name));
drivers/mmc/host/vub300.c-518- else
drivers/mmc/host/vub300.c:519: vub300->vub_name[0] = 0;
drivers/mmc/host/vub300.c:520: mmc_detect_change(vub300->mmc, 1);
drivers/mmc/host/vub300.c-521- } else if (!new_card_present && old_card_present) {
drivers/mmc/host/vub300.c:522: dev_info(&vub300->udev->dev, "card just ejected\n");
drivers/mmc/host/vub300.c:523: vub300->card_present = 0;
drivers/mmc/host/vub300.c:524: mmc_detect_change(vub300->mmc, 0);
drivers/mmc/host/vub300.c-525- } else {
--
drivers/mmc/host/vub300.c-529-
drivers/mmc/host/vub300.c:530:static void __add_offloaded_reg_to_fifo(struct vub300_mmc_host *vub300,
drivers/mmc/host/vub300.c-531- struct offload_registers_access
--
drivers/mmc/host/vub300.c-533-{
drivers/mmc/host/vub300.c:534: u8 r = vub300->fn[func].offload_point + vub300->fn[func].offload_count;
drivers/mmc/host/vub300.c:535: memcpy(&vub300->fn[func].reg[MAXREGMASK & r], register_access,
drivers/mmc/host/vub300.c-536- sizeof(struct offload_registers_access));
drivers/mmc/host/vub300.c:537: vub300->fn[func].offload_count += 1;
drivers/mmc/host/vub300.c:538: vub300->total_offload_count += 1;
drivers/mmc/host/vub300.c-539-}
drivers/mmc/host/vub300.c-540-
drivers/mmc/host/vub300.c:541:static void add_offloaded_reg(struct vub300_mmc_host *vub300,
drivers/mmc/host/vub300.c-542- struct offload_registers_access *register_access)
--
drivers/mmc/host/vub300.c-547- u8 func = ((0x70 & register_access->command_byte[0]) >> 4);
drivers/mmc/host/vub300.c:548: u8 regs = vub300->dynamic_register_count;
drivers/mmc/host/vub300.c-549- u8 i = 0;
drivers/mmc/host/vub300.c:550: while (0 < regs-- && 1 == vub300->sdio_register[i].activate) {
drivers/mmc/host/vub300.c:551: if (vub300->sdio_register[i].func_num == func &&
drivers/mmc/host/vub300.c:552: vub300->sdio_register[i].sdio_reg == Register) {
drivers/mmc/host/vub300.c:553: if (vub300->sdio_register[i].prepared == 0)
drivers/mmc/host/vub300.c:554: vub300->sdio_register[i].prepared = 1;
drivers/mmc/host/vub300.c:555: vub300->sdio_register[i].response =
drivers/mmc/host/vub300.c-556- register_access->Respond_Byte[2];
drivers/mmc/host/vub300.c:557: vub300->sdio_register[i].regvalue =
drivers/mmc/host/vub300.c-558- register_access->Respond_Byte[3];
--
drivers/mmc/host/vub300.c-564- }
drivers/mmc/host/vub300.c:565: __add_offloaded_reg_to_fifo(vub300, register_access, func);
drivers/mmc/host/vub300.c-566-}
drivers/mmc/host/vub300.c-567-
drivers/mmc/host/vub300.c:568:static void check_vub300_port_status(struct vub300_mmc_host *vub300)
drivers/mmc/host/vub300.c-569-{
drivers/mmc/host/vub300.c-570- /*
drivers/mmc/host/vub300.c:571: * cmd_mutex is held by vub300_pollwork_thread,
drivers/mmc/host/vub300.c:572: * vub300_deadwork_thread or vub300_cmndwork_thread
drivers/mmc/host/vub300.c-573- */
--
drivers/mmc/host/vub300.c-575- retval =
drivers/mmc/host/vub300.c:576: usb_control_msg(vub300->udev, usb_rcvctrlpipe(vub300->udev, 0),
drivers/mmc/host/vub300.c-577- GET_SYSTEM_PORT_STATUS,
drivers/mmc/host/vub300.c-578- USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
drivers/mmc/host/vub300.c:579: 0x0000, 0x0000, &vub300->system_port_status,
drivers/mmc/host/vub300.c:580: sizeof(vub300->system_port_status), 1000);
drivers/mmc/host/vub300.c:581: if (sizeof(vub300->system_port_status) == retval)
drivers/mmc/host/vub300.c:582: new_system_port_status(vub300);
drivers/mmc/host/vub300.c-583-}
drivers/mmc/host/vub300.c-584-
drivers/mmc/host/vub300.c:585:static void __vub300_irqpoll_response(struct vub300_mmc_host *vub300)
drivers/mmc/host/vub300.c-586-{
drivers/mmc/host/vub300.c:587: /* cmd_mutex is held by vub300_pollwork_thread */
drivers/mmc/host/vub300.c:588: if (vub300->command_res_urb->actual_length == 0)
drivers/mmc/host/vub300.c-589- return;
drivers/mmc/host/vub300.c-590-
drivers/mmc/host/vub300.c:591: switch (vub300->resp.common.header_type) {
drivers/mmc/host/vub300.c-592- case RESPONSE_INTERRUPT:
drivers/mmc/host/vub300.c:593: mutex_lock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c:594: if (vub300->irq_enabled)
drivers/mmc/host/vub300.c:595: mmc_signal_sdio_irq(vub300->mmc);
drivers/mmc/host/vub300.c-596- else
drivers/mmc/host/vub300.c:597: vub300->irqs_queued += 1;
drivers/mmc/host/vub300.c:598: vub300->irq_disabled = 1;
drivers/mmc/host/vub300.c:599: mutex_unlock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c-600- break;
drivers/mmc/host/vub300.c-601- case RESPONSE_ERROR:
drivers/mmc/host/vub300.c:602: if (vub300->resp.error.error_code == SD_ERROR_NO_DEVICE)
drivers/mmc/host/vub300.c:603: check_vub300_port_status(vub300);
drivers/mmc/host/vub300.c-604- break;
drivers/mmc/host/vub300.c-605- case RESPONSE_STATUS:
drivers/mmc/host/vub300.c:606: vub300->system_port_status = vub300->resp.status;
drivers/mmc/host/vub300.c:607: new_system_port_status(vub300);
drivers/mmc/host/vub300.c:608: if (!vub300->card_present)
drivers/mmc/host/vub300.c:609: vub300_queue_poll_work(vub300, HZ / 5);
drivers/mmc/host/vub300.c-610- break;
--
drivers/mmc/host/vub300.c-612- {
drivers/mmc/host/vub300.c:613: int offloaded_data_length = vub300->resp.common.header_size - 3;
drivers/mmc/host/vub300.c-614- int register_count = offloaded_data_length >> 3;
--
drivers/mmc/host/vub300.c-616- while (register_count--) {
drivers/mmc/host/vub300.c:617: add_offloaded_reg(vub300, &vub300->resp.irq.reg[ri]);
drivers/mmc/host/vub300.c-618- ri += 1;
drivers/mmc/host/vub300.c-619- }
drivers/mmc/host/vub300.c:620: mutex_lock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c:621: if (vub300->irq_enabled)
drivers/mmc/host/vub300.c:622: mmc_signal_sdio_irq(vub300->mmc);
drivers/mmc/host/vub300.c-623- else
drivers/mmc/host/vub300.c:624: vub300->irqs_queued += 1;
drivers/mmc/host/vub300.c:625: vub300->irq_disabled = 1;
drivers/mmc/host/vub300.c:626: mutex_unlock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c-627- break;
--
drivers/mmc/host/vub300.c-630- {
drivers/mmc/host/vub300.c:631: int offloaded_data_length = vub300->resp.common.header_size - 3;
drivers/mmc/host/vub300.c-632- int register_count = offloaded_data_length >> 3;
--
drivers/mmc/host/vub300.c-634- while (register_count--) {
drivers/mmc/host/vub300.c:635: add_offloaded_reg(vub300, &vub300->resp.irq.reg[ri]);
drivers/mmc/host/vub300.c-636- ri += 1;
drivers/mmc/host/vub300.c-637- }
drivers/mmc/host/vub300.c:638: mutex_lock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c:639: if (vub300->irq_enabled)
drivers/mmc/host/vub300.c:640: mmc_signal_sdio_irq(vub300->mmc);
drivers/mmc/host/vub300.c-641- else
drivers/mmc/host/vub300.c:642: vub300->irqs_queued += 1;
drivers/mmc/host/vub300.c:643: vub300->irq_disabled = 0;
drivers/mmc/host/vub300.c:644: mutex_unlock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c-645- break;
--
drivers/mmc/host/vub300.c-647- case RESPONSE_NO_INTERRUPT:
drivers/mmc/host/vub300.c:648: vub300_queue_poll_work(vub300, 1);
drivers/mmc/host/vub300.c-649- break;
--
drivers/mmc/host/vub300.c-654-
drivers/mmc/host/vub300.c:655:static void __do_poll(struct vub300_mmc_host *vub300)
drivers/mmc/host/vub300.c-656-{
drivers/mmc/host/vub300.c:657: /* cmd_mutex is held by vub300_pollwork_thread */
drivers/mmc/host/vub300.c-658- unsigned long commretval;
drivers/mmc/host/vub300.c:659: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
drivers/mmc/host/vub300.c:660: init_completion(&vub300->irqpoll_complete);
drivers/mmc/host/vub300.c:661: send_irqpoll(vub300);
drivers/mmc/host/vub300.c:662: commretval = wait_for_completion_timeout(&vub300->irqpoll_complete,
drivers/mmc/host/vub300.c-663- msecs_to_jiffies(500));
drivers/mmc/host/vub300.c:664: if (vub300->usb_transport_fail) {
drivers/mmc/host/vub300.c-665- /* no need to do anything */
drivers/mmc/host/vub300.c-666- } else if (commretval == 0) {
drivers/mmc/host/vub300.c:667: vub300->usb_timed_out = 1;
drivers/mmc/host/vub300.c:668: usb_kill_urb(vub300->command_out_urb);
drivers/mmc/host/vub300.c:669: usb_kill_urb(vub300->command_res_urb);
drivers/mmc/host/vub300.c-670- } else { /* commretval > 0 */
drivers/mmc/host/vub300.c:671: __vub300_irqpoll_response(vub300);
drivers/mmc/host/vub300.c-672- }
--
drivers/mmc/host/vub300.c-677- */
drivers/mmc/host/vub300.c:678:static void vub300_pollwork_thread(struct work_struct *work)
drivers/mmc/host/vub300.c-679-{ /* NOT irq */
drivers/mmc/host/vub300.c:680: struct vub300_mmc_host *vub300 = container_of(work,
drivers/mmc/host/vub300.c:681: struct vub300_mmc_host, pollwork.work);
drivers/mmc/host/vub300.c:682: if (!vub300->interface) {
drivers/mmc/host/vub300.c:683: kref_put(&vub300->kref, vub300_delete);
drivers/mmc/host/vub300.c-684- return;
drivers/mmc/host/vub300.c-685- }
drivers/mmc/host/vub300.c:686: mutex_lock(&vub300->cmd_mutex);
drivers/mmc/host/vub300.c:687: if (vub300->cmd) {
drivers/mmc/host/vub300.c:688: vub300_queue_poll_work(vub300, 1);
drivers/mmc/host/vub300.c:689: } else if (!vub300->card_present) {
drivers/mmc/host/vub300.c-690- /* no need to do anything */
drivers/mmc/host/vub300.c:691: } else { /* vub300->card_present */
drivers/mmc/host/vub300.c:692: mutex_lock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c:693: if (!vub300->irq_enabled) {
drivers/mmc/host/vub300.c:694: mutex_unlock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c:695: } else if (vub300->irqs_queued) {
drivers/mmc/host/vub300.c:696: vub300->irqs_queued -= 1;
drivers/mmc/host/vub300.c:697: mmc_signal_sdio_irq(vub300->mmc);
drivers/mmc/host/vub300.c:698: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
drivers/mmc/host/vub300.c:699: mutex_unlock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c:700: } else { /* NOT vub300->irqs_queued */
drivers/mmc/host/vub300.c:701: mutex_unlock(&vub300->irq_mutex);
drivers/mmc/host/vub300.c:702: __do_poll(vub300);
drivers/mmc/host/vub300.c-703- }
drivers/mmc/host/vub300.c-704- }
drivers/mmc/host/vub300.c:705: mutex_unlock(&vub300->cmd_mutex);
drivers/mmc/host/vub300.c:706: kref_put(&vub300->kref, vub300_delete);
drivers/mmc/host/vub300.c-707-}
drivers/mmc/host/vub300.c-708-
drivers/mmc/host/vub300.c:709:static void vub300_deadwork_thread(struct work_struct *work)
drivers/mmc/host/vub300.c-710-{ /* NOT irq */
drivers/mmc/host/vub300.c:711: struct vub300_mmc_host *vub300 =
drivers/mmc/host/vub300.c:712: container_of(work, struct vub300_mmc_host, deadwork);
drivers/mmc/host/vub300.c:713: if (!vub300->interface) {
drivers/mmc/host/vub300.c:714: kref_put(&vub300->kref, vub300_delete);
drivers/mmc/host/vub300.c-715- return;
drivers/mmc/host/vub300.c-716- }
drivers/mmc/host/vub300.c:717: mutex_lock(&vub300->cmd_mutex);
drivers/mmc/host/vub300.c:718: if (vub300->cmd) {
drivers/mmc/host/vub300.c-719- /*
--
drivers/mmc/host/vub300.c-724- */
drivers/mmc/host/vub300.c:725: } else if (vub300->card_present) {
drivers/mmc/host/vub300.c:726: check_vub300_port_status(vub300);
drivers/mmc/host/vub300.c:727: } else if (vub300->mmc && vub300->mmc->card) {
drivers/mmc/host/vub300.c-728- /*
--
drivers/mmc/host/vub300.c-734- } else {
drivers/mmc/host/vub300.c:735: check_vub300_port_status(vub300);
drivers/mmc/host/vub300.c-736- }
drivers/mmc/host/vub300.c:737: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
drivers/mmc/host/vub300.c:738: mutex_unlock(&vub300->cmd_mutex);
drivers/mmc/host/vub300.c:739: kref_put(&vub300->kref, vub300_delete);
drivers/mmc/host/vub300.c-740-}
drivers/mmc/host/vub300.c-741-
drivers/mmc/host/vub300.c:742:static void vub300_inactivity_timer_expired(struct timer_list *t)
drivers/mmc/host/vub300.c-743-{ /* softirq */
drivers/mmc/host/vub300.c:744: struct vub300_mmc_host *vub300 = timer_container_of(vub300, t,
drivers/mmc/host/vub300.c-745- inactivity_timer);
drivers/mmc/host/vub300.c:746: if (!vub300->interface) {
drivers/mmc/host/vub300.c:747: kref_put(&vub300->kref, vub300_delete);
drivers/mmc/host/vub300.c:748: } else if (vub300->cmd) {
drivers/mmc/host/vub300.c:749: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
drivers/mmc/host/vub300.c-750- } else {
drivers/mmc/host/vub300.c:751: vub300_queue_dead_work(vub300);
drivers/mmc/host/vub300.c:752: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
drivers/mmc/host/vub300.c-753- }
--
drivers/mmc/host/vub300.c-755-
drivers/mmc/host/vub300.c:756:static int vub300_response_error(u8 error_code)
drivers/mmc/host/vub300.c-757-{
--
drivers/mmc/host/vub300.c=792=static void command_res_completed(struct urb *urb)
drivers/mmc/host/vub300.c-793-{ /* urb completion handler - hardirq */
drivers/mmc/host/vub300.c:794: struct vub300_mmc_host *vub300 = (struct vub300_mmc_host *)urb->context;
drivers/mmc/host/vub300.c-795- if (urb->status) {
drivers/mmc/host/vub300.c-796- /* we have to let the initiator handle the error */
drivers/mmc/host/vub300.c:797: } else if (vub300->command_res_urb->actual_length == 0) {
drivers/mmc/host/vub300.c-798- /*
--
drivers/mmc/host/vub300.c-801- */
drivers/mmc/host/vub300.c:802: } else if (!vub300->data) {
drivers/mmc/host/vub300.c-803- /* this means that the command (typically CMD52) succeeded */
drivers/mmc/host/vub300.c:804: } else if (vub300->resp.common.header_type != 0x02) {
drivers/mmc/host/vub300.c-805- /*
--
drivers/mmc/host/vub300.c-808- */
drivers/mmc/host/vub300.c:809: } else if (vub300->urb) {
drivers/mmc/host/vub300.c:810: vub300->cmd->error =
drivers/mmc/host/vub300.c:811: vub300_response_error(vub300->resp.error.error_code);
drivers/mmc/host/vub300.c:812: usb_unlink_urb(vub300->urb);
drivers/mmc/host/vub300.c-813- } else {
drivers/mmc/host/vub300.c:814: vub300->cmd->error =
drivers/mmc/host/vub300.c:815: vub300_response_error(vub300->resp.error.error_code);
drivers/mmc/host/vub300.c:816: usb_sg_cancel(&vub300->sg_request);
drivers/mmc/host/vub300.c-817- }
drivers/mmc/host/vub300.c:818: complete(&vub300->command_complete); /* got_response_in */
drivers/mmc/host/vub300.c-819-}
--
drivers/mmc/host/vub300.c=821=static void command_out_completed(struct urb *urb)
drivers/mmc/host/vub300.c-822-{ /* urb completion handler - hardirq */
drivers/mmc/host/vub300.c:823: struct vub300_mmc_host *vub300 = (struct vub300_mmc_host *)urb->context;
drivers/mmc/host/vub300.c-824- if (urb->status) {
drivers/mmc/host/vub300.c:825: complete(&vub300->command_complete);
drivers/mmc/host/vub300.c-826- } else {
--
drivers/mmc/host/vub300.c-828- unsigned int pipe =
drivers/mmc/host/vub300.c:829: usb_rcvbulkpipe(vub300->udev, vub300->cmnd_res_ep);
drivers/mmc/host/vub300.c:830: usb_fill_bulk_urb(vub300->command_res_urb, vub300->udev, pipe,
drivers/mmc/host/vub300.c:831: &vub300->resp, sizeof(vub300->resp),
drivers/mmc/host/vub300.c:832: command_res_completed, vub300);
drivers/mmc/host/vub300.c:833: vub300->command_res_urb->actual_length = 0;
drivers/mmc/host/vub300.c:834: ret = usb_submit_urb(vub300->command_res_urb, GFP_ATOMIC);
drivers/mmc/host/vub300.c-835- if (ret == 0) {
--
drivers/mmc/host/vub300.c-844- */
drivers/mmc/host/vub300.c:845: complete(&vub300->command_complete);
drivers/mmc/host/vub300.c-846- }
--
drivers/mmc/host/vub300.c-852- */
drivers/mmc/host/vub300.c:853:static void snoop_block_size_and_bus_width(struct vub300_mmc_host *vub300,
drivers/mmc/host/vub300.c-854- u32 cmd_arg)
--
drivers/mmc/host/vub300.c-856- if ((0xFBFFFE00 & cmd_arg) == 0x80022200)
drivers/mmc/host/vub300.c:857: vub300->fbs[1] = (cmd_arg << 8) | (0x00FF & vub300->fbs[1]);
drivers/mmc/host/vub300.c-858- else if ((0xFBFFFE00 & cmd_arg) == 0x80022000)
drivers/mmc/host/vub300.c:859: vub300->fbs[1] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[1]);
drivers/mmc/host/vub300.c-860- else if ((0xFBFFFE00 & cmd_arg) == 0x80042200)
drivers/mmc/host/vub300.c:861: vub300->fbs[2] = (cmd_arg << 8) | (0x00FF & vub300->fbs[2]);
drivers/mmc/host/vub300.c-862- else if ((0xFBFFFE00 & cmd_arg) == 0x80042000)
drivers/mmc/host/vub300.c:863: vub300->fbs[2] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[2]);
drivers/mmc/host/vub300.c-864- else if ((0xFBFFFE00 & cmd_arg) == 0x80062200)
drivers/mmc/host/vub300.c:865: vub300->fbs[3] = (cmd_arg << 8) | (0x00FF & vub300->fbs[3]);
drivers/mmc/host/vub300.c-866- else if ((0xFBFFFE00 & cmd_arg) == 0x80062000)
drivers/mmc/host/vub300.c:867: vub300->fbs[3] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[3]);
drivers/mmc/host/vub300.c-868- else if ((0xFBFFFE00 & cmd_arg) == 0x80082200)
drivers/mmc/host/vub300.c:869: vub300->fbs[4] = (cmd_arg << 8) | (0x00FF & vub300->fbs[4]);
drivers/mmc/host/vub300.c-870- else if ((0xFBFFFE00 & cmd_arg) == 0x80082000)
drivers/mmc/host/vub300.c:871: vub300->fbs[4] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[4]);
drivers/mmc/host/vub300.c-872- else if ((0xFBFFFE00 & cmd_arg) == 0x800A2200)
drivers/mmc/host/vub300.c:873: vub300->fbs[5] = (cmd_arg << 8) | (0x00FF & vub300->fbs[5]);
drivers/mmc/host/vub300.c-874- else if ((0xFBFFFE00 & cmd_arg) == 0x800A2000)
drivers/mmc/host/vub300.c:875: vub300->fbs[5] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[5]);
drivers/mmc/host/vub300.c-876- else if ((0xFBFFFE00 & cmd_arg) == 0x800C2200)
drivers/mmc/host/vub300.c:877: vub300->fbs[6] = (cmd_arg << 8) | (0x00FF & vub300->fbs[6]);
drivers/mmc/host/vub300.c-878- else if ((0xFBFFFE00 & cmd_arg) == 0x800C2000)
drivers/mmc/host/vub300.c:879: vub300->fbs[6] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[6]);
drivers/mmc/host/vub300.c-880- else if ((0xFBFFFE00 & cmd_arg) == 0x800E2200)
drivers/mmc/host/vub300.c:881: vub300->fbs[7] = (cmd_arg << 8) | (0x00FF & vub300->fbs[7]);
drivers/mmc/host/vub300.c-882- else if ((0xFBFFFE00 & cmd_arg) == 0x800E2000)
drivers/mmc/host/vub300.c:883: vub300->fbs[7] = (0xFF & cmd_arg) | (0xFF00 & vub300->fbs[7]);
drivers/mmc/host/vub300.c-884- else if ((0xFBFFFE03 & cmd_arg) == 0x80000E00)
drivers/mmc/host/vub300.c:885: vub300->bus_width = 1;
drivers/mmc/host/vub300.c-886- else if ((0xFBFFFE03 & cmd_arg) == 0x80000E02)
drivers/mmc/host/vub300.c:887: vub300->bus_width = 4;
drivers/mmc/host/vub300.c-888-}
drivers/mmc/host/vub300.c-889-
drivers/mmc/host/vub300.c:890:static void send_command(struct vub300_mmc_host *vub300)
drivers/mmc/host/vub300.c-891-{
drivers/mmc/host/vub300.c:892: /* cmd_mutex is held by vub300_cmndwork_thread */
drivers/mmc/host/vub300.c:893: struct mmc_command *cmd = vub300->cmd;
drivers/mmc/host/vub300.c:894: struct mmc_data *data = vub300->data;
drivers/mmc/host/vub300.c-895- int retval;
--
drivers/mmc/host/vub300.c-897- u8 response_type;
drivers/mmc/host/vub300.c:898: if (vub300->app_spec) {
drivers/mmc/host/vub300.c-899- switch (cmd->opcode) {
--
drivers/mmc/host/vub300.c-901- response_type = SDRT_1;
drivers/mmc/host/vub300.c:902: vub300->resp_len = 6;
drivers/mmc/host/vub300.c-903- if (0x00000000 == (0x00000003 & cmd->arg))
drivers/mmc/host/vub300.c:904: vub300->bus_width = 1;
drivers/mmc/host/vub300.c-905- else if (0x00000002 == (0x00000003 & cmd->arg))
drivers/mmc/host/vub300.c:906: vub300->bus_width = 4;
drivers/mmc/host/vub300.c-907- else
drivers/mmc/host/vub300.c:908: dev_err(&vub300->udev->dev,
drivers/mmc/host/vub300.c-909- "unexpected ACMD6 bus_width=%d\n",
--
drivers/mmc/host/vub300.c-913- response_type = SDRT_1;
drivers/mmc/host/vub300.c:914: vub300->resp_len = 6;
drivers/mmc/host/vub300.c-915- break;
--
drivers/mmc/host/vub300.c-917- response_type = SDRT_1;
drivers/mmc/host/vub300.c:918: vub300->resp_len = 6;
drivers/mmc/host/vub300.c-919- break;
--
drivers/mmc/host/vub300.c-921- response_type = SDRT_1;
drivers/mmc/host/vub300.c:922: vub300->resp_len = 6;
drivers/mmc/host/vub300.c-923- break;
--
drivers/mmc/host/vub300.c-925- response_type = SDRT_3;
drivers/mmc/host/vub300.c:926: vub300->resp_len = 6;
drivers/mmc/host/vub300.c-927- break;
--
drivers/mmc/host/vub300.c-929- response_type = SDRT_1;
drivers/mmc/host/vub300.c:930: vub300->resp_len = 6;
drivers/mmc/host/vub300.c-931- break;
--
drivers/mmc/host/vub300.c-933- response_type = SDRT_1;
drivers/mmc/host/vub300.c:934: vub300->resp_len = 6;
drivers/mmc/host/vub300.c-935- break;
--
drivers/mmc/host/vub300.c-937- response_type = SDRT_1;
drivers/mmc/host/vub300.c:938: vub300->resp_len = 6;
drivers/mmc/host/vub300.c-939- break;
]
|
| 8/2 |
2026/09/06 00:42 |
llm |
expert |
0m
Model:
Tokens:
input: 32727
output: 50
thoughts: 25
Thoughts: Okay, here's my take on those thoughts, framed as an expert's internal monologue:
**Investigating the Inactivity Timer**
Alright, the system's flagged `vub300_inactivity_timer_expired`. Time to dig in. That function name seems pretty specific, so it should lead me directly to the inactivity timer's core logic. Let's see what's happening. I need to understand what's triggered the expiration and what consequences it's having. From there, I can determine if this is a legitimate condition, a bug, or just a misconfiguration. First, Iβll want to review how the `vub300` device is supposed to handle inactivity, where the timer is set and reset, and what processes are dependent upon this timer's state. I'll need to look at any logging or error messages associated with this function to see if they offer any clues about the cause.
|
| 9/2 |
2026/09/06 00:42 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/mmc/host/vub300.c Name:vub300_inactivity_timer_expired]
Results: map[SourceCode: 742: static void vub300_inactivity_timer_expired(struct timer_list *t)
743: { /* softirq */
744: struct vub300_mmc_host *vub300 = timer_container_of(vub300, t,
745: inactivity_timer);
746: if (!vub300->interface) {
747: kref_put(&vub300->kref, vub300_delete);
748: } else if (vub300->cmd) {
749: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
750: } else {
751: vub300_queue_dead_work(vub300);
752: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
753: }
754: }
SourceFile:drivers/mmc/host/vub300.c]
|
| 10/2 |
2026/09/06 00:42 |
llm |
expert |
0m
Model:
Tokens:
input: 33309
output: 45
thoughts: 42
Thoughts: Okay, here's my interpretation of that thought process, tailored for an expert audience, and written in the first person:
**Analyzing the Resource Deallocation in the Timer Callback**
Right, the timer function is calling `kref_put(&vub300->kref, vub300_delete)`. That immediately tells me we're using a kref-based resource management scheme for this `vub300` structure. The timer is effectively saying, "I'm done with my use of this resource; potentially decrement the reference count." Now, the crucial part is understanding what `vub300_delete` actually *does*. The `kref_put` function itself is straightforward: if the reference count hits zero, it invokes the destructor, which is `vub300_delete` in this case. So, my next logical step is to dive into the implementation of `vub300_delete`. I need to ensure that it correctly handles *all* aspects of releasing the `vub300`'s resources. Are we freeing the associated memory? Are we unregistering any devices or deregistering any callbacks? Are we properly shutting down any hardware interactions? I need to be sure the deletion function is safe, especially in a timing-sensitive context. I'm essentially going to be looking for potential double-free issues, use-after-free scenarios, or any other race conditions that might arise if multiple threads or processes are interacting with `vub300` concurrently. Checking that `vub300_delete` is properly handling any potentially shared state will be key. This is a critical point in the lifetime of this resource, so I want to know exactly what's happening.
|
| 11/2 |
2026/09/06 00:42 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/mmc/host/vub300.c Name:vub300_delete]
Results: map[SourceCode: 369: static void vub300_delete(struct kref *kref)
370: { /* kref callback - softirq */
371: struct vub300_mmc_host *vub300 = kref_to_vub300_mmc_host(kref);
372: struct mmc_host *mmc = vub300->mmc;
373:
374: usb_free_urb(vub300->command_out_urb);
375: vub300->command_out_urb = NULL;
376: usb_free_urb(vub300->command_res_urb);
377: vub300->command_res_urb = NULL;
378: usb_put_dev(vub300->udev);
379: mmc_free_host(mmc);
380: /*
381: * and hence also frees vub300
382: * which is contained at the end of struct mmc
383: */
384: }
SourceFile:drivers/mmc/host/vub300.c]
|
| 12/2 |
2026/09/06 00:42 |
llm |
expert |
0m
Model:
Tokens:
input: 34110
output: 40
thoughts: 27
Thoughts: Here's my take on the thought process, as if it were my own:
**Analyzing the MMC Host Release**
Okay, so `mmc_free_host(mmc)` has been called. That's the signal to start untangling things, to gracefully shut down the MMC host. Time to dig in and really understand what's happening under the hood. I need to trace this function meticulously. Where does it start, what are its dependencies, and crucially, what resources is it releasing? This isn't just about freeing memory; it's about cleaning up the entire state of the MMC interface. Think interrupts, DMA channels, power control, the whole shebang. Gotta make sure we're not leaving any dangling pointers or triggering any unexpected side effects. Proper MMC host shutdown is critical for system stability. Let's see what `mmc_free_host` reveals.
|
| 13/2 |
2026/09/06 00:42 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/mmc/core/host.c Name:mmc_free_host]
Results: map[SourceCode: 692: /**
693: * mmc_free_host - free the host structure
694: * @host: mmc host
695: *
696: * Free the host once all references to it have been dropped.
697: */
698: void mmc_free_host(struct mmc_host *host)
699: {
700: cancel_delayed_work_sync(&host->detect);
701: mmc_pwrseq_free(host);
702: put_device(&host->class_dev);
703: }
SourceFile:drivers/mmc/core/host.c]
|
| 14/2 |
2026/09/06 00:42 |
llm |
expert |
0m
Model:
Tokens:
input: 34569
output: 43
thoughts: 54
Thoughts: Here's my take on the situation:
**Refcount Shenanigans and Device Lifecycle**
Okay, so I'm looking at this code and I see `put_device(&host->class_dev)`. Right away, that tells me we're dealing with reference counting. It means the system's tracking how many entities are *using* a particular device, in this case, the `class_dev` associated with the host. And `put_device` is the call that *decrements* that count. Effectively, it's saying, "I'm done with my use of this device."
The important bit is what happens *after* that decrement. The whole point of reference counting is to manage the lifecycle of the device. So, when that refcount hits zero β meaning *no one* is holding a reference to the device anymore β the system will trigger `device_release`. This is the signal that the device can safely be cleaned up.
And from what I can see, `device_release` in this context directly calls `mmc_host_classdev_release`. That's the specific device release function for this `mmc_host` device. So it's probably going to handle all the MMC-specific cleanup, resource deallocation, potentially power-down sequences, and any other teardown tasks that are necessary to fully relinquish the device. This is the last call before the device structure is deallocated, I would assume. The order of operations is crucial here, too. I need to be sure the system handles power down before the device is released.
|
| 15/2 |
2026/09/06 00:42 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/mmc/core/host.c Name:mmc_host_classdev_release]
Results: map[SourceCode: 66: static void mmc_host_classdev_release(struct device *dev)
67: {
68: struct mmc_host *host = cls_dev_to_mmc_host(dev);
69: wakeup_source_unregister(host->ws);
70: if (of_alias_get_id(host->parent->of_node, "mmc") < 0)
71: ida_free(&mmc_host_ida, host->index);
72: kfree(host);
73: }
SourceFile:drivers/mmc/core/host.c]
|
| 16/2 |
2026/09/06 00:42 |
llm |
expert |
0m
Model:
Tokens:
input: 35175
output: 38
thoughts: 22
Thoughts: Here's my take on those thoughts, tailored for an expert audience:
**Unregistering the Wakeup Source: A Trace Begins**
Alright, the system's calling `wakeup_source_unregister`. Time to get a handle on what's happening. I need to dive into the core implementation of `wakeup_source_unregister`. This is where the magic happens β or, potentially, where things go sideways. I'm thinking about the implications of this unregistration: resource cleanup, state changes, potential race conditions... What's the context? What wakeup source is being targeted? Is this part of a graceful shutdown, a dynamic reconfiguration, or something else entirely? The trace starts now. Let's see how the kernel is handling the removal of this wakeup source, and what dependencies it might have. This is where the details really matter.
|
| 17/2 |
2026/09/06 00:42 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/base/power/wakeup.c Name:wakeup_source_unregister]
Results: map[SourceCode: 230: /**
231: * wakeup_source_unregister - Remove wakeup source from the list and remove it.
232: * @ws: Wakeup source object to unregister.
233: */
234: void wakeup_source_unregister(struct wakeup_source *ws)
235: {
236: if (ws) {
237: wakeup_source_remove(ws);
238: if (ws->dev)
239: wakeup_source_sysfs_remove(ws);
240:
241: wakeup_source_destroy(ws);
242: }
243: }
SourceFile:drivers/base/power/wakeup.c]
|
| 18/2 |
2026/09/06 00:42 |
llm |
expert |
0m
Model:
Tokens:
input: 35627
output: 38
thoughts: 10
Thoughts: Okay, here's my attempt at summarizing the thought process, as if it were my own, assuming I'm an expert in the field:
**Initializing the Shutdown Sequence**
Alright, the system's just triggered `wakeup_source_remove`. This means something has initiated a shutdown or a power-down event. I need to immediately start thinking about how to handle this gracefully. I have to think: what was the trigger? Was it a scheduled event, a user command, or a hardware failure signal? This initial call is the starting gun; the clock is ticking, and I need to assess the situation rapidly. I already know this means a resource is no longer going to be in an available state, and I need to plan for that. My first thought is: what dependencies are now broken and how can I deal with those broken dependencies? It is likely that other modules and components might need to know about this event, too, so informing them of the event will also be a priority. This initial trigger is very important, because it tells me that I need to begin planning for shutdown; I have to keep track of the steps involved in it, and make sure that this event's impact is well understood.
|
| 19/2 |
2026/09/06 00:43 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/base/power/wakeup.c Name:wakeup_source_remove]
Results: map[SourceCode: 181: /**
182: * wakeup_source_remove - Remove given object from the wakeup sources list.
183: * @ws: Wakeup source object to remove from the list.
184: */
185: static void wakeup_source_remove(struct wakeup_source *ws)
186: {
187: unsigned long flags;
188:
189: if (WARN_ON(!ws))
190: return;
191:
192: /*
193: * After shutting down the timer, wakeup_source_activate() will warn if
194: * the given wakeup source is passed to it.
195: */
196: timer_shutdown_sync(&ws->timer);
197:
198: raw_spin_lock_irqsave(&events_lock, flags);
199: list_del_rcu(&ws->entry);
200: raw_spin_unlock_irqrestore(&events_lock, flags);
201: synchronize_srcu(&wakeup_srcu);
202: }
SourceFile:drivers/base/power/wakeup.c]
|
| 20/2 |
2026/09/06 00:43 |
llm |
expert |
0m
Model:
Tokens:
input: 36266
output: 40
thoughts: 804
Thoughts: **Analyzing a Classic "Sleeping in Atomic Context" Bug**
Okay, here's what I'm seeing. `synchronize_srcu(&wakeup_srcu)` is getting called, which immediately sets off alarm bells. The problem is that `vub300_inactivity_timer_expired` is a timer callback, so it's running in softirq context. And *that's* the issue. `synchronize_srcu` is a sleeping function! That's a textbook "sleeping in atomic context" violation. The kernel's complaining with the classic "BUG: sleeping function called from invalid context" message, right there in `srcutree.c`. I can see the context: `in_atomic(): 1, irqs_disabled(): 0`.
So, tracing the call chain: `vub300_inactivity_timer_expired` calls `kref_put`, which goes through `mmc_free_host`, `put_device`, `mmc_host_classdev_release`, and finally hits `wakeup_source_unregister`, then `wakeup_source_remove`, and *bam!* we get to `synchronize_srcu`. This is a classic example of a function meant for sleeping being invoked from an interrupt context.
Now, the important question is: is this exploitable? Let's see... the `vub300` driver is accessible to unprivileged users. It's a USB driver, the `vub300_table` uses `USB_DEVICE(ELAN_VENDOR_ID, VUB300_PRODUCT_ID)`, so it can be triggered by plugging in a malicious USB device.
Typically, sleeping in atomic context leads to a warning and the kernel schedules. With `CONFIG_DEBUG_ATOMIC_SLEEP` enabled, we see the warning. Otherwise, it might just schedule, which can cause problems, but not memory corruption. However, `synchronize_srcu` blocks the current task until SRCU readers complete. Called from a softirq, it blocks softirq processing on that CPU. In this instance, `synchronize_srcu` calls `__synchronize_srcu`, which calls `wait_for_completion`. If in softirq, it schedules away, which is invalid because of interrupt stacks or disabled preemption. If preemption is disabled, scheduling will cause a warning, and likely a crash or deadlock.
So, is it privilege escalation? No. It's denial of service β a deadlock or crash, potentially.
But wait, there's more! The bug report also includes these debug object messages: "ODEBUG: object ffffc90000007a80 is NOT on stack" and several warnings. This is because `synchronize_srcu` might allocate something on the stack, or it could be related to using a debug object. This means this is going to get a little deeper. I'll need to check the `__synchronize_srcu` code directly to get a clearer picture of what's happening internally.
|
| 21/2 |
2026/09/06 00:43 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/rcu/srcutree.c Name:__synchronize_srcu]
Results: map[SourceCode:1455: /*
1456: * Helper function for synchronize_srcu() and synchronize_srcu_expedited().
1457: */
1458: static void __synchronize_srcu(struct srcu_struct *ssp, bool do_norm)
1459: {
1460: struct rcu_synchronize rcu;
1461:
1462: srcu_lock_sync(&ssp->dep_map);
1463:
1464: RCU_LOCKDEP_WARN(lockdep_is_held(ssp) ||
1465: lock_is_held(&rcu_bh_lock_map) ||
1466: lock_is_held(&rcu_lock_map) ||
1467: lock_is_held(&rcu_sched_lock_map),
1468: "Illegal synchronize_srcu() in same-type SRCU (or in RCU) read-side critical section");
1469:
1470: if (rcu_scheduler_active == RCU_SCHEDULER_INACTIVE)
1471: return;
1472: might_sleep();
1473: check_init_srcu_struct(ssp);
1474: init_completion(&rcu.completion);
1475: init_rcu_head_on_stack(&rcu.head);
1476: __call_srcu(ssp, &rcu.head, wakeme_after_rcu, do_norm);
1477: wait_for_completion(&rcu.completion);
1478: destroy_rcu_head_on_stack(&rcu.head);
1479:
1480: /*
1481: * Make sure that later code is ordered after the SRCU grace
1482: * period. This pairs with the raw_spin_lock_irq_rcu_node()
1483: * in srcu_invoke_callbacks(). Unlike Tree RCU, this is needed
1484: * because the current CPU might have been totally uninvolved with
1485: * (and thus unordered against) that grace period.
1486: */
1487: smp_mb();
1488: }
SourceFile:kernel/rcu/srcutree.c]
|
| 22/2 |
2026/09/06 00:43 |
llm |
expert |
0m
Model:
Tokens:
input: 38397
output: 45
thoughts: 2179
Thoughts: **Analysis of a Kernel Bug: Synchronization Issue in VUB300 Driver**
Okay, so here's what I've got. The kernel's complaining about an object not being on the stack when `init_rcu_head_on_stack` gets called, but I see the RCU head is allocated on the stack of `__synchronize_srcu`. This is tripping `debug_object_is_on_stack` because the code's running in softirq context on x86, which has a separate IRQ stack. The stack pointer check fails; not a critical problem, just a misleading warning.
The real problem lies in the `vub300` driver. Specifically, the `vub300_inactivity_timer_expired` function calls `kref_put`, which synchronously cleans up the device. This then calls `synchronize_srcu`, which *can* sleep. This is fundamentally wrong if called from a timer callback (softirq). The driver's `vub300_delete` function, as the `kref` callback, clearly shouldn't sleep.
Tracing the calls, it goes through `mmc_free_host`, which calls `put_device`, then `mmc_host_classdev_release`, which calls `wakeup_source_unregister`, and finally that triggers the problematic `synchronize_srcu`. The underlying issue is that either `wakeup_source_unregister` was introduced to call `synchronize_srcu` or the sleep of `synchronize_srcu` was introduced when there was previously no sleep.
The consequence is a sleep in an atomic context (softirq), leading to a crash. It causes a warning, and then it calls `wait_for_completion`, and then calls `schedule()` which cannot happen in softirq context. This violates the rules of the kernel scheduler. `schedule()` from an interrupt context will likely crash or lead to severe corruption.
Now, looking at the crash report from syzkaller, it's very informative. The stack trace shows the crash happens in `finish_task_switch`. The timer interrupt (softirq) happened *while* the task was in `finish_task_switch`. The crash is likely because `schedule()` is called within a softirq context. The timer interrupt occurred, the system called `__synchronize_srcu` (which calls `might_sleep()`), `init_rcu_head_on_stack`, and then it calls `wait_for_completion` which calls `schedule()`. Because of the softirq context the kernel crashes.
Is this exploitable for privilege escalation? No. It's a denial-of-service vulnerability. The kernel will crash.
How can one trigger this? It's a USB MMC host controller driver. The user needs to plug in a VUB300 USB device, or emulate one via `dummy_hcd` (usually requires root access). Syzkaller uses `dummy_hcd` to inject USB devices, which typically isn't accessible to unprivileged users unless there is a specific configuration allowing it. It's a peripheral trigger. No, this can't be triggered remotely or via a filesystem.
In short, it's a bug in how the `vub300` driver handles reference counting and synchronization within the timer callback, leading to a kernel panic when triggered.
|
| 23/2 |
2026/09/06 00:43 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/mmc/host/vub300.c Name:vub300_disconnect]
Results: map[SourceCode:2373: static void vub300_disconnect(struct usb_interface *interface)
2374: { /* NOT irq */
2375: struct vub300_mmc_host *vub300 = usb_get_intfdata(interface);
2376: if (!vub300 || !vub300->mmc) {
2377: return;
2378: } else {
2379: struct mmc_host *mmc = vub300->mmc;
2380: if (!vub300->mmc) {
2381: return;
2382: } else {
2383: int ifnum = interface_to_InterfaceNumber(interface);
2384: usb_set_intfdata(interface, NULL);
2385: /* prevent more I/O from starting */
2386: vub300->interface = NULL;
2387: mmc_remove_host(mmc);
2388: kref_put(&vub300->kref, vub300_delete);
2389: pr_info("USB vub300 remote SDIO host controller[%d]"
2390: " now disconnected", ifnum);
2391: return;
2392: }
2393: }
2394: }
SourceFile:drivers/mmc/host/vub300.c]
|
| 24/2 |
2026/09/06 00:43 |
llm |
expert |
0m
Model:
Tokens:
input: 41754
output: 29
thoughts: 1345
Thoughts: **Analyzing a USB Driver's Potential Denial-of-Service Vulnerability**
Okay, so I'm looking at this USB driver, and it seems like we have a pretty classic issue: a timer callback that's vulnerable to sleeping while holding resources, specifically a `DenialOfService` vulnerability. Here's the rundown of my thought process:
First, `vub300_disconnect` gets called when the USB device is disconnected. It nullifies the interface pointer (`vub300->interface = NULL`) and then decrements a kernel reference count (`kref_put`). The tricky part is the timer: if it's pending, it *could* run concurrently with or after `vub300_disconnect` returns. If it runs concurrently, the timer might see the null interface and calls `kref_put`. If that `kref_put` happens to be the last reference, the `vub300_delete` function gets called from the timer's softirq. That function ultimately calls `mmc_free_host`, which in turn calls `put_device`, which calls `mmc_host_classdev_release`, then `wakeup_source_unregister`, and finally `synchronize_srcu`.
The core of the problem here is that `synchronize_srcu` can sleep, and you *never* want to call a function that might sleep from a softirq context. That's a huge no-no. It doesn't look like we're dealing with memory corruption, just the incorrect use of a sleeping function inside a softirq context. This will probably trigger a warning, and ultimately lead to a crash because the kernel will try to schedule from softirq context, which is forbidden. It is not exploitable for privilege escalation.
Now, the important questions: Can an unprivileged user trigger this? My immediate thought is, no, USB drivers generally require a physical device or root-level access. You need to plug in something. So, by default, `PeripheralTrigger` is true, `Unprivileged` is false, and `Exploitable` is also false, while `DenialOfService` is true.
But wait, let's explore this. Could an unprivileged user exploit this without plugging anything in? Could it be if USB/IP is enabled? No, that also needs root. How about `dummy_hcd` or `raw-gadget`? Again, likely root. So, the trigger is pretty much strictly through physical access or root.
Okay, let's think bigger. What other triggers could exist? Not network-related, not filesystem-related. But, a VM guest... if a guest has the virtual USB device passed through and can control it, the guest can trigger the disconnect (e.g., if the guest can control the virtual USB hub). However, that just crashes the guest, not the host, but the question is more about whether a guest can cause the guest to crash, and yes, it does, but that's what the trigger is.
But is that the relevant definition? The definition is: "Determine if the bug can be triggered from the context of a typical KVM guest (e.g., set up by a QEMU VMM). Consider accesses to standard Linux host paravirtualized features (virtio-blk, virtio-net, etc.), and handling of VM exits in the KVM code."
This wording makes me think of guest-to-host escapes, or crashing the host. Since this is a USB driver, it isn't part of any of those. So, no, that isn't the real definition, so `VMGuestTrigger` is false.
Let me go back and review the memory management a bit closer. Is there a use-after-free issue here? Could `vub300_delete` free `vub300` before the timer is done with it? Wait, yes, it does! `vub300_delete` is responsible for freeing `vub300` via `mmc_free_host`, and the timer function checks if the interface pointer is NULL before doing `kref_put`, and if so, it calls `vub300_delete`. So, if the reference count goes to zero during disconnect, then `vub300` is freed. However, then the timer runs, and it accesses `vub300->interface` - that is a use-after-free!
But let's think this through. Does `vub300_disconnect` drop the last reference *before* the timer can run? Here's the critical bit: `vub300_disconnect` *doesn't* delete the timer. It nullifies the interface and calls `k
|
| 25/2 |
2026/09/06 00:43 |
tool |
grepper |
0m
Args: map[Expression:mod_timer\(&vub300->inactivity_timer]
Results: map[Output:drivers/mmc/host/vub300.c=655=static void __do_poll(struct vub300_mmc_host *vub300)
--
drivers/mmc/host/vub300.c-658- unsigned long commretval;
drivers/mmc/host/vub300.c:659: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
drivers/mmc/host/vub300.c-660- init_completion(&vub300->irqpoll_complete);
--
drivers/mmc/host/vub300.c=678=static void vub300_pollwork_thread(struct work_struct *work)
--
drivers/mmc/host/vub300.c-697- mmc_signal_sdio_irq(vub300->mmc);
drivers/mmc/host/vub300.c:698: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
drivers/mmc/host/vub300.c-699- mutex_unlock(&vub300->irq_mutex);
--
drivers/mmc/host/vub300.c=709=static void vub300_deadwork_thread(struct work_struct *work)
--
drivers/mmc/host/vub300.c-736- }
drivers/mmc/host/vub300.c:737: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
drivers/mmc/host/vub300.c-738- mutex_unlock(&vub300->cmd_mutex);
--
drivers/mmc/host/vub300.c=742=static void vub300_inactivity_timer_expired(struct timer_list *t)
--
drivers/mmc/host/vub300.c-748- } else if (vub300->cmd) {
drivers/mmc/host/vub300.c:749: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
drivers/mmc/host/vub300.c-750- } else {
drivers/mmc/host/vub300.c-751- vub300_queue_dead_work(vub300);
drivers/mmc/host/vub300.c:752: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
drivers/mmc/host/vub300.c-753- }
--
drivers/mmc/host/vub300.c=1908=static void vub300_mmc_request(struct mmc_host *mmc, struct mmc_request *req)
--
drivers/mmc/host/vub300.c-1939- mutex_lock(&vub300->cmd_mutex);
drivers/mmc/host/vub300.c:1940: mod_timer(&vub300->inactivity_timer, jiffies + HZ);
drivers/mmc/host/vub300.c-1941- /*
]
|
| 26/2 |
2026/09/06 00:43 |
llm |
expert |
0m
Model:
Tokens:
input: 45035
output: 45
thoughts: 96
Thoughts: **My Immediate Concerns Regarding Timer Safety**
Okay, so I'm focusing on this timer mechanism. The critical thing here is that when the timer is armed, it appears no external reference to the related object is held. My concern immediately spikes: if `vub300_disconnect` is called and, crucially, it's responsible for dropping the *final* reference to `vub300`, then the `vub300` object gets freed. If that happens *before* the timer fires, we've got a classic use-after-free situation on our hands β the timer attempts to operate on memory that's been reclaimed. This is bad, really bad.
Now, my next question is whether `vub300_disconnect` *itself* deletes the timer. If it does, problem solved, right? The timer would be cancelled along with the associated object, avoiding the race condition altogether. But I can't assume that, I need to verify that and if that is the case.
Right, time to go back and meticulously re-examine the implementation of `vub300_disconnect`. I've got to confirm, one way or the other, whether it cancels the timer or just handles the object and reference count.
|
| 27/2 |
2026/09/06 00:43 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/mmc/host/vub300.c Name:vub300_disconnect]
Results: map[SourceCode:2373: static void vub300_disconnect(struct usb_interface *interface)
2374: { /* NOT irq */
2375: struct vub300_mmc_host *vub300 = usb_get_intfdata(interface);
2376: if (!vub300 || !vub300->mmc) {
2377: return;
2378: } else {
2379: struct mmc_host *mmc = vub300->mmc;
2380: if (!vub300->mmc) {
2381: return;
2382: } else {
2383: int ifnum = interface_to_InterfaceNumber(interface);
2384: usb_set_intfdata(interface, NULL);
2385: /* prevent more I/O from starting */
2386: vub300->interface = NULL;
2387: mmc_remove_host(mmc);
2388: kref_put(&vub300->kref, vub300_delete);
2389: pr_info("USB vub300 remote SDIO host controller[%d]"
2390: " now disconnected", ifnum);
2391: return;
2392: }
2393: }
2394: }
SourceFile:drivers/mmc/host/vub300.c]
|
| 28/2 |
2026/09/06 00:43 |
llm |
expert |
0m
Model:
Tokens:
input: 45849
output: 45
thoughts: 64
Thoughts: **Investigating Timer Behavior After `vub300_disconnect`**
Okay, so I was looking into the behavior of the `vub300_disconnect` function and it seems pretty clear that it *doesn't* delete the timer associated with the `vub300` object. That's a potential problem, isn't it? If the timer isn't explicitly deleted during disconnection, then it could very well fire after the `vub300` object itself has been freed, leading to a nasty use-after-free situation β something I definitely want to avoid! Time to verify whether the `vub300_delete` function takes care of this scenario.
|
| 29/2 |
2026/09/06 00:44 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/mmc/host/vub300.c Name:vub300_delete]
Results: map[SourceCode: 369: static void vub300_delete(struct kref *kref)
370: { /* kref callback - softirq */
371: struct vub300_mmc_host *vub300 = kref_to_vub300_mmc_host(kref);
372: struct mmc_host *mmc = vub300->mmc;
373:
374: usb_free_urb(vub300->command_out_urb);
375: vub300->command_out_urb = NULL;
376: usb_free_urb(vub300->command_res_urb);
377: vub300->command_res_urb = NULL;
378: usb_put_dev(vub300->udev);
379: mmc_free_host(mmc);
380: /*
381: * and hence also frees vub300
382: * which is contained at the end of struct mmc
383: */
384: }
SourceFile:drivers/mmc/host/vub300.c]
|
| 30/2 |
2026/09/06 00:44 |
llm |
expert |
0m
Model:
Tokens:
input: 46451
output: 45
thoughts: 267
Thoughts: **My Analysis of the Timer and `kref` Relationship**
Okay, so `vub300_delete` *doesn't* automatically cancel and delete the inactivity timer. That's a red flag. If the timer isn't explicitly stopped, it'll happily fire away, potentially accessing memory that's already been freed. That's a classic race condition waiting to happen.
But hold on... looking at the timer callback, `vub300_inactivity_timer_expired`, I see something interesting. It calls `kref_put(&vub300->kref, vub300_delete)` *conditionally*. Specifically, if `!vub300->interface`. Aha! So, under certain conditions, the timer callback itself is responsible for decrementing the reference count and ultimately triggering the object's deletion. This suggests the timer callback *owns* a reference to the `vub300` object.
If the callback owns a reference, then by definition, a reference *must* be taken somewhere when the timer is armed. That's how we can ensure the object sticks around while the timer is running. I need to figure out where that reference is taken. It has to be paired with this `kref_put` in the callback. Let me check the `vub300_probe` function - that's where the device is likely initialized and the timer potentially started. I need to confirm if a `kref_get` is called when the timer is being armed, otherwise, we have a very serious bug.
|
| 31/2 |
2026/09/06 00:44 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/mmc/host/vub300.c Name:vub300_probe]
Results: map[SourceCode:2092: static int vub300_probe(struct usb_interface *interface,
2093: const struct usb_device_id *id)
2094: { /* NOT irq */
2095: struct vub300_mmc_host *vub300;
2096: struct usb_host_interface *iface_desc;
2097: struct usb_device *udev = usb_get_dev(interface_to_usbdev(interface));
2098: int i;
2099: int retval = -ENOMEM;
2100: struct urb *command_out_urb;
2101: struct urb *command_res_urb;
2102: struct mmc_host *mmc;
2103: char manufacturer[48];
2104: char product[32];
2105: char serial_number[32];
2106: usb_string(udev, udev->descriptor.iManufacturer, manufacturer,
2107: sizeof(manufacturer));
2108: usb_string(udev, udev->descriptor.iProduct, product, sizeof(product));
2109: usb_string(udev, udev->descriptor.iSerialNumber, serial_number,
2110: sizeof(serial_number));
2111: dev_info(&udev->dev, "probing VID:PID(%04X:%04X) %s %s %s\n",
2112: le16_to_cpu(udev->descriptor.idVendor),
2113: le16_to_cpu(udev->descriptor.idProduct),
2114: manufacturer, product, serial_number);
2115: command_out_urb = usb_alloc_urb(0, GFP_KERNEL);
2116: if (!command_out_urb) {
2117: retval = -ENOMEM;
2118: goto err_put_udev;
2119: }
2120: command_res_urb = usb_alloc_urb(0, GFP_KERNEL);
2121: if (!command_res_urb) {
2122: retval = -ENOMEM;
2123: goto err_free_out_urb;
2124: }
2125: /* this also allocates memory for our VUB300 mmc host device */
2126: mmc = mmc_alloc_host(sizeof(*vub300), &udev->dev);
2127: if (!mmc) {
2128: retval = -ENOMEM;
2129: dev_err(&udev->dev, "not enough memory for the mmc_host\n");
2130: goto err_free_res_urb;
2131: }
2132: /* MMC core transfer sizes tunable parameters */
2133: mmc->caps = 0;
2134: if (!force_1_bit_data_xfers)
2135: mmc->caps |= MMC_CAP_4_BIT_DATA;
2136: if (!force_polling_for_irqs)
2137: mmc->caps |= MMC_CAP_SDIO_IRQ;
2138: mmc->caps &= ~MMC_CAP_NEEDS_POLL;
2139: /*
2140: * MMC_CAP_NEEDS_POLL causes core.c:mmc_rescan() to poll
2141: * for devices which results in spurious CMD7's being
2142: * issued which stops some SDIO cards from working
2143: */
2144: if (limit_speed_to_24_MHz) {
2145: mmc->caps |= MMC_CAP_MMC_HIGHSPEED;
2146: mmc->caps |= MMC_CAP_SD_HIGHSPEED;
2147: mmc->f_max = 24000000;
2148: dev_info(&udev->dev, "limiting SDIO speed to 24_MHz\n");
2149: } else {
2150: mmc->caps |= MMC_CAP_MMC_HIGHSPEED;
2151: mmc->caps |= MMC_CAP_SD_HIGHSPEED;
2152: mmc->f_max = 48000000;
2153: }
2154: mmc->f_min = 200000;
2155: mmc->max_blk_count = 511;
2156: mmc->max_blk_size = 512;
2157: mmc->max_segs = 128;
2158: if (force_max_req_size)
2159: mmc->max_req_size = force_max_req_size * 1024;
2160: else
2161: mmc->max_req_size = 64 * 1024;
2162: mmc->max_seg_size = mmc->max_req_size;
2163: mmc->ocr_avail = 0;
2164: mmc->ocr_avail |= MMC_VDD_165_195;
2165: mmc->ocr_avail |= MMC_VDD_20_21;
2166: mmc->ocr_avail |= MMC_VDD_21_22;
2167: mmc->ocr_avail |= MMC_VDD_22_23;
2168: mmc->ocr_avail |= MMC_VDD_23_24;
2169: mmc->ocr_avail |= MMC_VDD_24_25;
2170: mmc->ocr_avail |= MMC_VDD_25_26;
2171: mmc->ocr_avail |= MMC_VDD_26_27;
2172: mmc->ocr_avail |= MMC_VDD_27_28;
2173: mmc->ocr_avail |= MMC_VDD_28_29;
2174: mmc->ocr_avail |= MMC_VDD_29_30;
2175: mmc->ocr_avail |= MMC_VDD_30_31;
2176: mmc->ocr_avail |= MMC_VDD_31_32;
2177: mmc->ocr_avail |= MMC_VDD_32_33;
2178: mmc->ocr_avail |= MMC_VDD_33_34;
2179: mmc->ocr_avail |= MMC_VDD_34_35;
2180: mmc->ocr_avail |= MMC_VDD_35_36;
2181: mmc->ops = &vub300_mmc_ops;
2182: vub300 = mmc_priv(mmc);
2183: vub300->mmc = mmc;
2184: vub300->card_powered = 0;
2185: vub300->bus_width = 0;
2186: vub300->cmnd.head.block_size[0] = 0x00;
2187: vub300->cmnd.head.block_size[1] = 0x00;
2188: vub300->app_spec = 0;
2189: mutex_init(&vub300->cmd_mutex);
2190: mutex_init(&vub300->irq_mutex);
2191: vub300->command_out_urb = command_out_urb;
2192: vub300->command_res_urb = command_res_urb;
2193: vub300->usb_timed_out = 0;
2194: vub300->dynamic_register_count = 0;
2195:
2196: for (i = 0; i < ARRAY_SIZE(vub300->fn); i++) {
2197: vub300->fn[i].offload_point = 0;
2198: vub300->fn[i].offload_count = 0;
2199: }
2200:
2201: vub300->total_offload_count = 0;
2202: vub300->irq_enabled = 0;
2203: vub300->irq_disabled = 0;
2204: vub300->irqs_queued = 0;
2205:
2206: for (i = 0; i < ARRAY_SIZE(vub300->sdio_register); i++)
2207: vub300->sdio_register[i++].activate = 0;
2208:
2209: vub300->udev = udev;
2210: vub300->interface = interface;
2211: vub300->cmnd_res_ep = 0;
2212: vub300->cmnd_out_ep = 0;
2213: vub300->data_inp_ep = 0;
2214: vub300->data_out_ep = 0;
2215:
2216: for (i = 0; i < ARRAY_SIZE(vub300->fbs); i++)
2217: vub300->fbs[i] = 512;
2218:
2219: /*
2220: * set up the endpoint information
2221: *
2222: * use the first pair of bulk-in and bulk-out
2223: * endpoints for Command/Response+Interrupt
2224: *
2225: * use the second pair of bulk-in and bulk-out
2226: * endpoints for Data In/Out
2227: */
2228: vub300->large_usb_packets = 0;
2229: iface_desc = interface->cur_altsetting;
2230: for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
2231: struct usb_endpoint_descriptor *endpoint =
2232: &iface_desc->endpoint[i].desc;
2233: dev_info(&vub300->udev->dev,
2234: "vub300 testing %s EndPoint(%d) %02X\n",
2235: usb_endpoint_is_bulk_in(endpoint) ? "BULK IN" :
2236: usb_endpoint_is_bulk_out(endpoint) ? "BULK OUT" :
2237: "UNKNOWN", i, endpoint->bEndpointAddress);
2238: if (endpoint->wMaxPacketSize > 64)
2239: vub300->large_usb_packets = 1;
2240: if (usb_endpoint_is_bulk_in(endpoint)) {
2241: if (!vub300->cmnd_res_ep) {
2242: vub300->cmnd_res_ep =
2243: endpoint->bEndpointAddress;
2244: } else if (!vub300->data_inp_ep) {
2245: vub300->data_inp_ep =
2246: endpoint->bEndpointAddress;
2247: } else {
2248: dev_warn(&vub300->udev->dev,
2249: "ignoring"
2250: " unexpected bulk_in endpoint");
2251: }
2252: } else if (usb_endpoint_is_bulk_out(endpoint)) {
2253: if (!vub300->cmnd_out_ep) {
2254: vub300->cmnd_out_ep =
2255: endpoint->bEndpointAddress;
2256: } else if (!vub300->data_out_ep) {
2257: vub300->data_out_ep =
2258: endpoint->bEndpointAddress;
2259: } else {
2260: dev_warn(&vub300->udev->dev,
2261: "ignoring"
2262: " unexpected bulk_out endpoint");
2263: }
2264: } else {
2265: dev_warn(&vub300->udev->dev,
2266: "vub300 ignoring EndPoint(%d) %02X", i,
2267: endpoint->bEndpointAddress);
2268: }
2269: }
2270: if (vub300->cmnd_res_ep && vub300->cmnd_out_ep &&
2271: vub300->data_inp_ep && vub300->data_out_ep) {
2272: dev_info(&vub300->udev->dev,
2273: "vub300 %s packets"
2274: " using EndPoints %02X %02X %02X %02X\n",
2275: vub300->large_usb_packets ? "LARGE" : "SMALL",
2276: vub300->cmnd_out_ep, vub300->cmnd_res_ep,
2277: vub300->data_out_ep, vub300->data_inp_ep);
2278: /* we have the expected EndPoints */
2279: } else {
2280: dev_err(&vub300->udev->dev,
2281: "Could not find two sets of bulk-in/out endpoint pairs\n");
2282: retval = -EINVAL;
2283: goto err_free_host;
2284: }
2285: retval =
2286: usb_control_msg(vub300->udev, usb_rcvctrlpipe(vub300->udev, 0),
2287: GET_HC_INF0,
2288: USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
2289: 0x0000, 0x0000, &vub300->hc_info,
2290: sizeof(vub300->hc_info), 1000);
2291: if (retval < 0)
2292: goto err_free_host;
2293: retval =
2294: usb_control_msg(vub300->udev, usb_sndctrlpipe(vub300->udev, 0),
2295: SET_ROM_WAIT_STATES,
2296: USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
2297: firmware_rom_wait_states, 0x0000, NULL, 0, 1000);
2298: if (retval < 0)
2299: goto err_free_host;
2300: dev_info(&vub300->udev->dev,
2301: "operating_mode = %s %s %d MHz %s %d byte USB packets\n",
2302: (mmc->caps & MMC_CAP_SDIO_IRQ) ? "IRQs" : "POLL",
2303: (mmc->caps & MMC_CAP_4_BIT_DATA) ? "4-bit" : "1-bit",
2304: mmc->f_max / 1000000,
2305: pad_input_to_usb_pkt ? "padding input data to" : "with",
2306: vub300->large_usb_packets ? 512 : 64);
2307: retval =
2308: usb_control_msg(vub300->udev, usb_rcvctrlpipe(vub300->udev, 0),
2309: GET_SYSTEM_PORT_STATUS,
2310: USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
2311: 0x0000, 0x0000, &vub300->system_port_status,
2312: sizeof(vub300->system_port_status), 1000);
2313: if (retval < 0) {
2314: goto err_free_host;
2315: } else if (sizeof(vub300->system_port_status) == retval) {
2316: vub300->card_present =
2317: (0x0001 & vub300->system_port_status.port_flags) ? 1 : 0;
2318: vub300->read_only =
2319: (0x0010 & vub300->system_port_status.port_flags) ? 1 : 0;
2320: } else {
2321: retval = -EINVAL;
2322: goto err_free_host;
2323: }
2324: usb_set_intfdata(interface, vub300);
2325: INIT_DELAYED_WORK(&vub300->pollwork, vub300_pollwork_thread);
2326: INIT_WORK(&vub300->cmndwork, vub300_cmndwork_thread);
2327: INIT_WORK(&vub300->deadwork, vub300_deadwork_thread);
2328: kref_init(&vub300->kref);
2329: timer_setup(&vub300->sg_transfer_timer, vub300_sg_timed_out, 0);
2330: kref_get(&vub300->kref);
2331: timer_setup(&vub300->inactivity_timer,
2332: vub300_inactivity_timer_expired, 0);
2333: vub300->inactivity_timer.expires = jiffies + HZ;
2334: add_timer(&vub300->inactivity_timer);
2335: if (vub300->card_present)
2336: dev_info(&vub300->udev->dev,
2337: "USB vub300 remote SDIO host controller[%d]"
2338: "connected with SD/SDIO card inserted\n",
2339: interface_to_InterfaceNumber(interface));
2340: else
2341: dev_info(&vub300->udev->dev,
2342: "USB vub300 remote SDIO host controller[%d]"
2343: "connected with no SD/SDIO card inserted\n",
2344: interface_to_InterfaceNumber(interface));
2345: retval = mmc_add_host(mmc);
2346: if (retval)
2347: goto err_stop_io;
2348:
2349: return 0;
2350:
2351: err_stop_io:
2352: vub300->interface = NULL;
2353: kref_put(&vub300->kref, vub300_delete);
2354:
2355: return retval;
2356:
2357: err_free_host:
2358: mmc_free_host(mmc);
2359: /*
2360: * and hence also frees vub300
2361: * which is contained at the end of struct mmc
2362: */
2363: err_free_res_urb:
2364: usb_free_urb(command_res_urb);
2365: err_free_out_urb:
2366: usb_free_urb(command_out_urb);
2367: err_put_udev:
2368: usb_put_dev(udev);
2369:
2370: return retval;
2371: }
SourceFile:drivers/mmc/host/vub300.c]
|
| 32/2 |
2026/09/06 00:44 |
llm |
expert |
0m
Model:
Tokens:
input: 52622
output: 33
thoughts: 2041
Thoughts: **Refining the Vulnerability Analysis**
Okay, let's break this down further. Initially, I thought this was just a "sleeping in atomic context" bug β a Denial of Service. The refcounting appears solid: `kref_init` starts at 1, `kref_get` increments to 2, the timer takes a reference. The timer checks `vub300->interface` on expiry; if it's NULL (disconnected), it calls `kref_put`, decrementing the refcount. `vub300_disconnect` also calls `kref_put`. The last `kref_put` calls `vub300_delete`. The problem is that if the timer is the last one to release the reference, `vub300_delete` is invoked within the timer's softirq context, leading to a call to `mmc_free_host`, which calls `synchronize_srcu` which sleeps.
So, previously, I had it as DoS and PeripheralTrigger because unbinding the USB driver or physically unplugging the device would trigger `vub300_disconnect`. I was also sure `Exploitable` was `False`, as I thought the main issue was merely a scheduler call from a softirq which may lead to a deadlock.
But wait⦠now I'm seeing something more serious. While the refcounting is sound, the critical issue is what *happens* when that softirq is interrupted by a *different* interrupt while sleeping on the `synchronize_srcu` call. Let's trace it carefully.
A call to `schedule()` from a softirq context saves the stack pointer, `rsp`, *to the IRQ stack* on x86, which is shared among all tasks running on that CPU. The task's stack pointer will be saved as pointing to the IRQ stack! When a task wakes up it will load its stack pointer from the saved location, which is now pointing to the IRQ stack! But the IRQ stack is *shared* and can be overwritten by other interrupts.
In `__switch_to_asm`, the registers, including the stack pointer, are pushed onto the IRQ stack. When the interrupted task is resumed, it *restores* those registers from the corrupted IRQ stack! Now, when the softirq handler resumes after `synchronize_srcu` completes, *it will pop corrupted registers from the stack*. The return address is now controlled by the attacker. This isn't just a DoS.
This opens a huge hole: a full stack corruption vulnerability, a classic privilege escalation. If an attacker can trigger an interrupt on the *same CPU* while the softirq is sleeping, they can overwrite the saved registers and the return address on the IRQ stack. A network packet, timer, or even a system call that triggers a softirq can be exploited. The attacker could fill the stack with controlled data. When the sleeping task wakes up, it resumes execution, but with a stack that has been totally overwritten. This leads to arbitrary code execution: this is a privilege escalation vulnerability.
Thus, my updated assessment:
* **Exploitable: True** (due to stack corruption)
* **DenialOfService: True** (scheduler is called, can lead to DoS or deadlock)
* **Unprivileged: False** (requires root to unbind, or physical access)
* **UserNamespace: False** (USB devices not accessible in userns)
* **VMGuestTrigger: False**
* **VMHostTrigger: False**
* **NetworkTrigger: True** (a network packet *could* trigger the exploit)
* **RemoteTrigger: True** (potentially with crafted network packets)
* **PeripheralTrigger: True**
* **FilesystemTrigger: False**
|
| 33/2 |
2026/09/06 00:44 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:kernel/sched/core.c Name:__schedule]
Results: map[SourceCode:7058: /*
7059: * __schedule() is the main scheduler function.
7060: *
7061: * The main means of driving the scheduler and thus entering this function are:
7062: *
7063: * 1. Explicit blocking: mutex, semaphore, waitqueue, etc.
7064: *
7065: * 2. TIF_NEED_RESCHED flag is checked on interrupt and userspace return
7066: * paths. For example, see arch/x86/entry_64.S.
7067: *
7068: * To drive preemption between tasks, the scheduler sets the flag in timer
7069: * interrupt handler sched_tick().
7070: *
7071: * 3. Wakeups don't really cause entry into schedule(). They add a
7072: * task to the run-queue and that's it.
7073: *
7074: * Now, if the new task added to the run-queue preempts the current
7075: * task, then the wakeup sets TIF_NEED_RESCHED and schedule() gets
7076: * called on the nearest possible occasion:
7077: *
7078: * - If the kernel is preemptible (CONFIG_PREEMPTION=y):
7079: *
7080: * - in syscall or exception context, at the next outmost
7081: * preempt_enable(). (this might be as soon as the wake_up()'s
7082: * spin_unlock()!)
7083: *
7084: * - in IRQ context, return from interrupt-handler to
7085: * preemptible context
7086: *
7087: * - If the kernel is not preemptible (CONFIG_PREEMPTION is not set)
7088: * then at the next:
7089: *
7090: * - cond_resched() call
7091: * - explicit schedule() call
7092: * - return from syscall or exception to user-space
7093: * - return from interrupt-handler to user-space
7094: *
7095: * WARNING: must be called with preemption disabled!
7096: */
7097: static void __sched notrace __schedule(int sched_mode)
7098: {
7099: struct task_struct *prev, *next;
7100: /*
7101: * On PREEMPT_RT kernel, SM_RTLOCK_WAIT is noted
7102: * as a preemption by schedule_debug() and RCU.
7103: */
7104: bool preempt = sched_mode > SM_NONE;
7105: bool is_switch = false;
7106: unsigned long *switch_count;
7107: unsigned long prev_state;
7108: struct rq_flags rf;
7109: struct rq *rq;
7110: int cpu;
7111:
7112: /* Trace preemptions consistently with task switches */
7113: trace_sched_entry_tp(sched_mode == SM_PREEMPT);
7114:
7115: cpu = smp_processor_id();
7116: rq = cpu_rq(cpu);
7117: prev = rq->curr;
7118:
7119: schedule_debug(prev, preempt);
7120:
7121: klp_sched_try_switch(prev);
7122:
7123: local_irq_disable();
7124: rcu_note_context_switch(preempt);
7125: migrate_disable_switch(rq, prev);
7126:
7127: /*
7128: * Make sure that signal_pending_state()->signal_pending() below
7129: * can't be reordered with __set_current_state(TASK_INTERRUPTIBLE)
7130: * done by the caller to avoid the race with signal_wake_up():
7131: *
7132: * __set_current_state(@state) signal_wake_up()
7133: * schedule() set_tsk_thread_flag(p, TIF_SIGPENDING)
7134: * wake_up_state(p, state)
7135: * LOCK rq->lock LOCK p->pi_state
7136: * smp_mb__after_spinlock() smp_mb__after_spinlock()
7137: * if (signal_pending_state()) if (p->state & @state)
7138: *
7139: * Also, the membarrier system call requires a full memory barrier
7140: * after coming from user-space, before storing to rq->curr; this
7141: * barrier matches a full barrier in the proximity of the membarrier
7142: * system call exit.
7143: */
7144: rq_lock(rq, &rf);
7145: smp_mb__after_spinlock();
7146:
7147: hrtick_schedule_enter(rq);
7148:
7149: /* Promote REQ to ACT */
7150: rq->clock_update_flags <<= 1;
7151: update_rq_clock(rq);
7152: rq->clock_update_flags = RQCF_UPDATED;
7153:
7154: switch_count = &prev->nivcsw;
7155:
7156: /* Task state changes only considers SM_PREEMPT as preemption */
7157: preempt = sched_mode == SM_PREEMPT;
7158:
7159: /*
7160: * We must load prev->state once (task_struct::state is volatile), such
7161: * that we form a control dependency vs deactivate_task() below.
7162: */
7163: prev_state = READ_ONCE(prev->__state);
7164: if (sched_mode == SM_IDLE) {
7165: /* SCX must consult the BPF scheduler to tell if rq is empty */
7166: if (!rq->nr_running && !scx_enabled()) {
7167: next = prev;
7168: rq->next_class = &idle_sched_class;
7169: goto picked;
7170: }
7171: } else if (!preempt && prev_state) {
7172: /*
7173: * We pass task_is_blocked() as the should_block arg
7174: * in order to keep mutex-blocked tasks on the runqueue
7175: * for slection with proxy-exec (without proxy-exec
7176: * task_is_blocked() will always be false).
7177: */
7178: try_to_block_task(rq, prev, &prev_state,
7179: !task_is_blocked(prev));
7180: switch_count = &prev->nvcsw;
7181: }
7182:
7183: pick_again:
7184: assert_balance_callbacks_empty(rq);
7185: next = pick_next_task(rq, &rf);
7186: rq->next_class = next->sched_class;
7187: if (sched_proxy_exec()) {
7188: struct task_struct *prev_donor = rq->donor;
7189:
7190: rq_set_donor(rq, next);
7191: next->blocked_donor = NULL;
7192: if (unlikely(next->is_blocked)) {
7193: next = find_proxy_task(rq, next, &rf);
7194: if (!next) {
7195: zap_balance_callbacks(rq);
7196: goto pick_again;
7197: }
7198: if (next == rq->idle) {
7199: zap_balance_callbacks(rq);
7200: goto keep_resched;
7201: }
7202: }
7203: if (rq->donor == prev_donor && prev != next) {
7204: struct task_struct *donor = rq->donor;
7205: /*
7206: * When transitioning like:
7207: *
7208: * prev next
7209: * donor: B B
7210: * curr: A B or C
7211: *
7212: * then put_prev_set_next_task() will not have done
7213: * anything, since B == B. However, A might have
7214: * missed a RT/DL balance opportunity due to being
7215: * on_cpu.
7216: */
7217: donor->sched_class->put_prev_task(rq, donor, donor);
7218: donor->sched_class->set_next_task(rq, donor, true);
7219: }
7220: } else {
7221: rq_set_donor(rq, next);
7222: }
7223:
7224: picked:
7225: clear_tsk_need_resched(prev);
7226: clear_preempt_need_resched();
7227: keep_resched:
7228: rq->last_seen_need_resched_ns = 0;
7229:
7230: is_switch = prev != next;
7231: if (likely(is_switch)) {
7232: rq->nr_switches++;
7233: /*
7234: * RCU users of rcu_dereference(rq->curr) may not see
7235: * changes to task_struct made by pick_next_task().
7236: */
7237: RCU_INIT_POINTER(rq->curr, next);
7238:
7239: /*
7240: * The membarrier system call requires each architecture
7241: * to have a full memory barrier after updating
7242: * rq->curr, before returning to user-space.
7243: *
7244: * Here are the schemes providing that barrier on the
7245: * various architectures:
7246: * - mm ? switch_mm() : mmdrop() for x86, s390, sparc, PowerPC,
7247: * RISC-V. switch_mm() relies on membarrier_arch_switch_mm()
7248: * on PowerPC and on RISC-V.
7249: * - finish_lock_switch() for weakly-ordered
7250: * architectures where spin_unlock is a full barrier,
7251: * - switch_to() for arm64 (weakly-ordered, spin_unlock
7252: * is a RELEASE barrier),
7253: *
7254: * The barrier matches a full barrier in the proximity of
7255: * the membarrier system call entry.
7256: *
7257: * On RISC-V, this barrier pairing is also needed for the
7258: * SYNC_CORE command when switching between processes, cf.
7259: * the inline comments in membarrier_arch_switch_mm().
7260: */
7261: ++*switch_count;
7262:
7263: psi_account_irqtime(rq, prev, next);
7264: psi_sched_switch(prev, next, !task_on_rq_queued(prev) ||
7265: prev->se.sched_delayed);
7266:
7267: trace_sched_switch(preempt, prev, next, prev_state);
7268:
7269: /* Also unlocks the rq: */
7270: rq = context_switch(rq, prev, next, &rf);
7271: } else {
7272: rq_unpin_lock(rq, &rf);
7273: __balance_callbacks(rq, NULL);
7274: hrtick_schedule_exit(rq);
7275: raw_spin_rq_unlock_irq(rq);
7276: }
7277: trace_sched_exit_tp(is_switch);
7278: }
SourceFile:kernel/sched/core.c]
|
| 34/2 |
2026/09/06 00:44 |
llm |
expert |
0m
Model:
Tokens:
input: 58982
output: 66
thoughts: 1519
Thoughts: **Analysis of a Scheduling Bug within the Linux Kernel**
Okay, so here's what I've pieced together about this scheduling bug. It all starts with `__schedule` being called with `SM_NONE` from `schedule()`. The crux seems to be around how tasks are blocked and then context-switched, particularly when a softirq is active. `try_to_block_task` deactivates the task, which is followed by a `context_switch`.
The critical point is that `schedule()` itself *doesn't* directly check the `preempt_count`. It just disables preemption, calls `__schedule`, and then re-enables preemption. However, `schedule_debug` *does* check `preempt_count()`. This function, specifically `in_atomic_preempt_off()`, detects if we're in an atomic context. Because we're in a softirq, `preempt_count()` has `SOFTIRQ_OFFSET` making it non-zero. This triggers `__schedule_bug`, which spits out a warning about scheduling while atomic.
The sneaky part is what happens *after* the warning. `__schedule_bug` *sets* `preempt_count` to `PREEMPT_DISABLED` (which is 1), effectively *clearing* the `SOFTIRQ_OFFSET`. This allows the context switch to proceed. The stack pointer (`prev->thread.sp`) gets saved, crucially, to the *IRQ stack*.
Now, here's where it becomes nasty. When the task wakes up, it's going to restore the stack pointer. But, the stack pointer is still pointing to the *IRQ stack*. And if that IRQ stack has been clobbered by another interrupt... we're talking full-blown stack corruption! Potentially, an attacker could control this stack corruption, for code execution, if the IRQ stack is overwritten.
The trigger, I see, is a USB device. The task is woken up by the RCU thread, added to the runqueue, and scheduled in, which restores `%rsp` to the IRQ stack. ROP can be run. The question is whether unprivileged users can trigger this. A USB device generally needs physical access, making it a "Peripheral Trigger," which, therefore, is not an unprivileged trigger.
The trigger, I've confirmed, is in the `vub300` driver, which is a USB driver and a USB SDIO Host Controller. I've ruled out filesystem, network, or VM triggers. The bug hinges on the fact that `vub300_inactivity_timer_expired` is a softirq timer; these timers are kernel timers running in softirq context, which run on the IRQ stack. `synchronize_srcu` calls `wait_for_completion`, which calls `schedule()`. It all lines up perfectly.
I've got to confirm this is a USB driver; `vub300_table` uses `USB_DEVICE`, which confirms it's a USB SDIO host controller.
The vulnerability is exploitable because the IRQ stack corruption can be weaponized. With carefully crafted code in the new interrupt's stack frame, the saved registers of the sleeping task can be overwritten. When the task resumes, the corrupted registers are loaded, leading to arbitrary code execution.
Therefore, the results are:
* Exploitable: True (stack corruption leading to code execution)
* DenialOfService: True
* Unprivileged: False
* UserNamespace: False
* VMGuestTrigger: False
* VMHostTrigger: False
* NetworkTrigger: False
* RemoteTrigger: False
* PeripheralTrigger: True
* FilesystemTrigger: False
|
| 35/2 |
2026/09/06 00:44 |
tool |
set-results |
0m
Args: map[DenialOfService:true Exploitable:true FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:true RemoteTrigger:false Unprivileged:false UserNamespace:false VMGuestTrigger:false VMHostTrigger:false]
Results: map[DenialOfService:true Exploitable:true FilesystemTrigger:false NetworkTrigger:false PeripheralTrigger:true RemoteTrigger:false Unprivileged:false UserNamespace:false VMGuestTrigger:false VMHostTrigger:false]
|
| 36/2 |
2026/09/06 00:44 |
llm |
expert |
0m
Model:
Tokens:
input: 61440
output: 630
thoughts: 445
Thoughts: **My Analysis of the USB SDIO Host Controller Driver Bug**
Okay, the analysis is complete, time to synthesize my findings into the final response.
The root cause lies squarely within the `vub300` USB SDIO host controller driver. I've pinpointed the culprit: the `vub300_inactivity_timer_expired` timer callback. This callback, unfortunately, runs within the softirq context β an immediate red flag.
The scenario unfolds like this: if the device has been disconnected (indicated by `!vub300->interface`), the timer callback attempts to release its reference to the device using `kref_put(&vub300->kref, vub300_delete)`. If that's the last reference, `vub300_delete` is invoked, still within the softirq. That's where it all goes sideways.
`vub300_delete` then calls `mmc_free_host`, which eventually triggers `wakeup_source_unregister` and, critically, `synchronize_srcu`. And here's the kicker: `synchronize_srcu` is a sleeping function! Attempting to sleep from a softirq context is a clear violation of kernel rules. This immediately explains the "BUG: sleeping function called from invalid context" warning.
The plot thickens: `synchronize_srcu` leads to `wait_for_completion`, and that in turn calls `schedule()`. On x86, softirqs utilize a dedicated IRQ stack. This is a crucial vulnerability. Calling `schedule()` from the IRQ stack causes the scheduler to save the task's context β including the stack pointer β which is currently pointing to that IRQ stack. When the task is eventually woken up, it resumes execution using the IRQ stack. The catch? The IRQ stack is shared and extremely vulnerable to corruption from subsequent interrupts while the task is asleep. This is a classic recipe for stack corruption.
An attacker could exploit this by flooding the IRQ stack with carefully crafted data (e.g., via network packets or other interrupt sources) to overwrite the stack, overwriting return addresses and registers and achieving arbitrary code execution and privilege escalation. This is concerning, but the attack vector gives some comfort.
Crucially, because this is a bug in a USB driver, the attacker needs physical access to plug in a malicious USB device. This also applies to emulation using tools like USB/IP or raw-gadget, which requires root privileges. Therefore, it is a Peripheral Trigger, not something that can be exploited by unprivileged users remotely or locally without physical access.
|
| 37/1 |
2026/09/06 00:45 |
action |
format-explanation |
0m
Results: map[Explanation:Based on the analysis of the bug report and the kernel source code, here is the
assessment of the vulnerability:
**Root Cause Analysis:**
The bug is located in the `vub300` USB SDIO host controller driver. The driver
uses a kernel timer (`vub300->inactivity_timer`) which executes its callback
`vub300_inactivity_timer_expired()` in softirq context.
If the USB device has been disconnected (`!vub300->interface`), the timer
callback drops its reference to the device by calling `kref_put(&vub300->kref,
vub300_delete)`. If this happens to be the last reference, the cleanup function
`vub300_delete()` is executed directly within the softirq context.
`vub300_delete()` calls `mmc_free_host()`, which eventually calls
`wakeup_source_unregister()` and `synchronize_srcu()`.
`synchronize_srcu()` is a blocking function that must be called from a sleepable
process context. Calling it from an atomic softirq context violates kernel
assumptions, triggering the `BUG: sleeping function called from invalid context`
warning.
**Exploitability:**
This bug is **Exploitable**.
When `synchronize_srcu()` blocks, it calls `wait_for_completion()`, which in
turn calls `schedule()`. On architectures like x86, softirqs run on a dedicated
per-CPU IRQ stack rather than the task's own stack.
When `schedule()` is forced from the IRQ stack, the scheduler saves the task's
context (including the stack pointer `%rsp`) pointing directly into the shared
IRQ stack. While the task is put to sleep waiting for the SRCU grace period,
subsequent hardware interrupts or softirqs on the same CPU will reuse and
overwrite the contents of that IRQ stack.
When the sleeping task is eventually woken up, it will pop corrupted registers
and a corrupted return address from the overwritten IRQ stack. An attacker can
exploit this by intentionally spraying the IRQ stack with controlled data (e.g.,
by sending a flood of network packets or triggering other interrupts) while the
task is sleeping, leading to a full control-flow hijack (ROP) and privilege
escalation.
**Trigger Vectors:**
The vulnerable code is in a USB device driver (`drivers/mmc/host/vub300.c`). To
trigger the bug, an attacker needs to introduce a device matching the `vub300`
USB IDs and then disconnect it at the right time to race with the inactivity
timer.
In a standard Linux environment, this requires physical access to plug in a
malicious USB device (or root privileges to emulate one via
`dummy_hcd`/`raw-gadget`). Therefore, it is classified as a **Peripheral
Trigger**. It is not accessible to unprivileged local users or remote attackers.]
|