X-Git-Url: https://git.stricted.de/?a=blobdiff_plain;f=fs%2Fsquashfs%2Fsuper.c;h=29cd014ed3a17a776db73b4c1e492f44d78cba4e;hb=afb9bd704c7116076879352a2cc2c43aa12c1e14;hp=ecaa2f7bdb8f16ebac1a00896cc9d1a870351788;hpb=10ce3cc919f50c2043b41ca968b43c26a3672600;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git diff --git a/fs/squashfs/super.c b/fs/squashfs/super.c index ecaa2f7bdb8f..29cd014ed3a1 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) @@ -316,11 +321,10 @@ check_directory_table: } insert_inode_hash(root); - sb->s_root = d_alloc_root(root); + sb->s_root = d_make_root(root); if (sb->s_root == NULL) { ERROR("Root inode create failed\n"); err = -ENOMEM; - iput(root); goto failed_mount; }