Mounting a block of any size, but 128K, leads to erroneous data in blocks beyond the first. It would be nice to support the full-range of block sizes supported by Linux, but for now, let's just enforce that the default block size of 128K is used and refuse the mount with an error message if the image has been generated with a non-default block size. Reported-by: Michael Olbrich <mol@xxxxxxxxxxxxxx> Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> --- fs/squashfs/Kconfig | 5 +---- fs/squashfs/super.c | 7 +++++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/fs/squashfs/Kconfig b/fs/squashfs/Kconfig index af187a2a8ac7..c57ef0044cdd 100644 --- a/fs/squashfs/Kconfig +++ b/fs/squashfs/Kconfig @@ -9,10 +9,7 @@ menuconfig FS_SQUASHFS filesystem for Linux. It uses zlib, lzo or xz compression to compress both files, inodes and directories. Inodes in the system are very small and all blocks are packed to minimise data overhead. - Block sizes greater than 4K are supported up to a maximum of 1 Mbytes - (default block size 128K). SquashFS 4.0 supports 64 bit filesystems - and files (larger than 4GB), full uid/gid information, hard links and - timestamps. + Only the default block sizes of 128K is supported. Squashfs is intended for general read-only filesystem use, for archival use (i.e. in cases where a .tar.gz file may be used), and in diff --git a/fs/squashfs/super.c b/fs/squashfs/super.c index f3dac6de1527..7695c9e0fd25 100644 --- a/fs/squashfs/super.c +++ b/fs/squashfs/super.c @@ -31,6 +31,7 @@ #include <linux/pagemap.h> #include <linux/magic.h> #include <linux/bitops.h> +#include <linux/sizes.h> #include "page_actor.h" #include "squashfs_fs.h" @@ -172,6 +173,12 @@ static int squashfs_fill_super(struct super_block *sb, void *data, int silent) goto failed_mount; } + if (msblk->block_size != SZ_128K) { + ERROR("filesystem block size (%d) != 128K. This is " + "currently not supported!\n", msblk->block_size); + goto failed_mount; + } + /* Check block log for sanity */ msblk->block_log = le16_to_cpu(sblk->block_log); if (msblk->block_log > SQUASHFS_FILE_MAX_LOG) -- 2.39.2