diff --git a/SOURCES/0001-reisze2fs-sanity-check-free-block-group-counts-when-.patch b/SOURCES/0001-reisze2fs-sanity-check-free-block-group-counts-when-.patch
new file mode 100644
index 0000000..02266f9
--- /dev/null
+++ b/SOURCES/0001-reisze2fs-sanity-check-free-block-group-counts-when-.patch
@@ -0,0 +1,126 @@
+From 2c98da4e6a3e106c340972adedc6f79c4c1969f2 Mon Sep 17 00:00:00 2001
+From: Theodore Ts'o <tytso@mit.edu>
+Date: Tue, 28 Dec 2021 12:33:15 -0500
+Subject: [PATCH] reisze2fs: sanity check free block group counts when
+ calculating minimum size
+
+If one or more block group descriptor's free blocks count is insane,
+it's possible this can lead to a infinite loop in the function
+calculate_minimum_resize_size(), which is called by resize2fs -P or
+resize2fs -M.
+
+Add some sanity checks to avoid this.  In the case where the file
+system is corrupt, this will result in resize2fs -P reporting an
+incorrect value, but that's OK, since when we try to do an actual
+resize operation, resize2fs requires that the file system be freshly
+checked using e2fsck.
+
+https://github.com/tytso/e2fsprogs/issues/94
+
+Fixes: ac94445fc01f ("resize2fs: make minimum size estimates more reliable for mounted fs")
+Signed-off-by: Theodore Ts'o <tytso@mit.edu>
+---
+ resize/resize2fs.c        | 13 +++++++++--
+ tests/r_corrupt_fs/expect |  4 ++++
+ tests/r_corrupt_fs/name   |  1 +
+ tests/r_corrupt_fs/script | 45 +++++++++++++++++++++++++++++++++++++++
+ 4 files changed, 61 insertions(+), 2 deletions(-)
+ create mode 100644 tests/r_corrupt_fs/expect
+ create mode 100644 tests/r_corrupt_fs/name
+ create mode 100644 tests/r_corrupt_fs/script
+
+diff --git a/resize/resize2fs.c b/resize/resize2fs.c
+index 8a3d08db..26050fec 100644
+--- a/resize/resize2fs.c
++++ b/resize/resize2fs.c
+@@ -2928,8 +2928,17 @@ blk64_t calculate_minimum_resize_size(ext2_filsys fs, int flags)
+ 	/* calculate how many blocks are needed for data */
+ 	data_needed = ext2fs_blocks_count(fs->super);
+ 	for (grp = 0; grp < fs->group_desc_count; grp++) {
+-		data_needed -= calc_group_overhead(fs, grp, old_desc_blocks);
+-		data_needed -= ext2fs_bg_free_blocks_count(fs, grp);
++		__u32 n = ext2fs_bg_free_blocks_count(fs, grp);
++
++		if (n > EXT2_BLOCKS_PER_GROUP(fs->super))
++			n = EXT2_BLOCKS_PER_GROUP(fs->super);
++		n += calc_group_overhead(fs, grp, old_desc_blocks);
++		if (data_needed < n) {
++			if (flags & RESIZE_DEBUG_MIN_CALC)
++				printf("file system appears inconsistent?!?\n");
++			return ext2fs_blocks_count(fs->super);
++		}
++		data_needed -= n;
+ 	}
+ #ifdef RESIZE2FS_DEBUG
+ 	if (flags & RESIZE_DEBUG_MIN_CALC)
+diff --git a/tests/r_corrupt_fs/expect b/tests/r_corrupt_fs/expect
+new file mode 100644
+index 00000000..fe0f2bc4
+--- /dev/null
++++ b/tests/r_corrupt_fs/expect
+@@ -0,0 +1,4 @@
++mke2fs -q -F -t ext4 -o Linux -b 1024 test.img 32M
++debugfs -w -R "set_bg 1 free_blocks_count 65536" /tmp/foo.img
++resize2fs -P /tmp/foo.img
++Estimated minimum size of the filesystem: 6604
+diff --git a/tests/r_corrupt_fs/name b/tests/r_corrupt_fs/name
+new file mode 100644
+index 00000000..ed627419
+--- /dev/null
++++ b/tests/r_corrupt_fs/name
+@@ -0,0 +1 @@
++resize2fs -P of a corrupted file system
+diff --git a/tests/r_corrupt_fs/script b/tests/r_corrupt_fs/script
+new file mode 100644
+index 00000000..08af91ed
+--- /dev/null
++++ b/tests/r_corrupt_fs/script
+@@ -0,0 +1,45 @@
++if ! test -x $RESIZE2FS_EXE -o ! -x $DEBUGFS_EXE; then
++	echo "$test_name: $test_description: skipped (no debugfs/resize2fs)"
++	return 0
++fi
++
++OUT=$test_name.log
++if [ -f $test_dir/expect.gz ]; then
++	EXP=$test_name.tmp
++	gunzip < $test_dir/expect.gz > $EXP1
++else
++	EXP=$test_dir/expect
++fi
++
++echo mke2fs -q -F -t ext4 -o Linux -b 1024 test.img 32M > $OUT.new
++$MKE2FS -q -F -t ext4 -o Linux -b 1024 $TMPFILE 32M >> $OUT.new 2>&1
++
++echo debugfs -w -R \"set_bg 1 free_blocks_count 65536\" /tmp/foo.img >> $OUT.new
++$DEBUGFS -w -R "set_bg 1 free_blocks_count 65536" $TMPFILE > /dev/null 2>&1
++
++if type timeout > /dev/null 2>&1 ; then
++   TIMEOUT="timeout -v 30s"
++else
++   TIMEOUT=
++fi
++
++echo resize2fs -P /tmp/foo.img >> $OUT.new
++$TIMEOUT $RESIZE2FS -P $TMPFILE  >> $OUT.new 2>&1
++
++sed -f $cmd_dir/filter.sed < $OUT.new > $OUT
++
++rm -f $TMPFILE $OUT.new
++
++cmp -s $OUT $EXP
++status=$?
++
++if [ "$status" = 0 ] ; then
++	echo "$test_name: $test_description: ok"
++	touch $test_name.ok
++else
++	echo "$test_name: $test_description: failed"
++	diff $DIFF_OPTS $EXP $OUT > $test_name.failed
++	rm -f $test_name.tmp
++fi
++
++unset IMAGE OUT EXP TIMEOUT
+-- 
+2.34.1
+
diff --git a/SOURCES/0001-tests-specify-inode-size-in-r_corrupt_fs.patch b/SOURCES/0001-tests-specify-inode-size-in-r_corrupt_fs.patch
new file mode 100644
index 0000000..477e45f
--- /dev/null
+++ b/SOURCES/0001-tests-specify-inode-size-in-r_corrupt_fs.patch
@@ -0,0 +1,43 @@
+From 0ec67ba5063b1fdcad4142633338c2cc98b60b5b Mon Sep 17 00:00:00 2001
+From: Lukas Czerner <lczerner@redhat.com>
+Date: Wed, 16 Feb 2022 11:12:28 +0100
+Subject: [PATCH] tests: specify inode size in r_corrupt_fs
+
+Inode size will have an effect on the minimum resize size and this will
+have an effect on the test output. Stabilize the output by specifying
+the inode size instead of relying on the system configuration.
+
+Signed-off-by: Lukas Czerner <lczerner@redhat.com>
+---
+ tests/r_corrupt_fs/expect | 2 +-
+ tests/r_corrupt_fs/script | 4 ++--
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/tests/r_corrupt_fs/expect b/tests/r_corrupt_fs/expect
+index fe0f2bc4..fbc0c23e 100644
+--- a/tests/r_corrupt_fs/expect
++++ b/tests/r_corrupt_fs/expect
+@@ -1,4 +1,4 @@
+-mke2fs -q -F -t ext4 -o Linux -b 1024 test.img 32M
++mke2fs -q -F -t ext4 -o Linux -b 1024 -I 256 test.img 32M
+ debugfs -w -R "set_bg 1 free_blocks_count 65536" /tmp/foo.img
+ resize2fs -P /tmp/foo.img
+ Estimated minimum size of the filesystem: 6604
+diff --git a/tests/r_corrupt_fs/script b/tests/r_corrupt_fs/script
+index f6d3a89d..45bbe071 100644
+--- a/tests/r_corrupt_fs/script
++++ b/tests/r_corrupt_fs/script
+@@ -11,8 +11,8 @@ else
+ 	EXP=$test_dir/expect
+ fi
+ 
+-echo mke2fs -q -F -t ext4 -o Linux -b 1024 test.img 32M > $OUT.new
+-$MKE2FS -q -F -t ext4 -o Linux -b 1024 $TMPFILE 32M >> $OUT.new 2>&1
++echo mke2fs -q -F -t ext4 -o Linux -b 1024 -I 256 test.img 32M > $OUT.new
++$MKE2FS -q -F -t ext4 -o Linux -b 1024 -I 256 $TMPFILE 32M >> $OUT.new 2>&1
+ 
+ echo debugfs -w -R \"set_bg 1 free_blocks_count 65536\" /tmp/foo.img >> $OUT.new
+ $DEBUGFS -w -R "set_bg 1 free_blocks_count 65536" $TMPFILE > /dev/null 2>&1
+-- 
+2.34.1
+
diff --git a/SOURCES/0001-tests-support-older-versions-of-timeout-in-r_corrupt.patch b/SOURCES/0001-tests-support-older-versions-of-timeout-in-r_corrupt.patch
new file mode 100644
index 0000000..884299e
--- /dev/null
+++ b/SOURCES/0001-tests-support-older-versions-of-timeout-in-r_corrupt.patch
@@ -0,0 +1,31 @@
+From af09db229f74f447aec12e440252d8a94c049f26 Mon Sep 17 00:00:00 2001
+From: Theodore Ts'o <tytso@mit.edu>
+Date: Mon, 3 Jan 2022 22:45:37 -0500
+Subject: [PATCH] tests: support older versions of timeout in r_corrupt_fs
+
+Older versions of the timeout program in coreutils don't support the
+-v option.  (This is apparently still in use in the GNU/FreeBSD Debain
+port since coreutils hasn't built successfully since Coreutils version
+8.28.)
+
+Signed-off-by: Theodore Ts'o <tytso@mit.edu>
+---
+ tests/r_corrupt_fs/script | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tests/r_corrupt_fs/script b/tests/r_corrupt_fs/script
+index 08af91ed..f6d3a89d 100644
+--- a/tests/r_corrupt_fs/script
++++ b/tests/r_corrupt_fs/script
+@@ -17,7 +17,7 @@ $MKE2FS -q -F -t ext4 -o Linux -b 1024 $TMPFILE 32M >> $OUT.new 2>&1
+ echo debugfs -w -R \"set_bg 1 free_blocks_count 65536\" /tmp/foo.img >> $OUT.new
+ $DEBUGFS -w -R "set_bg 1 free_blocks_count 65536" $TMPFILE > /dev/null 2>&1
+ 
+-if type timeout > /dev/null 2>&1 ; then
++if timeout -v 1s true > /dev/null 2>&1 ; then
+    TIMEOUT="timeout -v 30s"
+ else
+    TIMEOUT=
+-- 
+2.34.1
+
diff --git a/SPECS/e2fsprogs.spec b/SPECS/e2fsprogs.spec
index b0e69d0..d12fe7f 100644
--- a/SPECS/e2fsprogs.spec
+++ b/SPECS/e2fsprogs.spec
@@ -1,7 +1,7 @@
 Summary: Utilities for managing ext2, ext3, and ext4 file systems
 Name: e2fsprogs
 Version: 1.45.6
-Release: 2%{?dist}
+Release: 4%{?dist}
 
 # License tags based on COPYING file distinctions for various components
 License: GPLv2
@@ -35,6 +35,9 @@ Patch4: e2fsprogs-1.45.6-Revert-libext2fs-revamp-bitmap-types-to-fix-LTO-warn.pa
 Patch5: e2fsprogs-1.45.6-Revert-libext2fs-hide-struct-ext2fs_hashmap-as-an-in.patch
 Patch6: e2fsprogs-1.45.6-ext2fs-fix-ABI-change-in-the-struct_ext2_filsys-stru.patch
 Patch7: e2fsprogs-1.45.6-mke2fs-Escape-double-quotes-when-parsing-mke2fs.conf.patch
+Patch8: 0001-reisze2fs-sanity-check-free-block-group-counts-when-.patch
+Patch9: 0001-tests-support-older-versions-of-timeout-in-r_corrupt.patch
+Patch10: 0001-tests-specify-inode-size-in-r_corrupt_fs.patch
 
 %description
 The e2fsprogs package contains a number of utilities for creating,
@@ -161,6 +164,9 @@ It was originally inspired by the Multics SubSystem library.
 %patch5 -p1
 %patch6 -p1
 %patch7 -p1
+%patch8 -p1
+%patch9 -p1
+%patch10 -p1
 
 %build
 %configure CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" \
@@ -323,6 +329,12 @@ exit 0
 %{_libdir}/pkgconfig/ss.pc
 
 %changelog
+* Wed Feb 16 2022 Lukas Czerner <lczerner@redhat.com> 1.45.6-4
+- Sanity check free block group counts when calculating minimum size (#2054129)
+
+* Thu Jan 27 2022 Lukas Czerner <lczerner@redhat.com> 1.45.6-3
+- Rebuild to ship libss-devel package (#1947449)
+
 * Thu Jun 17 2021 Lukas Czerner <lczerner@redhat.com> 1.45.6-2
 - Fix internal configuration pseudo file (#1889464)