Merge git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-linus
* git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-linus: squashfs: fix potential buffer over-run on 4K block file systems squashfs: add missing buffer free squashfs: fix warn_on when root inode is corrupted squashfs: fix locking bug in zlib wrapper
This commit is contained in:
commit
bc113f151a
|
@ -87,9 +87,8 @@ int squashfs_read_data(struct super_block *sb, void **buffer, u64 index,
|
|||
u64 cur_index = index >> msblk->devblksize_log2;
|
||||
int bytes, compressed, b = 0, k = 0, page = 0, avail;
|
||||
|
||||
|
||||
bh = kcalloc((msblk->block_size >> msblk->devblksize_log2) + 1,
|
||||
sizeof(*bh), GFP_KERNEL);
|
||||
bh = kcalloc(((srclength + msblk->devblksize - 1)
|
||||
>> msblk->devblksize_log2) + 1, sizeof(*bh), GFP_KERNEL);
|
||||
if (bh == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
|
@ -275,7 +275,8 @@ allocate_root:
|
|||
|
||||
err = squashfs_read_inode(root, root_inode);
|
||||
if (err) {
|
||||
iget_failed(root);
|
||||
make_bad_inode(root);
|
||||
iput(root);
|
||||
goto failed_mount;
|
||||
}
|
||||
insert_inode_hash(root);
|
||||
|
@ -353,6 +354,7 @@ static void squashfs_put_super(struct super_block *sb)
|
|||
kfree(sbi->id_table);
|
||||
kfree(sbi->fragment_index);
|
||||
kfree(sbi->meta_index);
|
||||
kfree(sbi->inode_lookup_table);
|
||||
kfree(sb->s_fs_info);
|
||||
sb->s_fs_info = NULL;
|
||||
}
|
||||
|
|
|
@ -128,8 +128,9 @@ static int zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer,
|
|||
goto release_mutex;
|
||||
}
|
||||
|
||||
length = stream->total_out;
|
||||
mutex_unlock(&msblk->read_data_mutex);
|
||||
return stream->total_out;
|
||||
return length;
|
||||
|
||||
release_mutex:
|
||||
mutex_unlock(&msblk->read_data_mutex);
|
||||
|
|
Loading…
Reference in New Issue