diff options
author | Phillip Lougher <phillip@squashfs.org.uk> | 2013-11-24 00:40:49 +0000 |
---|---|---|
committer | Phillip Lougher <phillip@squashfs.org.uk> | 2013-11-24 01:02:50 +0000 |
commit | 6d565409503f4e1f74ac30de14e8c91a2b826cd8 (patch) | |
tree | 733a81c4b0b7cdcbdda144a0a4e0909469b75116 /fs | |
parent | ed4f381ec15e5f11724cdbc68cffd2c22d1eaebd (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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/squashfs/file_direct.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/squashfs/file_direct.c b/fs/squashfs/file_direct.c index 2943b2bfae48..62a0de6632e1 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]); |