Skip to content

Commit 27c6d79

Browse files
ekanshibuquic-vkatoch
authored andcommitted
FROMLIST: misc: fastrpc: Fix initial memory allocation for Audio PD memory pool
The initial buffer allocated for the Audio PD memory pool is never added to the pool because pageslen is set to 0. As a result, the buffer is not registered with Audio PD and is never used, causing a memory leak. Audio PD immediately falls back to allocating memory from the remote heap since the pool starts out empty. Fix this by setting pageslen to 1 so that the initially allocated buffer is correctly registered and becomes part of the Audio PD memory pool. Link: https://lore.kernel.org/all/20260526111124.515-2-jianping.li@oss.qualcomm.com/ Fixes: 0871561 ("misc: fastrpc: Add support for audiopd") Cc: stable@kernel.org Signed-off-by: Ekansh Gupta <ekansh.gupta@oss.qualcomm.com> Signed-off-by: Jianping Li <jianping.li@oss.qualcomm.com> Signed-off-by: Vinayak Katoch <vkatoch@qti.qualcomm.com>
1 parent e2c354b commit 27c6d79

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/misc/fastrpc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,7 +1488,9 @@ static int fastrpc_init_create_static_process(struct fastrpc_user *fl,
14881488
err = PTR_ERR(name);
14891489
goto err;
14901490
}
1491-
1491+
inbuf.client_id = fl->client_id;
1492+
inbuf.namelen = init.namelen;
1493+
inbuf.pageslen = 0;
14921494
if (!fl->cctx->remote_heap) {
14931495
err = fastrpc_remote_heap_alloc(fl, fl->sctx->dev, init.memlen,
14941496
&fl->cctx->remote_heap);
@@ -1511,12 +1513,10 @@ static int fastrpc_init_create_static_process(struct fastrpc_user *fl,
15111513
goto err_map;
15121514
}
15131515
scm_done = true;
1516+
inbuf.pageslen = 1;
15141517
}
15151518
}
15161519

1517-
inbuf.client_id = fl->client_id;
1518-
inbuf.namelen = init.namelen;
1519-
inbuf.pageslen = 0;
15201520
fl->pd = USER_PD;
15211521

15221522
args[0].ptr = (u64)(uintptr_t)&inbuf;

0 commit comments

Comments
 (0)