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: <65f45d01-2f22-e7b9-1eb9-9055a7b483cd@suse.de>
Date:   Wed, 12 May 2021 17:15:52 +0200
From:   Hannes Reinecke <hare@...e.de>
To:     Luis Chamberlain <mcgrof@...nel.org>, axboe@...nel.dk
Cc:     bvanassche@....org, ming.lei@...hat.com, hch@...radead.org,
        jack@...e.cz, osandov@...com, linux-block@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 6/8] loop: add error handling support for add_disk()

On 5/12/21 8:46 AM, Luis Chamberlain wrote:
> We never checked for errors on add_disk() as this function
> returned void. Now that this is fixed, use the shiny new
> error handling.
> 
> Signed-off-by: Luis Chamberlain <mcgrof@...nel.org>
> ---
>   drivers/block/loop.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/block/loop.c b/drivers/block/loop.c
> index d58d68f3c7cd..a22d8c985bf3 100644
> --- a/drivers/block/loop.c
> +++ b/drivers/block/loop.c
> @@ -2170,10 +2170,15 @@ static int loop_add(struct loop_device **l, int i)
>   	disk->private_data	= lo;
>   	disk->queue		= lo->lo_queue;
>   	sprintf(disk->disk_name, "loop%d", i);
> -	add_disk(disk);
> +	err = add_disk(disk);
> +	if (err)
> +		goto out_put_disk;
> +
>   	*l = lo;
>   	return lo->lo_number;
>   
> +out_put_disk:
> +	put_disk(lo->lo_disk);
>   out_free_queue:
>   	blk_cleanup_queue(lo->lo_queue);
>   out_cleanup_tags:
> 
Reviewed-by: Hannes Reinecke <hare@...e.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@...e.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ