Skip to content

Commit 75a5221

Browse files
committed
erofs: fix memory leak of LZMA global compressed deduplication
When stressing microLZMA EROFS images with the new global compressed deduplication feature enabled (`-Ededupe`), I found some short-lived temporary pages weren't properly released, which could slowly cause unexpected OOMs hours later. Let's fix it now (LZ4 and DEFLATE don't have this issue.) Fixes: 5c2a642 ("erofs: introduce partial-referenced pclusters") Signed-off-by: Gao Xiang <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 0bb80ec commit 75a5221

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fs/erofs/decompressor_lzma.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,12 @@ int z_erofs_lzma_decompress(struct z_erofs_decompress_req *rq,
217217
strm->buf.out_size = min_t(u32, outlen,
218218
PAGE_SIZE - pageofs);
219219
outlen -= strm->buf.out_size;
220-
if (!rq->out[no] && rq->fillgaps) /* deduped */
220+
if (!rq->out[no] && rq->fillgaps) { /* deduped */
221221
rq->out[no] = erofs_allocpage(pagepool,
222222
GFP_KERNEL | __GFP_NOFAIL);
223+
set_page_private(rq->out[no],
224+
Z_EROFS_SHORTLIVED_PAGE);
225+
}
223226
if (rq->out[no])
224227
strm->buf.out = kmap(rq->out[no]) + pageofs;
225228
pageofs = 0;

0 commit comments

Comments
 (0)