VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   33 Branches   57 Tags
author: Phillip Lougher <phillip@squashfs.org.uk> 2012-03-09 03:02:59 +0000 committer: Phillip Lougher <phillip@squashfs.org.uk> 2012-03-10 03:01:02 +0000 commit: 4b0180a49f08dd1c681cdc99edc9e0cec0a833fa parent: 2158d3fd2769546cd9004eaeb776fee946155238
Commit Summary:
Squashfs: add mount time sanity check for block_size and block_log match
Diffstat:
1 file changed, 5 insertions, 0 deletions
diff --git a/fs/squashfs/super.c b/fs/squashfs/super.c
index ecaa2f7bdb8f..a55a9c57be18 100644
--- a/fs/squashfs/super.c
+++ b/fs/squashfs/super.c
@@ -158,10 +158,15 @@ static int squashfs_fill_super(struct super_block *sb, void *data, int silent)
 		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)
 		goto failed_mount;
 
+	/* Check that block_size and block_log match */
+	if (msblk->block_size != (1 << msblk->block_log))
+		goto failed_mount;
+
 	/* Check the root inode for sanity */
 	root_inode = le64_to_cpu(sblk->root_inode);
 	if (SQUASHFS_INODE_OFFSET(root_inode) > SQUASHFS_METADATA_SIZE)