]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ASoC: qcom: q6apm-dai: Allocate an extra page for PCM buffers
authorSrinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Thu, 14 May 2026 09:06:07 +0000 (09:06 +0000)
committerMark Brown <broonie@kernel.org>
Sat, 16 May 2026 02:14:44 +0000 (11:14 +0900)
commit7e68ba282165b8880d11eac8a816d54d449b7d80
treed7c856b8b0a7648bbe191d91ad450a54815d37ad
parent0d435a7ebcd4e97e47673c1ab6fb27f973a053ec
ASoC: qcom: q6apm-dai: Allocate an extra page for PCM buffers

Some Old DSP firmware versions use 32-bit address arithmetic and size for
validating the PCM buffer address range. If a buffer is allocated near
the top of the 32-bit address space, arithmetic calculations involving
the end address can overflow and fail checks.

Work around this by increasing the preallocated PCM buffer size by one
page. The DSP is still passed the usable buffer size, excluding the extra
page, which prevents the firmware from seeing an end address that crosses
the 32-bit boundary.

This was not hit before because PCM buffer allocation and DSP-side
mapping happened at different points, and the size mapped on the DSP was
usually nperiods * period_size. Therefore the mapped size was unlikely to
match the full preallocated buffer size exactly, although the issue was
still possible. With early buffer mapping on the DSP, the full
preallocated buffer is mapped during PCM creation, making the failure
reproducible at boot.

Fixes: 8ea6e25c8536 ("ASoC: qcom: q6apm: Add support for early buffer mapping on DSP")
Cc: Stable@vger.kernel.org
Reported-by: Jens Glathe <jens.glathe@oldschoolsolutions.biz>
Closes: https://lore.kernel.org/all/7f10abbd-fb78-4c3a-ab90-7ca78239891a@oldschoolsolutions.biz/
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Tested-by: Jens Glathe <jens.glathe@oldschoolsolutions.biz>
Link: https://patch.msgid.link/20260514090607.2435484-1-srinivas.kandagatla@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/qcom/qdsp6/q6apm-dai.c