Commit bc113f15 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 93a9248a e0d1f700
...@@ -87,9 +87,8 @@ int squashfs_read_data(struct super_block *sb, void **buffer, u64 index, ...@@ -87,9 +87,8 @@ int squashfs_read_data(struct super_block *sb, void **buffer, u64 index,
u64 cur_index = index >> msblk->devblksize_log2; u64 cur_index = index >> msblk->devblksize_log2;
int bytes, compressed, b = 0, k = 0, page = 0, avail; int bytes, compressed, b = 0, k = 0, page = 0, avail;
bh = kcalloc(((srclength + msblk->devblksize - 1)
bh = kcalloc((msblk->block_size >> msblk->devblksize_log2) + 1, >> msblk->devblksize_log2) + 1, sizeof(*bh), GFP_KERNEL);
sizeof(*bh), GFP_KERNEL);
if (bh == NULL) if (bh == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -275,7 +275,8 @@ allocate_root: ...@@ -275,7 +275,8 @@ allocate_root:
err = squashfs_read_inode(root, root_inode); err = squashfs_read_inode(root, root_inode);
if (err) { if (err) {
iget_failed(root); make_bad_inode(root);
iput(root);
goto failed_mount; goto failed_mount;
} }
insert_inode_hash(root); insert_inode_hash(root);
...@@ -353,6 +354,7 @@ static void squashfs_put_super(struct super_block *sb) ...@@ -353,6 +354,7 @@ static void squashfs_put_super(struct super_block *sb)
kfree(sbi->id_table); kfree(sbi->id_table);
kfree(sbi->fragment_index); kfree(sbi->fragment_index);
kfree(sbi->meta_index); kfree(sbi->meta_index);
kfree(sbi->inode_lookup_table);
kfree(sb->s_fs_info); kfree(sb->s_fs_info);
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
} }
......
...@@ -128,8 +128,9 @@ static int zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer, ...@@ -128,8 +128,9 @@ static int zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer,
goto release_mutex; goto release_mutex;
} }
length = stream->total_out;
mutex_unlock(&msblk->read_data_mutex); mutex_unlock(&msblk->read_data_mutex);
return stream->total_out; return length;
release_mutex: release_mutex:
mutex_unlock(&msblk->read_data_mutex); mutex_unlock(&msblk->read_data_mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment