]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
misc: fastrpc: fix channel ctx ref leak when session alloc fails
authorAnandu Krishnan E <anandu.e@oss.qualcomm.com>
Fri, 24 Jul 2026 22:33:40 +0000 (23:33 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 31 Jul 2026 08:59:47 +0000 (10:59 +0200)
fastrpc_channel_ctx_get() is called in fastrpc_device_open() before
fastrpc_session_alloc(). If session alloc fails, the error path
returns -EBUSY without calling fastrpc_channel_ctx_put(), leaking
the reference. Fix by adding the missing put.

Fixes: 278d56f970ae ("misc: fastrpc: Reference count channel context")
Cc: stable@kernel.org
Signed-off-by: Anandu Krishnan E <anandu.e@oss.qualcomm.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
Link: https://patch.msgid.link/20260724223342.629168-5-srini@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/fastrpc.c

index c75eafe872cc4c50df5dbef4b87ed38bc6134763..f8cbe30c5d5c2daf584fbb151de3b2aff909162a 100644 (file)
@@ -1675,7 +1675,7 @@ static int fastrpc_device_open(struct inode *inode, struct file *filp)
                dev_err(&cctx->rpdev->dev, "No session available\n");
                mutex_destroy(&fl->mutex);
                kfree(fl);
-
+               fastrpc_channel_ctx_put(cctx);
                return -EBUSY;
        }