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: <a4dede60-3492-895e-f0c2-0edbeb4c338b@lightnvm.io>
Date:   Tue, 11 Apr 2017 12:41:26 +0200
From:   Matias Bjørling <mb@...htnvm.io>
To:     Javier González <jg@...htnvm.io>
Cc:     linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
        Javier González <javier@...xlabs.com>
Subject: Re: [PATCH 2/4] lightnvm: fix cleanup order of disk on init error

On 04/07/2017 08:31 PM, Javier González wrote:
> Reorder disk allocation such that the disk structure can be put
> safely.
>
> Signed-off-by: Javier González <javier@...xlabs.com>
> ---
>  drivers/lightnvm/core.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
> index da4c082..28e69a7 100644
> --- a/drivers/lightnvm/core.c
> +++ b/drivers/lightnvm/core.c
> @@ -263,15 +263,15 @@ static int nvm_create_tgt(struct nvm_dev *dev, struct nvm_ioctl_create *create)
>  		goto err_t;
>  	}
>
> +	tdisk = alloc_disk(0);
> +	if (!tdisk)
> +		goto err_dev;
> +
>  	tqueue = blk_alloc_queue_node(GFP_KERNEL, dev->q->node);
>  	if (!tqueue)
> -		goto err_dev;
> +		goto err_disk;
>  	blk_queue_make_request(tqueue, tt->make_rq);
>
> -	tdisk = alloc_disk(0);
> -	if (!tdisk)
> -		goto err_queue;
> -
>  	sprintf(tdisk->disk_name, "%s", create->tgtname);
>  	tdisk->flags = GENHD_FL_EXT_DEVT;
>  	tdisk->major = 0;
> @@ -307,9 +307,9 @@ static int nvm_create_tgt(struct nvm_dev *dev, struct nvm_ioctl_create *create)
>  	if (tt->exit)
>  		tt->exit(targetdata);
>  err_init:
> -	put_disk(tdisk);
> -err_queue:
>  	blk_cleanup_queue(tqueue);
> +err_disk:
> +	put_disk(tdisk);
>  err_dev:
>  	nvm_remove_tgt_dev(tgt_dev, 0);
>  err_t:
>
Thanks. Applied for 4.12.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ