Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-linus
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Linus Torvalds committed Apr 27, 2010
2 parents 93a9248 + e0d1f70 commit bc113f1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
5 changes: 2 additions & 3 deletions fs/squashfs/block.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 3 additions & 1 deletion fs/squashfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,8 @@ static int squashfs_fill_super(struct super_block *sb, void *data, int silent)

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);
Expand Down Expand Up @@ -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;
}
Expand Down
3 changes: 2 additions & 1 deletion fs/squashfs/zlib_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit bc113f1

Please sign in to comment.