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]
Date:   Thu, 25 Jan 2018 11:37:33 +0200
From:   Max Gurtovoy <maxg@...lanox.com>
To:     Johannes Thumshirn <jthumshirn@...e.de>,
        Christoph Hellwig <hch@....de>
CC:     Roland Dreier <roland@...estorage.com>,
        Sagi Grimberg <sagi@...mberg.me>,
        Linux Kernel Mailinglist <linux-kernel@...r.kernel.org>,
        "Linux NVMe Mailinglist" <linux-nvme@...ts.infradead.org>,
        Keith Busch <keith.busch@...el.com>,
        Dan Carpenter <dan.carpenter@...cle.com>
Subject: Re: [PATCH] nvme: don't free uuid pointer before printing it



On 1/25/2018 10:09 AM, Johannes Thumshirn wrote:
> Commit df351ef73789 ("nvme-fabrics: fix memory leak when parsing host ID
> option") fixed the leak of 'p' but in case uuid_parse() fails the memory
> is freed before the error print that is using it.
> 
> Free it after printing eventual errors.
> 
> Signed-off-by: Johannes Thumshirn <jthumshirn@...e.de>
> Fixes: df351ef73789 ("nvme-fabrics: fix memory leak when parsing host ID option")
> Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
> Cc: Roland Dreier <roland@...estorage.com>
> ---
>   drivers/nvme/host/fabrics.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
> index eb46967bb0d5..9cee72a80472 100644
> --- a/drivers/nvme/host/fabrics.c
> +++ b/drivers/nvme/host/fabrics.c
> @@ -739,12 +739,13 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
>   				goto out;
>   			}
>   			ret = uuid_parse(p, &hostid);
> -			kfree(p);
>   			if (ret) {
>   				pr_err("Invalid hostid %s\n", p);
>   				ret = -EINVAL;
> +				kfree(p);
>   				goto out;
>   			}
> +			kfree(p);
>   			break;
>   		case NVMF_OPT_DUP_CONNECT:
>   			opts->duplicate_connect = true;
> 


Looks good,

Reviewed-by: Max Gurtovoy <maxg@...lanox.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ