Skip to content

Commit d512c1f

Browse files
committed
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/20260409062617.1182-2-jianping.li@oss.qualcomm.com/ Fixes: 0871561 ("misc: fastrpc: Add support for audiopd") Cc: stable@kernel.org Co-developed-by: Ekansh Gupta <ekansh.gupta@oss.qualcomm.com> Signed-off-by: Ekansh Gupta <ekansh.gupta@oss.qualcomm.com> Signed-off-by: Jianping Li <jianping.li@oss.qualcomm.com>
1 parent c29b2a8 commit d512c1f

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
@@ -1446,7 +1446,9 @@ static int fastrpc_init_create_static_process(struct fastrpc_user *fl,
14461446
err = PTR_ERR(name);
14471447
goto err;
14481448
}
1449-
1449+
inbuf.client_id = fl->client_id;
1450+
inbuf.namelen = init.namelen;
1451+
inbuf.pageslen = 0;
14501452
if (!fl->cctx->remote_heap) {
14511453
err = fastrpc_remote_heap_alloc(fl, fl->sctx->dev, init.memlen,
14521454
&fl->cctx->remote_heap);
@@ -1469,12 +1471,10 @@ static int fastrpc_init_create_static_process(struct fastrpc_user *fl,
14691471
goto err_map;
14701472
}
14711473
scm_done = true;
1474+
inbuf.pageslen = 1;
14721475
}
14731476
}
14741477

1475-
inbuf.client_id = fl->client_id;
1476-
inbuf.namelen = init.namelen;
1477-
inbuf.pageslen = 0;
14781478
fl->pd = USER_PD;
14791479

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

0 commit comments

Comments
 (0)