On Fri, May 15, 2026 at 08:42:13PM +0800, Jianping Li wrote:
> From: Ekansh Gupta <[email protected]>
> 
> 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.
> 
> Fixes: 0871561055e66 ("misc: fastrpc: Add support for audiopd")
> Cc: [email protected]
> Co-developed-by: Ekansh Gupta <[email protected]>
> Signed-off-by: Ekansh Gupta <[email protected]>

If it's From:Ekansh, it can't be CDB: Ekansh. How can Ekansh co-develop
the patch with himself?

> Signed-off-by: Jianping Li <[email protected]>
> ---
>  drivers/misc/fastrpc.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
> index 1080f9acf70a..8b21f85cd9f4 100644
> --- a/drivers/misc/fastrpc.c
> +++ b/drivers/misc/fastrpc.c
> @@ -1324,7 +1324,9 @@ static int fastrpc_init_create_static_process(struct 
> fastrpc_user *fl,
>               err = PTR_ERR(name);
>               goto err;
>       }
> -
> +     inbuf.client_id = fl->client_id;
> +     inbuf.namelen = init.namelen;
> +     inbuf.pageslen = 0;
>       if (!fl->cctx->remote_heap) {
>               err = fastrpc_remote_heap_alloc(fl, fl->sctx->dev, init.memlen,
>                                               &fl->cctx->remote_heap);
> @@ -1347,12 +1349,10 @@ static int fastrpc_init_create_static_process(struct 
> fastrpc_user *fl,
>                               goto err_map;
>                       }
>                       scm_done = true;
> +                     inbuf.pageslen = 1;
>               }
>       }
>  
> -     inbuf.client_id = fl->client_id;
> -     inbuf.namelen = init.namelen;
> -     inbuf.pageslen = 0;
>       fl->pd = USER_PD;
>  
>       args[0].ptr = (u64)(uintptr_t)&inbuf;
> -- 
> 2.43.0
> 

-- 
With best wishes
Dmitry

Reply via email to