diff options
| author | Nanzhe Zhao <nzzhao@126.com> | 2026-01-05 23:30:57 +0800 |
|---|---|---|
| committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2026-01-07 03:17:08 +0000 |
| commit | 00feea1dfcea2cc7c22e58b6325f72637c6ea217 (patch) | |
| tree | 84999d6b25bc4462c15fe6b07997e76ce386fba4 | |
| parent | d36de29f4bb59b24e57ff22403baae6fc7e89bd8 (diff) | |
| download | linux-00feea1dfcea2cc7c22e58b6325f72637c6ea217.tar.gz linux-00feea1dfcea2cc7c22e58b6325f72637c6ea217.zip | |
f2fs: Zero f2fs_folio_state on allocation
f2fs_folio_state is attached to folio->private and is expected to start
with read_pages_pending == 0. However, the structure was allocated from
ffs_entry_slab without being fully initialized, which can leave
read_pages_pending with stale values.
Allocate the object with __GFP_ZERO so all fields are reliably zeroed at
creation time.
Signed-off-by: Nanzhe Zhao <nzzhao@126.com>
Reviewed-by: Barry Song <baohua@kernel.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
| -rw-r--r-- | fs/f2fs/data.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 7dee58fbfc0b..b5b39a788ee5 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2399,7 +2399,8 @@ static struct f2fs_folio_state *ffs_find_or_alloc(struct folio *folio) if (ffs) return ffs; - ffs = f2fs_kmem_cache_alloc(ffs_entry_slab, GFP_NOIO, true, NULL); + ffs = f2fs_kmem_cache_alloc(ffs_entry_slab, + GFP_NOIO | __GFP_ZERO, true, NULL); spin_lock_init(&ffs->state_lock); folio_attach_private(folio, ffs); |
