Linux Sound subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Riccardo Mereu" <r.mereu.kernel@arduino.cc>
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH] ASoC: qcom: q6afe: do not report the unvote response as unknown
Date: Tue, 01 Dec 2026 13:21:43 +0000	[thread overview]
Message-ID: <sashiko-outbox-243382@kernel.org> (raw)
In-Reply-To: <20261201131548.161908-1-r.mereu.kernel@arduino.cc>

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

      reply	other threads:[~2026-12-01 13:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-243382@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=r.mereu.kernel@arduino.cc \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox