Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1276316
| From | Matias Bjørling <m@bjorling.me> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2 1/5] lightnvm: fix memory leak |
| Date | 2015-11-24 12:00 +0100 |
| Message-ID | <qyjui-72V-11@gated-at.bofh.it> (permalink) |
| References | <qyjaW-6V9-7@gated-at.bofh.it> |
| Organization | Paletta |
On 11/24/2015 11:34 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>
> ---
>
> v1 on fixed one error. v2 fixes both.
>
> drivers/lightnvm/core.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
> index f659e60..e338048 100644
> --- a/drivers/lightnvm/core.c
> +++ b/drivers/lightnvm/core.c
> @@ -677,8 +677,10 @@ static long nvm_ioctl_info(struct file *file, void __user *arg)
> info->tgtsize = tgt_iter;
> up_write(&nvm_lock);
>
> - if (copy_to_user(arg, info, sizeof(struct nvm_ioctl_info)))
> + if (copy_to_user(arg, info, sizeof(struct nvm_ioctl_info))) {
> + kfree(info);
> return -EFAULT;
> + }
>
> kfree(info);
> return 0;
> @@ -721,8 +723,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, applied.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v2 1/5] lightnvm: fix memory leak Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-11-24 11:40 +0100
[PATCH v2 4/5] lightnvm: release dev if dma pools fails Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-11-24 11:40 +0100
Re: [PATCH v2 4/5] lightnvm: release dev if dma pools fails Matias Bjørling <mb@lightnvm.io> - 2015-11-24 12:10 +0100
[PATCH v2 5/5] lightnvm: return error if manager not found Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-11-24 11:40 +0100
Re: [PATCH v2 5/5] lightnvm: return error if manager not found Matias Bjørling <mb@lightnvm.io> - 2015-11-24 12:20 +0100
[PATCH v2 2/5] lightnvm: check for max sector Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-11-24 11:40 +0100
Re: [PATCH v2 2/5] lightnvm: check for max sector Matias Bjørling <mb@lightnvm.io> - 2015-11-24 12:10 +0100
[PATCH v2 3/5] lightnvm: create dma pool first Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-11-24 11:40 +0100
Re: [PATCH v2 3/5] lightnvm: create dma pool first Matias Bjørling <mb@lightnvm.io> - 2015-11-24 12:10 +0100
Re: [PATCH v2 1/5] lightnvm: fix memory leak Matias Bjørling <m@bjorling.me> - 2015-11-24 12:00 +0100
csiph-web