Re: [PATCH] misc: fastrpc: fix memory leak in fastrpc_channel_ctx_free

From: Dmitry Baryshkov

Date: Thu Jun 11 2026 - 20:44:57 EST


On Thu, Jun 11, 2026 at 02:21:44AM -0700, Eddie Lin wrote:
> The 'ctx_idr' is initialized but never destroyed when
> the channel context is freed, leading to a memory leak.
> Add idr_destroy() to properly clean up the IDR resources.
>
> Signed-off-by: Eddie Lin <eddie.lin@xxxxxxxxxxxxxxxx>

Missing Fixes and cc:stable.

> ---
> This patch series fixes a memory leak in the FastRPC driver.

It's a single patch, there is no series.

> The channel context's IDR was not being destroyed during cleanup.

Duplicate info.

> ---
> drivers/misc/fastrpc.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
> index a9b2ae44c06f..7727850e9240 100644
> --- a/drivers/misc/fastrpc.c
> +++ b/drivers/misc/fastrpc.c
> @@ -492,6 +492,7 @@ static void fastrpc_channel_ctx_free(struct kref *ref)
>
> cctx = container_of(ref, struct fastrpc_channel_ctx, refcount);
>
> + idr_destroy(&cctx->ctx_idr);
> kfree(cctx);
> }
>
>
> ---
> base-commit: abe651837cb394f76d738a7a747322fca3bf17ba
> change-id: 20260611-fastrpc-cctx-cleanup-bfd20aa7b8a0
>
> Best regards,
> --
> Eddie Lin <eddie.lin@xxxxxxxxxxxxxxxx>
>

--
With best wishes
Dmitry