Skip to content

Commit 188de5e

Browse files
committed
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: Valid filesystems are flagged as bad by the corrupted fs patch
2 parents 5216a3c + 363911d commit 188de5e

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

fs/squashfs/block.c

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -184,15 +184,7 @@ int squashfs_read_data(struct super_block *sb, void **buffer, u64 index,
184184
offset = 0;
185185
}
186186

187-
if (msblk->stream.avail_out == 0) {
188-
if (page == pages) {
189-
ERROR("zlib_inflate tried to "
190-
"decompress too much data, "
191-
"expected %d bytes. Zlib "
192-
"data probably corrupt\n",
193-
srclength);
194-
goto release_mutex;
195-
}
187+
if (msblk->stream.avail_out == 0 && page < pages) {
196188
msblk->stream.next_out = buffer[page++];
197189
msblk->stream.avail_out = PAGE_CACHE_SIZE;
198190
}
@@ -209,25 +201,20 @@ int squashfs_read_data(struct super_block *sb, void **buffer, u64 index,
209201
zlib_init = 1;
210202
}
211203

212-
zlib_err = zlib_inflate(&msblk->stream, Z_NO_FLUSH);
204+
zlib_err = zlib_inflate(&msblk->stream, Z_SYNC_FLUSH);
213205

214206
if (msblk->stream.avail_in == 0 && k < b)
215207
put_bh(bh[k++]);
216208
} while (zlib_err == Z_OK);
217209

218210
if (zlib_err != Z_STREAM_END) {
219-
ERROR("zlib_inflate returned unexpected result"
220-
" 0x%x, srclength %d, avail_in %d,"
221-
" avail_out %d\n", zlib_err, srclength,
222-
msblk->stream.avail_in,
223-
msblk->stream.avail_out);
211+
ERROR("zlib_inflate error, data probably corrupt\n");
224212
goto release_mutex;
225213
}
226214

227215
zlib_err = zlib_inflateEnd(&msblk->stream);
228216
if (zlib_err != Z_OK) {
229-
ERROR("zlib_inflateEnd returned unexpected result 0x%x,"
230-
" srclength %d\n", zlib_err, srclength);
217+
ERROR("zlib_inflate error, data probably corrupt\n");
231218
goto release_mutex;
232219
}
233220
length = msblk->stream.total_out;

0 commit comments

Comments
 (0)