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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y+n4Bgph6QpjU8m+@li-bb2b2a4c-3307-11b2-a85c-8fa5c3a69313.ibm.com>
Date:   Mon, 13 Feb 2023 14:12:46 +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 07/21] ext4: protect pa->pa_free in
 ext4_discard_allocated_blocks

On Fri, Feb 10, 2023 at 03:48:11AM +0800, Kemeng Shi wrote:
> If ext4_mb_mark_diskspace_used fails in ext4_mb_new_blocks, we may
> discard pa already in list. Protect pa with pa_lock to avoid race.
> 
> Signed-off-by: Kemeng Shi <shikemeng@...weicloud.com>
> ---
>  fs/ext4/mballoc.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index 433337ac8da2..4e1caac74b44 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -4263,8 +4263,11 @@ static void ext4_discard_allocated_blocks(struct ext4_allocation_context *ac)
>  		ext4_mb_unload_buddy(&e4b);
>  		return;
>  	}
> -	if (pa->pa_type == MB_INODE_PA)
> +	if (pa->pa_type == MB_INODE_PA) {
> +		spin_lock(&pa->pa_lock);
>  		pa->pa_free += ac->ac_b_ex.fe_len;
> +		spin_unlock(&pa->pa_lock);
> +	}
>  }
>  
>  /*
> -- 
> 2.30.0
> 
Looks correct. 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