From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 30FD02135B8; Tue, 26 Aug 2025 11:37:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756208226; cv=none; b=PI/Zk9ympeUSdNXTxLxuEJbChje2fsMlT6tL71Yd73hj9C4BfqdV8hSAnAAvBLPi4vvVE/mONJ7WbqQNtB8ni3/+z5H9WCnWo0owBVpDGGabwpP2/Q2w5w/5EksgW7dD9j4CHo5e7Aw6VYl7IPyNnfJ2PaiVfeyYcQT8TlLjrqA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756208226; c=relaxed/simple; bh=OT3spIFvaH9UrkxrY9x5taAQTKs5gWvVvdIPkatvuCU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bsCju9xlYH/DJqyYCbNDAd9QWED+dqFVI6XVCCUyWyvyPoPb/Destrjki9Kl89RC7KhwznjvlZpHZdYwKarbm1gRZ09WKu4WvLqD0UX/bWaHUxR4nl/mnXl41k0N8xUBbcqra1UNjPF1oQuqfsaTHmzrEIDasODfRRdolhje/rY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=BKwmvRCX; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="BKwmvRCX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B733AC4CEF1; Tue, 26 Aug 2025 11:37:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1756208226; bh=OT3spIFvaH9UrkxrY9x5taAQTKs5gWvVvdIPkatvuCU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BKwmvRCXurWQAHxndjh/9DpRxghPVXBGBXFkwCExveJMTuf86GArISL8PaXgZ5tI7 amOF81mp0o1mSjNr7d5TesCOt2k3QUPZGz3neAMRilmsYxXLSJNubD/Z5u7YuW9G4a JmZ+o680c9VBzSnELJ5tiB/2mXvOpsrbGAusaRkA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Andreas Dilger , Li Dongyang , Alex Zhuravlev , Oleg Drokin , Theodore Tso Subject: [PATCH 6.12 029/322] ext4: check fast symlink for ea_inode correctly Date: Tue, 26 Aug 2025 13:07:24 +0200 Message-ID: <20250826110916.042262871@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250826110915.169062587@linuxfoundation.org> References: <20250826110915.169062587@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Andreas Dilger commit b4cc4a4077268522e3d0d34de4b2dc144e2330fa upstream. The check for a fast symlink in the presence of only an external xattr inode is incorrect. If a fast symlink does not have an xattr block (i_file_acl == 0), but does have an external xattr inode that increases inode i_blocks, then the check for a fast symlink will incorrectly fail and __ext4_iget()->ext4_ind_check_inode() will report the inode is corrupt when it "validates" i_data[] on the next read: # ln -s foo /mnt/tmp/bar # setfattr -h -n trusted.test \ -v "$(yes | head -n 4000)" /mnt/tmp/bar # umount /mnt/tmp # mount /mnt/tmp # ls -l /mnt/tmp ls: cannot access '/mnt/tmp/bar': Structure needs cleaning total 4 ? l?????????? ? ? ? ? ? bar # dmesg | tail -1 EXT4-fs error (device dm-8): __ext4_iget:5098: inode #24578: block 7303014: comm ls: invalid block (note that "block 7303014" = 0x6f6f66 = "foo" in LE order). ext4_inode_is_fast_symlink() should check the superblock EXT4_FEATURE_INCOMPAT_EA_INODE feature flag, not the inode EXT4_EA_INODE_FL, since the latter is only set on the xattr inode itself, and not on the inode that uses this xattr. Cc: stable@vger.kernel.org Fixes: fc82228a5e38 ("ext4: support fast symlinks from ext3 file systems") Signed-off-by: Andreas Dilger Reviewed-by: Li Dongyang Reviewed-by: Alex Zhuravlev Reviewed-by: Oleg Drokin Reviewed-on: https://review.whamcloud.com/59879 Lustre-bug-id: https://jira.whamcloud.com/browse/LU-19121 Link: https://patch.msgid.link/20250717063709.757077-1-adilger@dilger.ca Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -151,7 +151,7 @@ static int ext4_meta_trans_blocks(struct */ int ext4_inode_is_fast_symlink(struct inode *inode) { - if (!(EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL)) { + if (!ext4_has_feature_ea_inode(inode->i_sb)) { int ea_blocks = EXT4_I(inode)->i_file_acl ? EXT4_CLUSTER_SIZE(inode->i_sb) >> 9 : 0;