diff options
| author | Breno Leitao <leitao@debian.org> | 2026-06-16 05:09:38 -0700 |
|---|---|---|
| committer | Ard Biesheuvel <ardb@kernel.org> | 2026-08-20 14:45:05 +0300 |
| commit | 60618389de92444b3b11a6385c306109fc89c46a (patch) | |
| tree | 5a0561dfe88cbbc7e7db8aed51e566dd58a94d4d /scripts/patch-kernel | |
| parent | 7f64cb373f3dcc20d0e27e273dae10975a94d7e8 (diff) | |
| download | linux-60618389de92444b3b11a6385c306109fc89c46a.tar.gz linux-60618389de92444b3b11a6385c306109fc89c46a.zip | |
efi/runtime-wrappers: bound the wait for EFI runtime service calls
When an EFI runtime service hangs in firmware, the efi_rts_wq worker is
stuck inside the call and cannot be cancelled. __efi_queue_work() then
waits on the completion forever while holding efi_runtime_lock, so every
later EFI caller is wedged until reboot; the only symptom is a "workqueue
lockup" and tasks piling up on the semaphore.
Replace wait_for_completion() with wait_for_completion_timeout() bounded
by EFI_RTS_TIMEOUT (120 seconds). On timeout, clear EFI_RUNTIME_SERVICES
and return EFI_ABORTED so later callers fail fast at the entry check
instead of each paying another 120 seconds. The wedged worker is
intentionally leaked and keeps ownership of efi_rts_work.
A worker that only starts running after the timeout would otherwise
dereference efi_rts_work.args, now pointing into the caller's freed stack
frame, and hand stale pointers to firmware. Park it with
efi_rts_park_worker() at the entry of efi_call_rts() when runtime
services are already disabled, before it touches args or enters firmware.
Known limitation: a worker already inside firmware when the timeout fires
still holds efi_rts_args pointing into the caller's stack frame; if
firmware unblocks afterwards and writes the output buffers, they land in
reused memory. Firmware hung this long rarely recovers; a follow-up could
bounce the buffers through kmalloc.
Signed-off-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'scripts/patch-kernel')
0 files changed, 0 insertions, 0 deletions
