From nobody Mon Feb 9 12:15:44 2026 Received: from m16.mail.126.com (m16.mail.126.com [220.197.31.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F0E88303C83 for ; Mon, 5 Jan 2026 15:34:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.197.31.8 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767627245; cv=none; b=Zv+ZIP+u5ztSlKTN2j5Edyt2ER/lJ11l+ImOE6Afv/oO7QNFrHn7TTnLRAx0QL8Eu4dkJSsRcDT9b37x1GvNaTLMfwxStJljpTIAt964Aot7t40l7fhEesgzu5shBu2LnrE2+/HGTUEd3Pt/i5s3YjyFnnZdcPONdyo9+UW9euI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767627245; c=relaxed/simple; bh=tW/GKEey4iCujCvi3D8XxSiMyBzBs+aPG3KcptCeZ+8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=l0Giwa2X68aKI5DelsqimyGAGPAW8+taaRRQ3Acym/ggS3ZEDMobOVKF1OclapyeB6XshgkZdP5iPgk45Kke4WKSA/C+M300Rq+zqYRG2syuc12sPRtX/jL+KQjuOz4akVtZvS8ZZdY/wv1+P1GLprSvjFWs5cLbXD48dgz1hpY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=126.com; spf=pass smtp.mailfrom=126.com; dkim=pass (1024-bit key) header.d=126.com header.i=@126.com header.b=LELhmAWZ; arc=none smtp.client-ip=220.197.31.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=126.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=126.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=126.com header.i=@126.com header.b="LELhmAWZ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=m1 S4iy66eHRyWo/r6WxSdeP3G8a/4YCzSxpE2sfnPHI=; b=LELhmAWZ0loSFBqqxd vwrpkQIWzDJR+tXrXIKxtKMl8uDtkd03MTW159GNhp9+PDuT4rQ3etwnoV2cxTXR PTdd23SRTPefPZDc8WkEuuqFV0cH1/ijyeBRN2WUf9iiQbAdJmmb3hoh5a+JR5xD 3b8arv2EWW7hyQyY/DcyJ13yk= Received: from YLLaptop.. (unknown []) by gzga-smtp-mtada-g0-1 (Coremail) with SMTP id _____wD3t6092Vtp4nHABA--.665S3; Mon, 05 Jan 2026 23:31:11 +0800 (CST) From: Nanzhe Zhao To: Kim Jaegeuk Cc: Chao Yu , linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Nanzhe Zhao Subject: [PATCH v1 1/5] f2fs: Zero f2fs_folio_state on allocation Date: Mon, 5 Jan 2026 23:30:57 +0800 Message-Id: <20260105153101.152892-2-nzzhao@126.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260105153101.152892-1-nzzhao@126.com> References: <20260105153101.152892-1-nzzhao@126.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: _____wD3t6092Vtp4nHABA--.665S3 X-Coremail-Antispam: 1Uf129KBjvdXoWrZF48Wr48Cr15Wr43tFy3CFg_yoWDGrg_uw 18Jrn7WryrJF15A3WYy3y8trZagrn5Cr1I9a1xtr4SyFn8J3yIya4qvwn3ArnrW3yjy345 GrZFq3yfCr9rCjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7xRXJ5F7UUUUU== X-CM-SenderInfo: xq22xtbr6rjloofrz/xtbBsR+2hmlb2T9IwAAA3C Content-Type: text/plain; charset="utf-8" f2fs_folio_state is attached to folio->private and is expected to start with read_pages_pending =3D=3D 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 Reviewed-by: Barry Song Reviewed-by: Chao Yu --- fs/f2fs/data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 471e52c6c1e0..ab091b294fa7 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2389,7 +2389,7 @@ static struct f2fs_folio_state *ffs_find_or_alloc(str= uct folio *folio) if (ffs) return ffs; - ffs =3D f2fs_kmem_cache_alloc(ffs_entry_slab, GFP_NOIO, true, NULL); + ffs =3D f2fs_kmem_cache_alloc(ffs_entry_slab, GFP_NOIO | __GFP_ZERO, true= , NULL); spin_lock_init(&ffs->state_lock); folio_attach_private(folio, ffs); -- 2.34.1