From: Navid Emamdoost <navid.emamdoost@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: emamd001@umn.edu, smccaman@umn.edu, kjlu@umn.edu,
Navid Emamdoost <navid.emamdoost@gmail.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Irenge Jules Bashizi <jbi.octave@gmail.com>,
Ioannis Valasakis <code@wizofe.uk>,
Mamta Shukla <mamtashukla555@gmail.com>,
Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
Colin Ian King <colin.king@canonical.com>,
Michelle Darcy <mdarcy137@gmail.com>,
Madhumitha Prabakaran <madhumithabiw@gmail.com>,
linux-media@vger.kernel.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] media: staging: davinci: fix for memory leak
Date: Tue, 17 Sep 2019 18:02:38 -0500 [thread overview]
Message-ID: <20190917230242.27630-1-navid.emamdoost@gmail.com> (raw)
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
reply other threads:[~2019-09-17 23:02 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=20190917230242.27630-1-navid.emamdoost@gmail.com \
--to=navid.emamdoost@gmail.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=code@wizofe.uk \
--cc=colin.king@canonical.com \
--cc=devel@driverdev.osuosl.org \
--cc=emamd001@umn.edu \
--cc=gregkh@linuxfoundation.org \
--cc=jbi.octave@gmail.com \
--cc=kjlu@umn.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=madhumithabiw@gmail.com \
--cc=mamtashukla555@gmail.com \
--cc=mchehab@kernel.org \
--cc=mdarcy137@gmail.com \
--cc=smccaman@umn.edu \
/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).