Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH] soc: qcom: apr: accept packets without payload
@ 2026-12-01 13:15 Riccardo Mereu
  2026-12-01 13:27 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Riccardo Mereu @ 2026-12-01 13:15 UTC (permalink / raw)
  To: Srinivas Kandagatla, Bjorn Andersson, Konrad Dybcio, Abel Vesa
  Cc: Krzysztof Kozlowski, Riccardo Mereu, Abel Vesa, linux-sound,
	linux-arm-msm

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

The check added to reject a header larger than the packet also rejects
a packet that is exactly as large as its header. Such packets are
valid: the DSP sends events and command responses that carry no
payload, for example ASM_DATA_EVENT_RENDERED_EOS. They are now dropped
with

  qcom,apr ...apr_audio_svc.-1.-1: APR: Wrong packet size

and the service driver never sees them. On a QRB2210 board this
happens each time a q6asm playback stream is stopped and prepared
again, so the stream never learns that the DSP rendered the last
buffer.

Only a header that does not fit in the packet makes the payload size
negative, so reject that case alone, for APR and GPR.

Fixes: e6f64f9b76d5 ("soc: qcom: apr: Reject packets with header size larger than packet size")
Signed-off-by: Riccardo Mereu <r.mereu@arduino.cc>
---
 drivers/soc/qcom/apr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/qcom/apr.c b/drivers/soc/qcom/apr.c
index 515729374762..55f9b6a4bb76 100644
--- a/drivers/soc/qcom/apr.c
+++ b/drivers/soc/qcom/apr.c
@@ -218,7 +218,7 @@ static int apr_do_rx_callback(struct packet_router *apr, struct apr_rx_buf *abuf
 	}
 
 	if (hdr->pkt_size < APR_HDR_SIZE || hdr->pkt_size != len ||
-	    hdr->pkt_size <= hdr_size) {
+	    hdr->pkt_size < hdr_size) {
 		dev_err(apr->dev, "APR: Wrong packet size\n");
 		return -EINVAL;
 	}
@@ -289,7 +289,7 @@ static int gpr_do_rx_callback(struct packet_router *gpr, struct apr_rx_buf *abuf
 	}
 
 	if (hdr->pkt_size < GPR_PKT_HEADER_BYTE_SIZE || hdr->pkt_size != len ||
-	    hdr->pkt_size <= hdr_size * 4) {
+	    hdr->pkt_size < hdr_size * 4) {
 		dev_err(gpr->dev, "GPR: Wrong packet size\n");
 		return -EINVAL;
 	}
-- 
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

end of thread, other threads:[~2026-12-01 13:27 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] soc: qcom: apr: accept packets without payload Riccardo Mereu
2026-12-01 13:27 ` sashiko-bot

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