From nobody Wed Apr 1 13:48:51 2026 Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.5]) (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 9091B37266E; Wed, 1 Apr 2026 07:12:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.197.31.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775027549; cv=none; b=Qx3/qRDacpT1XFPRMsCvtm+8rbp6MPrn4yzOc8iJzbXYjxbBYXFAc7Y9NogIA7qkvQ4+U7O/U48t0g/SqLJDtew6unwrsO46fKA/tgC6XBfnzhzRf8uPAAAEbRTwoPjQoac25GEgbU4iApRWGr2gcbjlWT/0qFf4wnKpuH1Dh+Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775027549; c=relaxed/simple; bh=F/CDL8VyW0CX692DhFTu9Yr6yXj1cBGRo9UaLvxTghQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VGdc82jEHEfyXBs0kMnWTc2X3DRhT8yo2SFNjyZf+dz0/etXXfRHoVOis0cay2n/f+RfOOseS7TqiH3A2Wwo5GRZpdRnz2sxGIxaVHsAStEgtTARQlddbFqWT5rOcKMPOXqgIsR9EdfLUu3MqPUgl8FUquVjaAilnvkYF4tnrn0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=mfjmGBBE; arc=none smtp.client-ip=220.197.31.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="mfjmGBBE" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=x0 ZM9XluUnOwhkGJ9K+nXa5Rb6HeAXFfDwK1fCdCig0=; b=mfjmGBBEQNwFwetpK6 R/16LDt3h8x59yODv5mXIlM8EKu7txpgiD/FLzvsF9EwQa6kS16Yi0DswMT273+l yplGfDLJIaOYN2LbqTP04NiH8WK1HVPNl0Yl877Aiu56FzHtHduKdkU05wjqssmB gHi6PoIdbvWCW6TTgkwACtPeA= Received: from czl-ubuntu-pc.. (unknown []) by gzga-smtp-mtada-g1-4 (Coremail) with SMTP id _____wD3v9ZFxcxpADvDCg--.24371S3; Wed, 01 Apr 2026 15:12:08 +0800 (CST) From: Chi Zhiling To: Namjae Jeon , Sungjong Seo , Yuezhang Mo Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Chi Zhiling Subject: [PATCH v2 1/6] exfat: fix incorrect directory checksum after rename to shorter name Date: Wed, 1 Apr 2026 15:11:33 +0800 Message-ID: <20260401071138.114836-2-chizhiling@163.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260401071138.114836-1-chizhiling@163.com> References: <20260401071138.114836-1-chizhiling@163.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: _____wD3v9ZFxcxpADvDCg--.24371S3 X-Coremail-Antispam: 1Uf129KBjvdXoW7Xr1DKF15uF15Ww13CF47twb_yoWkurX_ua yrtr1DKryYyFn8JwsxKF1rGr1Sga18ur15JrnYvFnxWas3tF9xXw1DCrnFv3W7tw4rKr98 CrykWr1qka1rtjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU8EtC7UUUUU== X-CM-SenderInfo: hfkl6xxlol0wi6rwjhhfrp/xtbC2wgRrmnMxUg0fAAA3M Content-Type: text/plain; charset="utf-8" From: Chi Zhiling When renaming a file in-place to a shorter name, exfat_remove_entries marks excess entries as DELETED, but es->num_entries is not updated accordingly. As a result, exfat_update_dir_chksum iterates over the deleted entries and computes an incorrect checksum. This does not lead to persistent corruption because mark_inode_dirty() is called afterward, and __exfat_write_inode later recomputes the checksum using the correct num_entries value. Fix by setting es->num_entries =3D num_entries in exfat_init_ext_entry. Signed-off-by: Chi Zhiling --- fs/exfat/dir.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c index a2c2b998808c..7619410d668e 100644 --- a/fs/exfat/dir.c +++ b/fs/exfat/dir.c @@ -490,6 +490,7 @@ void exfat_init_ext_entry(struct exfat_entry_set_cache = *es, int num_entries, unsigned short *uniname =3D p_uniname->name; struct exfat_dentry *ep; =20 + es->num_entries =3D num_entries; ep =3D exfat_get_dentry_cached(es, ES_IDX_FILE); ep->dentry.file.num_ext =3D (unsigned char)(num_entries - 1); =20 --=20 2.43.0