aboutsummaryrefslogtreecommitdiff
path: root/fs/squashfs/file_direct.c
diff options
context:
space:
mode:
authorPhillip Lougher <phillip@squashfs.org.uk>2013-11-24 00:40:49 +0000
committerMister Oyster <oysterized@gmail.com>2017-04-11 11:00:18 +0200
commit7df0dd145de352b1cbdf36fbb3ba4ea92427d85f (patch)
tree7f594e97a51b28749387d8115e400d3d836682b0 /fs/squashfs/file_direct.c
parent416888f75da30d86a87694a669ed523ae20ced9d (diff)
Squashfs: fix failure to unlock pages on decompress error
Direct decompression into the page cache. If we fall back to using an intermediate buffer (because we cannot grab all the page cache pages) and we get a decompress fail, we forgot to release the pages. Reported-by: Roman Peniaev <r.peniaev@gmail.com> Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk> Change-Id: I2c7b391bd5f99a9c8af55222d28db41742768335
Diffstat (limited to 'fs/squashfs/file_direct.c')
-rw-r--r--fs/squashfs/file_direct.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/squashfs/file_direct.c b/fs/squashfs/file_direct.c
index 2943b2bfa..62a0de663 100644
--- a/fs/squashfs/file_direct.c
+++ b/fs/squashfs/file_direct.c
@@ -84,6 +84,9 @@ int squashfs_readpage_block(struct page *target_page, u64 block, int bsize)
*/
res = squashfs_read_cache(target_page, block, bsize, pages,
page);
+ if (res < 0)
+ goto mark_errored;
+
goto out;
}
@@ -119,7 +122,7 @@ mark_errored:
* dealt with by the caller
*/
for (i = 0; i < pages; i++) {
- if (page[i] == target_page)
+ if (page[i] == NULL || page[i] == target_page)
continue;
flush_dcache_page(page[i]);
SetPageError(page[i]);