]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
f2fs: compress: fix to free compress page correctly
authorChao Yu <yuchao0@huawei.com>
Thu, 6 May 2021 09:00:43 +0000 (17:00 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 May 2021 08:13:14 +0000 (10:13 +0200)
[ Upstream commit a12cc5b423d4f36dc1a1ea3911e49cf9dff43898 ]

In error path of f2fs_write_compressed_pages(), it needs to call
f2fs_compress_free_page() to release temporary page.

Fixes: 5e6bbde95982 ("f2fs: introduce mempool for {,de}compress intermediate page allocation")
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/f2fs/compress.c

index d3f407ba64c9e2ad9b08caa1e4159b3e8b1a2911..b6b7b1552769dc437231e50ffde4201dc01744cc 100644 (file)
@@ -1321,7 +1321,8 @@ out_destroy_crypt:
        for (i = 0; i < cc->nr_cpages; i++) {
                if (!cc->cpages[i])
                        continue;
-               f2fs_put_page(cc->cpages[i], 1);
+               f2fs_compress_free_page(cc->cpages[i]);
+               cc->cpages[i] = NULL;
        }
 out_put_cic:
        kmem_cache_free(cic_entry_slab, cic);