mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-05-26 11:40:24 +02:00
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>
This commit is contained in:
+2
-1
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user