CVE-2026-139784: ASoC: qcom: q6apm: clear g_apm on driver removal
In the Linux kernel, the following vulnerability has been resolved:
ASoC: qcom: q6apm: clear gapm on driver removal
The global gapm pointer is set during apmprobe() but never cleared in apmremove(). After the driver is removed the devm-managed struct q6apm is freed, leaving gapm dangling. A subsequent call to q6apmisadspready() dereferences the freed pointer.
Clear gapm in apmremove() before the component is unregistered so that q6apmisadspready() returns false instead of triggering a use-after-free.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
Clear the global g_apm pointer in apm_remove() before unregistering the component, so q6apm_is_adsp_ready() does not dereference freed memory.
Event History
Frequently Asked Questions
When can this use-after-free occur?
It can occur after the q6apm driver has been removed, when a later call to q6apm_is_adsp_ready() dereferences the global g_apm pointer that still refers to freed devm-managed memory.
What behavior does the fix introduce after driver removal?
The fix clears g_apm in apm_remove() before the component is unregistered. Subsequent q6apm_is_adsp_ready() calls return false rather than dereferencing the stale pointer.