[PATCH v5 3/5] misc: fastrpc: Fail Audio PD init when reserved memory is missing
From: Jianping Li
Date: Fri May 15 2026 - 09:01:33 EST
Audio PD static process creation assumes that a reserved-memory
region is defined in DT and exposed via cctx->remote_heap.
If reserved-memory is missing or incomplete, the driver may pass
invalid address/size information to the DSP, leading to undefined
behavior or crashes.
Add explicit validation for remote_heap presence and size before
sending the memory to DSP, and fail early if the configuration is
invalid.
Fixes: 0871561055e66 ("misc: fastrpc: Add support for audiopd")
Cc: stable@xxxxxxxxxx
Signed-off-by: Jianping Li <jianping.li@xxxxxxxxxxxxxxxx>
---
drivers/misc/fastrpc.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
index 3c7c3b410d7d..a0337cce77f3 100644
--- a/drivers/misc/fastrpc.c
+++ b/drivers/misc/fastrpc.c
@@ -1363,6 +1363,12 @@ static int fastrpc_init_create_static_process(struct fastrpc_user *fl,
args[1].length = inbuf.namelen;
args[1].fd = -1;
+ if (!fl->cctx->remote_heap ||
+ !fl->cctx->remote_heap->dma_addr ||
+ !fl->cctx->remote_heap->size) {
+ err = -ENOMEM;
+ goto err;
+ }
pages[0].addr = fl->cctx->remote_heap->dma_addr;
pages[0].size = fl->cctx->remote_heap->size;
--
2.43.0