CVE-2024-42274: Revert "ALSA: firewire-lib: operate for period elapse event in process context"
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
Revert "ALSA: firewire-lib: operate for period elapse event in process context"
Commit 7ba5ca32fe6e ("ALSA: firewire-lib: operate for period elapse event in process context") removed the process context workqueue from amdtp_domain_stream_pcm_pointer() and update_pcm_pointers() to remove its overhead.
With RME Fireface 800, this lead to a regression since Kernels 5.14.0, causing an AB/BA deadlock competition for the substream lock with eventual system freeze under ALSA operation:
thread 0:
* (lock A) acquire substream lock by snd_pcm_stream_lock_irq() in snd_pcm_status64()
* (lock B) wait for tasklet to finish by calling tasklet_unlock_spin_wait() in tasklet_disable_in_atomic() in ohci_flush_iso_completions() of ohci.c
thread 1:
* (lock B) enter tasklet
* (lock A) attempt to acquire substream lock,
waiting for it to be released:
snd_pcm_stream_lock_irqsave() in
snd_pcm_period_elapsed() in
update_pcm_pointers() in
process_ctx_payloads() in
process_rx_packets() of amdtp-stream.c
? tasklet_unlock_spin_wait
</NMI> <TASK>
ohci_flush_iso_completions firewire_ohciamdtp_domain_stream_pcm_pointer snd_firewire_libsnd_pcm_update_hw_ptr0 snd_pcmsnd_pcm_status64 snd_pcm
? native_queued_spin_lock_slowpath
</NMI> <IRQ>
_raw_spin_lock_irqsavesnd_pcm_period_elapsed snd_pcmprocess_rx_packets snd_firewire_libirq_target_callback snd_firewire_libhandle_it_packet firewire_ohcicontext_tasklet firewire_ohci
Restore the process context work queue to prevent deadlock AB/BA deadlock competition for ALSA substream lock of snd_pcm_stream_lock_irq() in snd_pcm_status64()
and snd_pcm_stream_lock_irqsave() in snd_pcm_period_elapsed().
revert commit 7ba5ca32fe6e ("ALSA: firewire-lib: operate for period elapse event in process context")
Replace inline description to prevent future deadlock.
The Linux kernel CVE team has assigned CVE-2024-42274 to this issue.
Affected and fixed versions
===========================
Issue introduced in 5.14 with commit 7ba5ca32fe6e and fixed in 6.1.104 with commit b239a37d68e8 Issue introduced in 5.14 with commit 7ba5ca32fe6e and fixed in 6.6.45 with commit f5043e69aeb2 Issue introduced in 5.14 with commit 7ba5ca32fe6e and fixed in 6.10.4 with commit 36c255db5a25 Issue introduced in 5.14 with commit 7ba5ca32fe6e and fixed in 6.11-rc2 with commit 3dab73ab925a
Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2024-42274
will be updated if fixes are backported, please check that for the most up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
sound/firewire/amdtp-stream.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:
https://git.kernel.org/stable/c/b239a37d68e8bc59f9516444da222841e3b13ba9 https://git.kernel.org/stable/c/f5043e69aeb2786f32e84132817a007a6430aa7d https://git.kernel.org/stable/c/36c255db5a25edd42d1aca48e38b8e95ee5fd9ef https://git.kernel.org/stable/c/3dab73ab925a51ab05543b491bf17463a48ca323