lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPcyv4iWknDGXGsbOFutvWxxhC+reMBMfGYO01R5+_MCBHXd5A@mail.gmail.com>
Date:	Wed, 3 Aug 2016 07:12:51 -0700
From:	Dan Williams <dan.j.williams@...el.com>
To:	Johannes Thumshirn <jthumshirn@...e.de>
Cc:	Linux NVDIMM Mailing List <linux-nvdimm@...ts.01.org>,
	Linux Kernel Mailinglist <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] libnvdimm: Fix memory leak in error path.

On Wed, Aug 3, 2016 at 7:01 AM, Johannes Thumshirn <jthumshirn@...e.de> wrote:
> If either device_register() or nvdimm_bus_create_ndclt() fails we leak the
> memory allocated for nvdimm_bus. Call kfree(nvdimm_bus) in the error path so
> it's not leaked.
>
> Signed-off-by: Johannes Thumshirn <jthumshirn@...e.de>
> ---
>  drivers/nvdimm/core.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/nvdimm/core.c b/drivers/nvdimm/core.c
> index be89764..8578365 100644
> --- a/drivers/nvdimm/core.c
> +++ b/drivers/nvdimm/core.c
> @@ -366,6 +366,7 @@ struct nvdimm_bus *__nvdimm_bus_register(struct device *parent,
>         return nvdimm_bus;
>   err:
>         put_device(&nvdimm_bus->dev);
> +       kfree(nvdimm_bus);
>         return NULL;
>  }
>  EXPORT_SYMBOL_GPL(__nvdimm_bus_register);
> --

This routine as moved to drivers/nvdimm/bus.c and I don't think this
is valid since device_register() initialize the reference count, and
the call to put_device() will trigger nvdimm_bus_release().

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ