diff options
author | Gao Xiang <hsiangkao@linux.alibaba.com> | 2023-11-28 21:04:31 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-01-26 02:35:17 +0300 |
commit | 90219ce716834160b62ed3c050d6e8ecd26bdb5e (patch) | |
tree | 31373934b11e498f0d12c5cd08a3f243e98057b9 /fs/erofs | |
parent | a34946ec3de88a16cc3a87fdab50aad06255a22b (diff) | |
download | linux-90219ce716834160b62ed3c050d6e8ecd26bdb5e.tar.xz |
erofs: fix memory leak on short-lived bounced pages
[ Upstream commit 93d6fda7f926451a0fa1121b9558d75ca47e861e ]
Both MicroLZMA and DEFLATE algorithms can use short-lived pages on
demand for the overlapped inplace I/O decompression.
However, those short-lived pages are actually added to
`be->compressed_pages`. Thus, it should be checked instead of
`pcl->compressed_bvecs`.
The LZ4 algorithm doesn't work like this, so it won't be impacted.
Fixes: 67139e36d970 ("erofs: introduce `z_erofs_parse_in_bvecs'")
Reviewed-by: Yue Hu <huyue2@coolpad.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20231128180431.4116991-1-hsiangkao@linux.alibaba.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/erofs')
-rw-r--r-- | fs/erofs/zdata.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index a7e6847f6f8f..a33cd6757f98 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -1309,12 +1309,11 @@ out: put_page(page); } else { for (i = 0; i < pclusterpages; ++i) { - page = pcl->compressed_bvecs[i].page; + /* consider shortlived pages added when decompressing */ + page = be->compressed_pages[i]; if (erofs_page_is_managed(sbi, page)) continue; - - /* recycle all individual short-lived pages */ (void)z_erofs_put_shortlivedpage(be->pagepool, page); WRITE_ONCE(pcl->compressed_bvecs[i].page, NULL); } |