diff mbox series

src/fiemap-tester: check for illegal block size

Message ID 20181011114522.7537-1-amir73il@gmail.com (mailing list archive)
State New, archived
Headers show
Series src/fiemap-tester: check for illegal block size | expand

Commit Message

Amir Goldstein Oct. 11, 2018, 11:45 a.m. UTC
There was a regression in v4.19-rc1 that caused FIGETBSZ ioctl
to return 0 on an overlayfs file.

That regression went unnoticed because the xfstests that run
fiemap-tester program terminated in success status after not doing
much instead of failing.

Check for invalid value of block size returned by FIGETBSZ ioctl,
so these tests can detect the regression.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
 src/fiemap-tester.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/src/fiemap-tester.c b/src/fiemap-tester.c
index 97ac5ad0..5b0af478 100644
--- a/src/fiemap-tester.c
+++ b/src/fiemap-tester.c
@@ -561,6 +561,12 @@  main(int argc, char **argv)
 		exit(1);
 	}
 
+	if (blocksize <= 0) {
+		printf("Illegal filesystem block size\n");
+		close(fd);
+		exit(1);
+	}
+
 #ifdef HAVE_FALLOCATE
 	/* if fallocate passes, then we can do preallocation, else not */
 	if (prealloc) {