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]
Message-ID: <24162f0c-e104-40cd-b0f3-0a14086db1b0@huaweicloud.com>
Date: Thu, 19 Sep 2024 16:59:16 +0800
From: Zhang Yi <yi.zhang@...weicloud.com>
To: alexjlzheng@...il.com, tytso@....edu, adilger.kernel@...ger.ca
Cc: linux-ext4@...r.kernel.org, linux-kernel@...r.kernel.org,
 Jinliang Zheng <alexjlzheng@...cent.com>
Subject: Re: [RESEND PATCH] ext4: disambiguate the return value of
 ext4_dio_write_end_io()

On 2024/9/19 16:25, alexjlzheng@...il.com wrote:
> From: Jinliang Zheng <alexjlzheng@...cent.com>
> 
> The commit 91562895f803 ("ext4: properly sync file size update after O_SYNC
> direct IO") causes confusion about the meaning of the return value of
> ext4_dio_write_end_io().
> 
> Specifically, when the ext4_handle_inode_extension() operation succeeds,
> ext4_dio_write_end_io() directly returns count instead of 0.
> 
> This does not cause a bug in the current kernel, but the semantics of the
> return value of the ext4_dio_write_end_io() function are wrong, which is
> likely to introduce bugs in the future code evolution.
> 
> Signed-off-by: Jinliang Zheng <alexjlzheng@...cent.com>

Make sense to me,

Reviewed-by: Zhang Yi <yi.zhang@...wei.com>

> ---
> Changelog: Just RESEND
> 
> v1: https://lore.kernel.org/linux-ext4/20240815112746.18570-1-alexjlzheng@tencent.com/
> ---
>  fs/ext4/file.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ext4/file.c b/fs/ext4/file.c
> index c89e434db6b7..6df5a92cec2b 100644
> --- a/fs/ext4/file.c
> +++ b/fs/ext4/file.c
> @@ -392,8 +392,9 @@ static int ext4_dio_write_end_io(struct kiocb *iocb, ssize_t size,
>  	 */
>  	if (pos + size <= READ_ONCE(EXT4_I(inode)->i_disksize) &&
>  	    pos + size <= i_size_read(inode))
> -		return size;
> -	return ext4_handle_inode_extension(inode, pos, size);
> +		return 0;
> +	error = ext4_handle_inode_extension(inode, pos, size);
> +	return error < 0 ? error : 0;
>  }
>  
>  static const struct iomap_dio_ops ext4_dio_write_ops = {


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ