aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-04-27 11:59:38 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-04-27 11:59:38 -0400
commitbc113f151a73cb2195c2fb40d7d70acf8e2f9208 (patch)
tree026c1fe1d01a16724c8fff538b1fe29bbf1ef06b /fs
parent93a9248af27aa83c08910d3e38b584678b1dc534 (diff)
parente0d1f70010dce062ccce1bbd940a661e60b82631 (diff)
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
Diffstat (limited to 'fs')
-rw-r--r--fs/squashfs/block.c5
-rw-r--r--fs/squashfs/super.c4
-rw-r--r--fs/squashfs/zlib_wrapper.c3
3 files changed, 7 insertions, 5 deletions
diff --git a/fs/squashfs/block.c b/fs/squashfs/block.c
index 1cb0d81b164b..653c030eb840 100644
--- a/fs/squashfs/block.c
+++ b/fs/squashfs/block.c
@@ -87,9 +87,8 @@ int squashfs_read_data(struct super_block *sb, void **buffer, u64 index,
87 u64 cur_index = index >> msblk->devblksize_log2; 87 u64 cur_index = index >> msblk->devblksize_log2;
88 int bytes, compressed, b = 0, k = 0, page = 0, avail; 88 int bytes, compressed, b = 0, k = 0, page = 0, avail;
89 89
90 90 bh = kcalloc(((srclength + msblk->devblksize - 1)
91 bh = kcalloc((msblk->block_size >> msblk->devblksize_log2) + 1, 91 >> msblk->devblksize_log2) + 1, sizeof(*bh), GFP_KERNEL);
92 sizeof(*bh), GFP_KERNEL);
93 if (bh == NULL) 92 if (bh == NULL)
94 return -ENOMEM; 93 return -ENOMEM;
95 94
diff --git a/fs/squashfs/super.c b/fs/squashfs/super.c
index 3550aec2f655..48b6f4a385a6 100644
--- a/fs/squashfs/super.c
+++ b/fs/squashfs/super.c
@@ -275,7 +275,8 @@ allocate_root:
275 275
276 err = squashfs_read_inode(root, root_inode); 276 err = squashfs_read_inode(root, root_inode);
277 if (err) { 277 if (err) {
278 iget_failed(root); 278 make_bad_inode(root);
279 iput(root);
279 goto failed_mount; 280 goto failed_mount;
280 } 281 }
281 insert_inode_hash(root); 282 insert_inode_hash(root);
@@ -353,6 +354,7 @@ static void squashfs_put_super(struct super_block *sb)
353 kfree(sbi->id_table); 354 kfree(sbi->id_table);
354 kfree(sbi->fragment_index); 355 kfree(sbi->fragment_index);
355 kfree(sbi->meta_index); 356 kfree(sbi->meta_index);
357 kfree(sbi->inode_lookup_table);
356 kfree(sb->s_fs_info); 358 kfree(sb->s_fs_info);
357 sb->s_fs_info = NULL; 359 sb->s_fs_info = NULL;
358 } 360 }
diff --git a/fs/squashfs/zlib_wrapper.c b/fs/squashfs/zlib_wrapper.c
index 15a03d0fb9f3..7a603874e483 100644
--- a/fs/squashfs/zlib_wrapper.c
+++ b/fs/squashfs/zlib_wrapper.c
@@ -128,8 +128,9 @@ static int zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer,
128 goto release_mutex; 128 goto release_mutex;
129 } 129 }
130 130
131 length = stream->total_out;
131 mutex_unlock(&msblk->read_data_mutex); 132 mutex_unlock(&msblk->read_data_mutex);
132 return stream->total_out; 133 return length;
133 134
134release_mutex: 135release_mutex:
135 mutex_unlock(&msblk->read_data_mutex); 136 mutex_unlock(&msblk->read_data_mutex);