aboutsummaryrefslogtreecommitdiffstats
path: root/fs/squashfs/decompressor.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/squashfs/decompressor.c')
-rw-r--r--fs/squashfs/decompressor.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/fs/squashfs/decompressor.c b/fs/squashfs/decompressor.c
index 234291f79ba5..ac22fe73b0ad 100644
--- a/fs/squashfs/decompressor.c
+++ b/fs/squashfs/decompressor.c
@@ -30,6 +30,7 @@
30#include "squashfs_fs_sb.h" 30#include "squashfs_fs_sb.h"
31#include "decompressor.h" 31#include "decompressor.h"
32#include "squashfs.h" 32#include "squashfs.h"
33#include "page_actor.h"
33 34
34/* 35/*
35 * This file (and decompressor.h) implements a decompressor framework for 36 * This file (and decompressor.h) implements a decompressor framework for
@@ -87,6 +88,7 @@ static void *get_comp_opts(struct super_block *sb, unsigned short flags)
87{ 88{
88 struct squashfs_sb_info *msblk = sb->s_fs_info; 89 struct squashfs_sb_info *msblk = sb->s_fs_info;
89 void *buffer = NULL, *comp_opts; 90 void *buffer = NULL, *comp_opts;
91 struct squashfs_page_actor *actor = NULL;
90 int length = 0; 92 int length = 0;
91 93
92 /* 94 /*
@@ -99,9 +101,14 @@ static void *get_comp_opts(struct super_block *sb, unsigned short flags)
99 goto out; 101 goto out;
100 } 102 }
101 103
102 length = squashfs_read_data(sb, &buffer, 104 actor = squashfs_page_actor_init(&buffer, 1, 0);
103 sizeof(struct squashfs_super_block), 0, NULL, 105 if (actor == NULL) {
104 PAGE_CACHE_SIZE, 1); 106 comp_opts = ERR_PTR(-ENOMEM);
107 goto out;
108 }
109
110 length = squashfs_read_data(sb,
111 sizeof(struct squashfs_super_block), 0, NULL, actor);
105 112
106 if (length < 0) { 113 if (length < 0) {
107 comp_opts = ERR_PTR(length); 114 comp_opts = ERR_PTR(length);
@@ -112,6 +119,7 @@ static void *get_comp_opts(struct super_block *sb, unsigned short flags)
112 comp_opts = squashfs_comp_opts(msblk, buffer, length); 119 comp_opts = squashfs_comp_opts(msblk, buffer, length);
113 120
114out: 121out:
122 kfree(actor);
115 kfree(buffer); 123 kfree(buffer);
116 return comp_opts; 124 return comp_opts;
117} 125}