Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Nanzhe Zhao and committed by
Jaegeuk Kim
00feea1d d36de29f

+2 -1
+2 -1
fs/f2fs/data.c
··· 2399 2399 if (ffs) 2400 2400 return ffs; 2401 2401 2402 - ffs = f2fs_kmem_cache_alloc(ffs_entry_slab, GFP_NOIO, true, NULL); 2402 + ffs = f2fs_kmem_cache_alloc(ffs_entry_slab, 2403 + GFP_NOIO | __GFP_ZERO, true, NULL); 2403 2404 2404 2405 spin_lock_init(&ffs->state_lock); 2405 2406 folio_attach_private(folio, ffs);