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:   Tue, 3 Oct 2017 14:10:49 +0200
From:   Jan Kara <jack@...e.cz>
To:     Jens Axboe <axboe@...nel.dk>
Cc:     linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
        hannes@...xchg.org, jack@...e.cz, torvalds@...ux-foundation.org
Subject: Re: [PATCH 02/12] buffer: grow_dev_page() should use __GFP_NOFAIL
 for all cases

On Wed 27-09-17 14:13:49, Jens Axboe wrote:
> We currently it it for find_or_create_page(), which means that it
> cannot fail. Ensure we also pass in 'retry == true' to
> alloc_page_buffers(), which also ensure that it cannot fail.
> 
> After this, there are no failure cases in grow_dev_page() that
> occur because of a failed memory allocation.
> 
> Signed-off-by: Jens Axboe <axboe@...nel.dk>

Makes sense. You can add:

Reviewed-by: Jan Kara <jack@...e.cz>

								Honza

> ---
>  fs/buffer.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/fs/buffer.c b/fs/buffer.c
> index 1234ae343aef..3b60cd8456db 100644
> --- a/fs/buffer.c
> +++ b/fs/buffer.c
> @@ -988,8 +988,6 @@ grow_dev_page(struct block_device *bdev, sector_t block,
>  	gfp_mask |= __GFP_NOFAIL;
>  
>  	page = find_or_create_page(inode->i_mapping, index, gfp_mask);
> -	if (!page)
> -		return ret;
>  
>  	BUG_ON(!PageLocked(page));
>  
> @@ -1008,9 +1006,7 @@ grow_dev_page(struct block_device *bdev, sector_t block,
>  	/*
>  	 * Allocate some buffers for this page
>  	 */
> -	bh = alloc_page_buffers(page, size, false);
> -	if (!bh)
> -		goto failed;
> +	bh = alloc_page_buffers(page, size, true);
>  
>  	/*
>  	 * Link the page to the buffers and initialise them.  Take the
> -- 
> 2.7.4
> 
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ