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: <Y+qTdjjN/D29V09I@li-bb2b2a4c-3307-11b2-a85c-8fa5c3a69313.ibm.com>
Date:   Tue, 14 Feb 2023 01:16:22 +0530
From:   Ojaswin Mujoo <ojaswin@...ux.ibm.com>
To:     Kemeng Shi <shikemeng@...weicloud.com>
Cc:     tytso@....edu, adilger.kernel@...ger.ca, jack@...e.cz,
        linux-ext4@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 08/21] ext4: add missed brelse in ext4_free_blocks_simple

On Fri, Feb 10, 2023 at 03:48:12AM +0800, Kemeng Shi wrote:
> Release bitmap buffer_head we got if error occurs.
> Besides, this patch remove unused assignment to err.
> 
> Signed-off-by: Kemeng Shi <shikemeng@...weicloud.com>
> ---
>  fs/ext4/mballoc.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index 4e1caac74b44..17ac98c501ed 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -5848,13 +5848,12 @@ static void ext4_free_blocks_simple(struct inode *inode, ext4_fsblk_t block,
>  	ext4_get_group_no_and_offset(sb, block, &group, &blkoff);
>  	bitmap_bh = ext4_read_block_bitmap(sb, group);
>  	if (IS_ERR(bitmap_bh)) {
> -		err = PTR_ERR(bitmap_bh);
>  		pr_warn("Failed to read block bitmap\n");
>  		return;
>  	}
>  	gdp = ext4_get_group_desc(sb, group, &gdp_bh);
>  	if (!gdp)
> -		return;
> +		goto err_out;
>  
>  	for (i = 0; i < count; i++) {
>  		if (!mb_test_bit(blkoff + i, bitmap_bh->b_data))
> @@ -5863,7 +5862,7 @@ static void ext4_free_blocks_simple(struct inode *inode, ext4_fsblk_t block,
>  	mb_clear_bits(bitmap_bh->b_data, blkoff, count);
>  	err = ext4_handle_dirty_metadata(NULL, NULL, bitmap_bh);
>  	if (err)
> -		return;
> +		goto err_out;
>  	ext4_free_group_clusters_set(
>  		sb, gdp, ext4_free_group_clusters(sb, gdp) +
>  		count - already_freed);
> @@ -5872,6 +5871,8 @@ static void ext4_free_blocks_simple(struct inode *inode, ext4_fsblk_t block,
>  	ext4_handle_dirty_metadata(NULL, NULL, gdp_bh);
>  	sync_dirty_buffer(bitmap_bh);
>  	sync_dirty_buffer(gdp_bh);
> +
> +err_out:
>  	brelse(bitmap_bh);
>  }
>  
> -- 
> 2.30.0
> 
Looks good, I'm also okay with removing the err variable out completely.
Either ways, feel free to add:

Reviewed-by: Ojaswin Mujoo <ojaswin@...ux.ibm.com> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ