提交 6d565409 编写于 作者: P Phillip Lougher

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: NRoman Peniaev <r.peniaev@gmail.com>
Signed-off-by: NPhillip Lougher <phillip@squashfs.org.uk>
上级 ed4f381e
...@@ -84,6 +84,9 @@ int squashfs_readpage_block(struct page *target_page, u64 block, int bsize) ...@@ -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, res = squashfs_read_cache(target_page, block, bsize, pages,
page); page);
if (res < 0)
goto mark_errored;
goto out; goto out;
} }
...@@ -119,7 +122,7 @@ int squashfs_readpage_block(struct page *target_page, u64 block, int bsize) ...@@ -119,7 +122,7 @@ int squashfs_readpage_block(struct page *target_page, u64 block, int bsize)
* dealt with by the caller * dealt with by the caller
*/ */
for (i = 0; i < pages; i++) { for (i = 0; i < pages; i++) {
if (page[i] == target_page) if (page[i] == NULL || page[i] == target_page)
continue; continue;
flush_dcache_page(page[i]); flush_dcache_page(page[i]);
SetPageError(page[i]); SetPageError(page[i]);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册