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: <aVklFae8eF4ZziSW@li-dc0c254c-257c-11b2-a85c-98b6c1322444.ibm.com>
Date: Sat, 3 Jan 2026 19:47:57 +0530
From: Ojaswin Mujoo <ojaswin@...ux.ibm.com>
To: Zhang Yi <yi.zhang@...weicloud.com>
Cc: linux-ext4@...r.kernel.org, linux-fsdevel@...r.kernel.org,
        linux-kernel@...r.kernel.org, tytso@....edu, adilger.kernel@...ger.ca,
        jack@...e.cz, ritesh.list@...il.com, yi.zhang@...wei.com,
        yizhang089@...il.com, libaokun1@...wei.com, yangerkun@...wei.com,
        yukuai@...as.com
Subject: Re: [PATCH -next v2 6/7] ext4: simply the mapping query logic in
 ext4_iomap_begin()

On Tue, Dec 23, 2025 at 09:18:01AM +0800, Zhang Yi wrote:
> From: Zhang Yi <yi.zhang@...wei.com>
> 
> In the write path mapping check of ext4_iomap_begin(), the return value
> 'ret' should never greater than orig_mlen. If 'ret' equals 'orig_mlen',
> it can be returned directly without checking IOMAP_ATOMIC.
> 
> Signed-off-by: Zhang Yi <yi.zhang@...wei.com>
> Reviewed-by: Jan Kara <jack@...e.cz>

Looks good, feel free to add:
Reviewed-by: Ojaswin Mujoo <ojaswin@...ux.ibm.com>

Regards,
ojaswin

> ---
>  fs/ext4/inode.c | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index b84a2a10dfb8..67fe7d0f47e3 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -3816,17 +3816,19 @@ static int ext4_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
>  		if (offset + length <= i_size_read(inode)) {
>  			ret = ext4_map_blocks(NULL, inode, &map, 0);
>  			/*
> -			 * For atomic writes the entire requested length should
> -			 * be mapped. For DAX we convert extents to initialized
> -			 * ones before copying the data, otherwise we do it
> -			 * after I/O so there's no need to call into
> -			 * ext4_iomap_alloc().
> +			 * For DAX we convert extents to initialized ones before
> +			 * copying the data, otherwise we do it after I/O so
> +			 * there's no need to call into ext4_iomap_alloc().
>  			 */
>  			if ((map.m_flags & EXT4_MAP_MAPPED) ||
>  			    (!(flags & IOMAP_DAX) &&
>  			     (map.m_flags & EXT4_MAP_UNWRITTEN))) {
> -				if ((!(flags & IOMAP_ATOMIC) && ret > 0) ||
> -				   (flags & IOMAP_ATOMIC && ret >= orig_mlen))
> +				/*
> +				 * For atomic writes the entire requested
> +				 * length should be mapped.
> +				 */
> +				if (ret == orig_mlen ||
> +				    (!(flags & IOMAP_ATOMIC) && ret > 0))
>  					goto out;
>  			}
>  			map.m_len = orig_mlen;
> -- 
> 2.52.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ