Skip to contentSkip to conversation

misc: fastrpc: fix channel ctx ref leak when session alloc fails

PATCH Applied Anandu Krishnan E 3 participants 3 messages May 25 – Jul 1

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 misc: fastrpc: fix channel ctx ref leak when session alloc fails

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")
---
 drivers/misc/fastrpc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/fastrpc.c +1 -1
index 1080f9acf70a..9442db2c7aec 100644
@@ -1648,7 +1648,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;
 	}
 
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Anandu Krishnan E

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.

Quoted 7 lines
Fixes 278d56f970ae ("misc: fastrpc: Reference count channel context")
---
 drivers/misc/fastrpc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 2 lines
With best wishes
Dmitry
maintainer Applied
#2 lore raw
In reply to Anandu Krishnan E
Quoted 6 lines · Anandu Krishnan E

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.

Applied, thanks!

[1/1] misc: fastrpc: fix channel ctx ref leak when session alloc fails

      commit: c48eabae708407d4f26eeb81f9fe8215741b78fb

Best regards,

Signature · 1 line
Srinivas Kandagatla <[email protected]>