ASoC: qcom: q6afe: do not report the unvote response as unknown
Subsystems (4)
PATCH 1/1 ASoC: qcom: q6afe: do not report the unvote response as unknown
From: Riccardo Mereu <[email protected]>
q6afe_unvote_lpass_core_hw() sends AFE_CMD_REMOTE_LPASS_CORE_HW_DEVOTE_REQUEST and does not wait for the answer. The DSP acknowledges the request with a basic response, which the callback does not expect, so every unvote logs
qcom-q6afe aprsvc:service:4:4: Unknown cmd 0x100f6
This happens each time an LPASS codec macro is runtime suspended, that is after every use of the codec path.
Accept the response and ignore it. A failed unvote is still reported through the status check above the switch.
--- sound/soc/qcom/qdsp6/q6afe.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/qcom/qdsp6/q6afe.c +3 -0
@@ -1038,6 +1038,9 @@ static int q6afe_callback(struct apr_device *adev, const struct apr_resp_pkt *dawake_up (&afe->wait); }break ; +case AFE_CMD_REMOTE_LPASS_CORE_HW_DEVOTE_REQUEST : +/* nobody waits for the unvote to be acknowledged */ +break ;default :dev_err (afe->dev,"Unknown cmd 0x%x\n" , res->opcode);break ;
Signature · 16 lines
2.56.1 -- Privacy and Confidentiality Notice: This email and all attachments are confidential and for the designated recipient(s) only. They may also be privileged. If you are not the intended recipient or among the intended recipients, you may not use, read, retransmit, disseminate, store/copy the information in any medium or take any action in reliance upon it. Please notify the sender that you have received it in error and immediately delete the entire communication, including any attachments.
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce: - [Critical] soc: qcom: apr: uninitialized…
Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce:
- [Critical] soc: qcom: apr: uninitialized pointer deref in apr_do_rx_callback() [1]
--
commit cd38bd3ad96610d53840f172cb39125a91b67488
Author: Riccardo Mereu <[email protected]>
ASoC: qcom: q6afe: do not report the unvote response as unknown
This commit adds a case for AFE_CMD_REMOTE_LPASS_CORE_HW_DEVOTE_REQUEST in q6afe_callback() so that asynchronous unvote acknowledgements from the DSP are ignored instead of logged as unknown commands.
Quoted 5 lines
sound/soc/qcom/qdsp6/q6afe.c +0
-0
sound/soc/qcom/qdsp6/q6afe.c static int q6afe_callback(struct apr_device *adev, const struct apr_resp_pkt *da · line 1046
Quoted 9 lines
sound/soc/qcom/qdsp6/q6afe.c +3
-0@@ -1038,6 +1038,9 @@ static int q6afe_callback(struct apr_device *adev, const struct apr_resp_pkt *dawake_up (&afe->wait); }break ; +case AFE_CMD_REMOTE_LPASS_CORE_HW_DEVOTE_REQUEST : +/* nobody waits for the unvote to be acknowledged */ +break ;default :dev_err (afe->dev,"Unknown cmd 0x%x\n" , res->opcode);break ;
[Severity: Critical]
This problem wasn't introduced by this patch, but can q6afe_callback() dereference an uninitialized data->payload pointer via res [1]?
In apr_do_rx_callback(), hdr->pkt_size and hdr_size are unsigned 16-bit integers, so a malformed packet with hdr_size > hdr->pkt_size produces a negative resp.payload_size and leaves the stack pointer resp.payload uninitialized:
drivers/soc/qcom/apr.c:apr_do_rx_callback() {
...
resp.payload_size = hdr->pkt_size - hdr_size;
...
if (resp.payload_size > 0)
resp.payload = buf + hdr_size;
adrv->callback(adev, &resp);
...
}Because q6afe_callback() only checks if (!data->payload_size), a negative payload_size passes that check and res = data->payload is dereferenced.
[1] https://sashiko.dev/#/bug/linux-82d40745-1593-4c20-8432-d86099836525
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1