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] [day] [month] [year] [list]
Date:   Wed, 7 Dec 2022 20:45:11 +0800
From:   Pengfei Xu <pengfei.xu@...el.com>
To:     Jan Kara <jack@...e.cz>
CC:     Ted Tso <tytso@....edu>, <linux-ext4@...r.kernel.org>,
        <heng.su@...el.com>, <pengfei.xu@...el.com>
Subject: Re: [PATCH 2/2] ext4: Avoid unaccounted block allocation when
 expanding inode

Hi Jan Kara,

On 2022-12-07 at 12:59:28 +0100, Jan Kara wrote:
> When expanding inode space in ext4_expand_extra_isize_ea() we may need
> to allocate external xattr block. If quota is not initialized for the
> inode, the block allocation will not be accounted into quota usage. Make
> sure the quota is initialized before we try to expand inode space.
> 
> Reported-by: Pengfei Xu <pengfei.xu@...el.com>
> Link: https://lore.kernel.org/all/Y5BT+k6xWqthZc1P@xpf.sh.intel.com
> Signed-off-by: Jan Kara <jack@...e.cz>
> ---
>  fs/ext4/inode.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 2b5ef1b64249..62c81af57bb0 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -5853,6 +5853,14 @@ static int __ext4_expand_extra_isize(struct inode *inode,
>  		return 0;
>  	}
>  
> +	/*
> +	 * We may need to allocate external xattr block so we need quotas
> +	 * initialized. Here we can be called with various locks held so we
> +	 * cannot affort to initialize quotas ourselves. So just bail.
> +	 */
> +	if (dquot_initialize_needed(inode))
> +		return -EAGAIN;
> +
>  	/* try to expand with EAs present */
>  	error = ext4_expand_extra_isize_ea(inode, new_extra_isize,
>  					   raw_inode, handle);

I installed the both patches on top of v6.1-rc8, and tested again, and
this issue was gone, result shows that it's fixed.
Attached is the dmesg.

Thanks!
BR.

> -- 
> 2.35.3
> 

View attachment "6.1-rc8_with_jan_patch_fixed_dmesg.log" of type "text/plain" (35904 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ