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: <94b1a0d8-f025-4a9b-8229-da8dfbe2b531@huaweicloud.com>
Date: Mon, 8 Dec 2025 21:08:56 +0800
From: Zhang Yi <yi.zhang@...weicloud.com>
To: Julian Sun <sunjunchao@...edance.com>, linux-ext4@...r.kernel.org
Cc: tytso@....edu, jack@...e.cz
Subject: Re: [PATCH] ext4: add missing down_write_data_sem in
 mext_move_extent().

On 12/8/2025 8:37 PM, Julian Sun wrote:
> Commit 962e8a01eab9 ("ext4: introduce mext_move_extent()") attempts to
> call ext4_swap_extents() on the failure path to recover the swapped
> extents, but fails to acquire locks for the two inode->i_data_sem,
> triggering the BUG_ON statement in ext4_swap_extents().
> 
> This issue can be fixed by calling ext4_double_down_write_data_sem()
> before ext4_swap_extents().
> 
> Signed-off-by: Julian Sun <sunjunchao@...edance.com>
> Reported-by: syzbot+4ea6bd8737669b423aae@...kaller.appspotmail.com
> Closes: https://lore.kernel.org/all/69368649.a70a0220.38f243.0093.GAE@google.com/
> Fixes: 962e8a01eab9 ("ext4: introduce mext_move_extent()")

Makes sense to me. Thanks for the fix.

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

> ---
>  fs/ext4/move_extent.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c
> index 0550fd30fd10..635fb8a52e0c 100644
> --- a/fs/ext4/move_extent.c
> +++ b/fs/ext4/move_extent.c
> @@ -393,9 +393,11 @@ static int mext_move_extent(struct mext_data *mext, u64 *m_len)
>  
>  repair_branches:
>  	ret2 = 0;
> +	ext4_double_down_write_data_sem(orig_inode, donor_inode);
>  	r_len = ext4_swap_extents(handle, donor_inode, orig_inode,
>  				  mext->donor_lblk, orig_map->m_lblk,
>  				  *m_len, 0, &ret2);
> +	ext4_double_up_write_data_sem(orig_inode, donor_inode);
>  	if (ret2 || r_len != *m_len) {
>  		ext4_error_inode_block(orig_inode, (sector_t)(orig_map->m_lblk),
>  				       EIO, "Unable to copy data block, data will be lost!");


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ