From: Arvind Yadav <arvind.yadav.cs@gmail.com>
To: mchehab@kernel.org, gregkh@linuxfoundation.org
Cc: linux-media@vger.kernel.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] Staging: media: davinci_vpfe Fix resource leaks in error paths.
Date: Wed, 7 Jun 2017 19:14:34 +0530 [thread overview]
Message-ID: <dfa3e12e94585ea9791b942f2ad6e59b97ac8a8c.1496842864.git.arvind.yadav.cs@gmail.com> (raw)
Free memory, if ipipe_s_config and ipipe_g_config are not successful.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
drivers/staging/media/davinci_vpfe/dm365_ipipe.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
index 6a3434c..b6994ee 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c
@@ -1286,15 +1286,20 @@ static int ipipe_s_config(struct v4l2_subdev *sd, struct vpfe_ipipe_config *cfg)
if (to && from && size) {
if (copy_from_user(to, from, size)) {
rval = -EFAULT;
+ kfree(params);
break;
}
rval = module_if->set(ipipe, to);
- if (rval)
+ if (rval) {
+ kfree(params);
goto error;
+ }
} else if (to && !from && size) {
rval = module_if->set(ipipe, NULL);
- if (rval)
+ if (rval) {
+ kfree(params);
goto error;
+ }
}
kfree(params);
}
@@ -1328,10 +1333,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(to, from, size)) {
rval = -EFAULT;
+ kfree(params);
break;
}
}
--
1.9.1
reply other threads:[~2017-06-07 13:44 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dfa3e12e94585ea9791b942f2ad6e59b97ac8a8c.1496842864.git.arvind.yadav.cs@gmail.com \
--to=arvind.yadav.cs@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).