Skip to content

Commit bb81085

Browse files
Jaegeuk Kimgregkh
authored andcommitted
f2fs: should put a page beyond EOF when preparing a write
[ Upstream commit 9605f75 ] The prepare_compress_overwrite() gets/locks a page to prepare a read, and calls f2fs_read_multi_pages() which checks EOF first. If there's any page beyond EOF, we unlock the page and set cc->rpages[i] = NULL, which we can't put the page anymore. This makes page leak, so let's fix by putting that page. Fixes: a949dc5 ("f2fs: compress: fix race condition of overwrite vs truncate") Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent d04925f commit bb81085

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎fs/f2fs/data.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2219,6 +2219,8 @@ int f2fs_read_multi_pages(struct compress_ctx *cc, struct bio **bio_ret,
22192219
continue;
22202220
}
22212221
unlock_page(page);
2222+
if (for_write)
2223+
put_page(page);
22222224
cc->rpages[i] = NULL;
22232225
cc->nr_rpages--;
22242226
}

0 commit comments

Comments
 (0)