Skip to contentSkip to conversation

Squashfs: fix failure to unlock pages on decompress error

PATCH New Phillip Lougher 1 participant 1 message Nov 24, 2013 SquashFS file system

lore
Share & tools
lore

Phillip Lougher

author maintainer
#0 lore raw

PATCH 1/1 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.

---
 fs/squashfs/file_direct.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
fs/squashfs/file_direct.c +4 -1
index 2943b2b..62a0de6 100644
@@ -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]);
Signature · 1 line
1.7.10.4