diff options
Diffstat (limited to 'fs/squashfs/super.c')
-rw-r--r-- | fs/squashfs/super.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/fs/squashfs/super.c b/fs/squashfs/super.c index 6c197ef53add..b9f8c6a92d6a 100644 --- a/fs/squashfs/super.c +++ b/fs/squashfs/super.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #include <linux/pagemap.h> | 35 | #include <linux/pagemap.h> |
36 | #include <linux/init.h> | 36 | #include <linux/init.h> |
37 | #include <linux/module.h> | 37 | #include <linux/module.h> |
38 | #include <linux/zlib.h> | ||
39 | #include <linux/magic.h> | 38 | #include <linux/magic.h> |
40 | 39 | ||
41 | #include "squashfs_fs.h" | 40 | #include "squashfs_fs.h" |
@@ -87,12 +86,9 @@ static int squashfs_fill_super(struct super_block *sb, void *data, int silent) | |||
87 | } | 86 | } |
88 | msblk = sb->s_fs_info; | 87 | msblk = sb->s_fs_info; |
89 | 88 | ||
90 | msblk->stream.workspace = kmalloc(zlib_inflate_workspacesize(), | 89 | msblk->stream = squashfs_zlib_init(); |
91 | GFP_KERNEL); | 90 | if (msblk->stream == NULL) |
92 | if (msblk->stream.workspace == NULL) { | ||
93 | ERROR("Failed to allocate zlib workspace\n"); | ||
94 | goto failure; | 91 | goto failure; |
95 | } | ||
96 | 92 | ||
97 | sblk = kzalloc(sizeof(*sblk), GFP_KERNEL); | 93 | sblk = kzalloc(sizeof(*sblk), GFP_KERNEL); |
98 | if (sblk == NULL) { | 94 | if (sblk == NULL) { |
@@ -292,17 +288,17 @@ failed_mount: | |||
292 | squashfs_cache_delete(msblk->block_cache); | 288 | squashfs_cache_delete(msblk->block_cache); |
293 | squashfs_cache_delete(msblk->fragment_cache); | 289 | squashfs_cache_delete(msblk->fragment_cache); |
294 | squashfs_cache_delete(msblk->read_page); | 290 | squashfs_cache_delete(msblk->read_page); |
291 | squashfs_zlib_free(msblk->stream); | ||
295 | kfree(msblk->inode_lookup_table); | 292 | kfree(msblk->inode_lookup_table); |
296 | kfree(msblk->fragment_index); | 293 | kfree(msblk->fragment_index); |
297 | kfree(msblk->id_table); | 294 | kfree(msblk->id_table); |
298 | kfree(msblk->stream.workspace); | ||
299 | kfree(sb->s_fs_info); | 295 | kfree(sb->s_fs_info); |
300 | sb->s_fs_info = NULL; | 296 | sb->s_fs_info = NULL; |
301 | kfree(sblk); | 297 | kfree(sblk); |
302 | return err; | 298 | return err; |
303 | 299 | ||
304 | failure: | 300 | failure: |
305 | kfree(msblk->stream.workspace); | 301 | squashfs_zlib_free(msblk->stream); |
306 | kfree(sb->s_fs_info); | 302 | kfree(sb->s_fs_info); |
307 | sb->s_fs_info = NULL; | 303 | sb->s_fs_info = NULL; |
308 | return -ENOMEM; | 304 | return -ENOMEM; |
@@ -346,10 +342,10 @@ static void squashfs_put_super(struct super_block *sb) | |||
346 | squashfs_cache_delete(sbi->block_cache); | 342 | squashfs_cache_delete(sbi->block_cache); |
347 | squashfs_cache_delete(sbi->fragment_cache); | 343 | squashfs_cache_delete(sbi->fragment_cache); |
348 | squashfs_cache_delete(sbi->read_page); | 344 | squashfs_cache_delete(sbi->read_page); |
345 | squashfs_zlib_free(sbi->stream); | ||
349 | kfree(sbi->id_table); | 346 | kfree(sbi->id_table); |
350 | kfree(sbi->fragment_index); | 347 | kfree(sbi->fragment_index); |
351 | kfree(sbi->meta_index); | 348 | kfree(sbi->meta_index); |
352 | kfree(sbi->stream.workspace); | ||
353 | kfree(sb->s_fs_info); | 349 | kfree(sb->s_fs_info); |
354 | sb->s_fs_info = NULL; | 350 | sb->s_fs_info = NULL; |
355 | } | 351 | } |