]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commit
fuse2fs: fix incorrect EOFS input handling in FITRIM
authorDarrick J. Wong <djwong@kernel.org>
Thu, 31 Jul 2025 14:38:21 +0000 (10:38 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 31 Jul 2025 14:41:04 +0000 (10:41 -0400)
commit62b2a1619d858f65acaa6ce64623fb8684a88882
tree80f338f0c81611aa9d7209b2600771f54d337365
parente3a1437758398e8adcd141aabb7c572af8ef356a
fuse2fs: fix incorrect EOFS input handling in FITRIM

FITRIM isn't well documented, which means that I missed that
len == -1ULL always means "trim to end of filesystem".  generic/260 has
been failing with:

--- a/tests/generic/260.out      2025-04-30 16:20:44.532797310 -0700
+++ b/tests/generic/260.out.bad        2025-07-03 11:44:26.946394170 -0700
@@ -11,4 +11,5 @@
 [+] Default length with start set (should succeed)
 [+] Length beyond the end of fs (should succeed)
 [+] Length beyond the end of fs with start set (should succeed)
+After the full fs discard 0 bytes were discarded however the file system is 10401542144 bytes long.
 Test done

because the addition used to compute end suffered an integer overflow,
resulting in end < start, which meant nothing happened.  Fix this by
explicitly checking for -1ULL.

Cc: linux-ext4@vger.kernel.org # v1.43
Fixes: 81cbf1ef4f5dab ("misc: add fuse2fs, a FUSE server for e2fsprogs")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
misc/fuse2fs.c