]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
misc: fastrpc: fix memory leak in fastrpc_channel_ctx_free
authorEddie Lin <eddie.lin@oss.qualcomm.com>
Fri, 24 Jul 2026 22:33:41 +0000 (23:33 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 31 Jul 2026 08:59:47 +0000 (10:59 +0200)
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.

Fixes: f6f9279f2bf0 ("misc: fastrpc: Add Qualcomm fastrpc basic driver model")
Cc: stable@vger.kernel.org
Signed-off-by: Eddie Lin <eddie.lin@oss.qualcomm.com>
Reviewed-by: Ekansh Gupta <ekansh.gupta@oss.qualcomm.com>
Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
Link: https://patch.msgid.link/20260724223342.629168-6-srini@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/fastrpc.c

index f8cbe30c5d5c2daf584fbb151de3b2aff909162a..eb6c2a78d3c7b7e0a684fb1b81563c6e5f67398c 100644 (file)
@@ -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);
 }