Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH] ASoC: qcom: q6afe: do not report the unvote response as unknown
@ 2026-12-01 13:15 Riccardo Mereu
  2026-12-01 13:21 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Riccardo Mereu @ 2026-12-01 13:15 UTC (permalink / raw)
  To: Srinivas Kandagatla, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai
  Cc: Riccardo Mereu, linux-sound, linux-arm-msm

From: Riccardo Mereu <r.mereu@arduino.cc>

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.

Fixes: 55e07531d922 ("ASoC: q6dsp: q6afe: add lpass hw voting support")
Signed-off-by: Riccardo Mereu <r.mereu@arduino.cc>
---
 sound/soc/qcom/qdsp6/q6afe.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sound/soc/qcom/qdsp6/q6afe.c b/sound/soc/qcom/qdsp6/q6afe.c
index 4f7b706c77b5..4b2620cb9c4a 100644
--- a/sound/soc/qcom/qdsp6/q6afe.c
+++ b/sound/soc/qcom/qdsp6/q6afe.c
@@ -1038,6 +1038,9 @@ static int q6afe_callback(struct apr_device *adev, const struct apr_resp_pkt *da
 				wake_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;
-- 
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.

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ASoC: qcom: q6afe: do not report the unvote response as unknown
  2026-12-01 13:15 [PATCH] ASoC: qcom: q6afe: do not report the unvote response as unknown Riccardo Mereu
@ 2026-12-01 13:21 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-12-01 13:21 UTC (permalink / raw)
  To: Riccardo Mereu; +Cc: linux-sound

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 <r.mereu@arduino.cc>

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.

> diff --git a/sound/soc/qcom/qdsp6/q6afe.c b/sound/soc/qcom/qdsp6/q6afe.c
> index 4f7b706c77b5d..4b2620cb9c4a7 100644
> --- a/sound/soc/qcom/qdsp6/q6afe.c
> +++ b/sound/soc/qcom/qdsp6/q6afe.c
> @@ -1038,6 +1038,9 @@ static int q6afe_callback(struct apr_device *adev, const struct apr_resp_pkt *da
>  				wake_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

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261201131548.161908-1-r.mereu.kernel@arduino.cc?part=1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-01 13:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 13:15 [PATCH] ASoC: qcom: q6afe: do not report the unvote response as unknown Riccardo Mereu
2026-12-01 13:21 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox