From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
To: "Matias Bjørling" <mb@lightnvm.io>
Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org
Subject: Re: [PATCH] lightnvm: fix memory leak
Date: Mon, 23 Nov 2015 22:10:01 +0530 [thread overview]
Message-ID: <20151123164001.GA7500@sudip-pc> (raw)
In-Reply-To: <56532D23.6090107@lightnvm.io>
On Mon, Nov 23, 2015 at 04:13:39PM +0100, Matias Bjørling wrote:
> On 11/23/2015 11:35 AM, Sudip Mukherjee wrote:
> >If copy_to_user() fails we returned error but we missed releasing
> >devices.
> >
> >Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> >---
> > drivers/lightnvm/core.c | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> >
> >diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
> >index f659e60..6688b60 100644
> >--- a/drivers/lightnvm/core.c
> >+++ b/drivers/lightnvm/core.c
> >@@ -721,8 +721,11 @@ static long nvm_ioctl_get_devices(struct file *file, void __user *arg)
> >
> > devices->nr_devices = i;
> >
> >- if (copy_to_user(arg, devices, sizeof(struct nvm_ioctl_get_devices)))
> >+ if (copy_to_user(arg, devices,
> >+ sizeof(struct nvm_ioctl_get_devices))) {
> >+ kfree(devices);
> > return -EFAULT;
> >+ }
> >
> > kfree(devices);
> > return 0;
> >
>
> Thanks Sudip, it seems like this error is in some of the others
> ioctl's as well. Do you want to send a patch with the fixes for them
> all?
I can find a similar error in nvm_ioctl_info(). I will have a close look
tomorrow and send a patch. Is this patch applied or should I send a
combined patch fixing all these similar errors?
regards
sudip
next prev parent reply other threads:[~2015-11-23 16:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-23 10:35 [PATCH] lightnvm: fix memory leak Sudip Mukherjee
2015-11-23 15:13 ` Matias Bjørling
2015-11-23 16:40 ` Sudip Mukherjee [this message]
2015-11-23 18:41 ` Matias
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=20151123164001.GA7500@sudip-pc \
--to=sudipm.mukherjee@gmail.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mb@lightnvm.io \
/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