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-next>] [day] [month] [year] [list]
Message-ID: <9CDF7393-5645-4E8A-9D68-01CF7F4C4955@amazon.com>
Date:   Thu, 30 Jun 2022 02:17:22 +0000
From:   "Kiselev, Oleg" <okiselev@...zon.com>
To:     "linux-ext4@...r.kernel.org" <linux-ext4@...r.kernel.org>
CC:     Theodore Ts'o <tytso@....edu>
Subject: [PATCH 2/2] ext4: avoid resizing to a partial cluster size

This patch avoids an attempt to resize the filesystem to an
unaligned cluster boundary.  An online resize to a size that is not
integral to cluster size results in the last iteration attempting to
grow the fs by a negative amount, which trips a BUG_ON and leaves the fs
with a corrupted in-memory superblock.

Signed-off-by: Oleg Kiselev <okiselev@...zon.com>
---
 fs/ext4/resize.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index 2acc9fca99ea..8803905907de 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -1624,7 +1624,8 @@ static int ext4_setup_next_flex_gd(struct super_block *sb,

 	o_blocks_count = ext4_blocks_count(es);

-	if (o_blocks_count == n_blocks_count)
+	if ((o_blocks_count == n_blocks_count) ||
+	    ((n_blocks_count - o_blocks_count) < sbi->s_cluster_ratio))
 		return 0;

 	ext4_get_group_no_and_offset(sb, o_blocks_count, &group, &last);
--
2.32.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ