linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: staging: davinci: fix for memory leak
@ 2019-09-17 23:02 Navid Emamdoost
  0 siblings, 0 replies; only message in thread
From: Navid Emamdoost @ 2019-09-17 23:02 UTC (permalink / raw)
  Cc: emamd001, smccaman, kjlu, Navid Emamdoost, Mauro Carvalho Chehab,
	Greg Kroah-Hartman, Irenge Jules Bashizi, Ioannis Valasakis,
	Mamta Shukla, Christophe JAILLET, Colin Ian King, Michelle Darcy,
	Madhumitha Prabakaran, linux-media, devel, linux-kernel

In ipipe_g_config the allocated memory for params needs to be released
if either module_if->get or copy_to_user fails.

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
 drivers/staging/media/davinci_vpfe/dm365_ipipe.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
index 52397ad0e3e2..3023691b53c0 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
@@ -1316,10 +1316,13 @@ static int ipipe_g_config(struct v4l2_subdev *sd, struct vpfe_ipipe_config *cfg)
 
 		if (to && from && size) {
 			rval = module_if->get(ipipe, from);
-			if (rval)
+			if (rval) {
+				kfree(params);
 				goto error;
+			}
 			if (copy_to_user((void __user *)to, from, size)) {
 				rval = -EFAULT;
+				kfree(params);
 				break;
 			}
 		}
-- 
2.17.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-09-17 23:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-17 23:02 [PATCH] media: staging: davinci: fix for memory leak Navid Emamdoost

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).