From: Namjae Jeon <linkinjeon@kernel.org>
To: hyc.lee@gmail.com
Cc: ntfs@lists.linux.dev, linux-fsdevel@vger.kernel.org,
Namjae Jeon <linkinjeon@kernel.org>
Subject: [PATCH] ntfs: remove empty EA attribute pair
Date: Thu, 16 Jul 2026 11:46:36 +0900 [thread overview]
Message-ID: <20260716024640.13396-2-linkinjeon@kernel.org> (raw)
In-Reply-To: <20260716024640.13396-1-linkinjeon@kernel.org>
Removing the final xattr leaves an empty $EA stream. An empty $EA
attribute paired with $EA_INFORMATION is not a valid EA chain and
ntfsck reports it as corrupt.
Remove both attributes when the final EA entry is deleted.
Fixes: fc053f05ca28 ("ntfs: add reparse and ea operations")
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
---
fs/ntfs/ea.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/fs/ntfs/ea.c b/fs/ntfs/ea.c
index 0eba3f41c7bb..88bfd6560692 100644
--- a/fs/ntfs/ea.c
+++ b/fs/ntfs/ea.c
@@ -275,6 +275,15 @@ static int ntfs_set_ea(struct inode *inode, const char *name, size_t name_len,
ea_info_qsize -= ea_size;
p_ea_info->ea_query_length = cpu_to_le32(ea_info_qsize);
+ if ((flags & XATTR_REPLACE) && !val_size && !ea_info_qsize) {
+ err = ntfs_attr_remove(ni, AT_EA, AT_UNNAMED, 0);
+ if (err)
+ goto out;
+
+ err = ntfs_attr_remove(ni, AT_EA_INFORMATION, AT_UNNAMED, 0);
+ goto out;
+ }
+
err = ntfs_write_ea(ni, AT_EA_INFORMATION, (char *)p_ea_info, 0,
sizeof(struct ea_information), false);
if (err)
--
2.25.1
next prev parent reply other threads:[~2026-07-16 2:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-16 2:46 [PATCH] ntfs: validate final EA attribute size Namjae Jeon
2026-07-16 2:46 ` Namjae Jeon [this message]
2026-07-16 2:46 ` [PATCH] ntfs: rewrite EA stream before updating metadata Namjae Jeon
2026-07-16 2:46 ` [PATCH] ntfs: fix kmap_local_page() usage in compress Namjae Jeon
2026-07-16 2:46 ` [PATCH] ntfs: file extension before write submission Namjae Jeon
2026-07-16 2:46 ` [PATCH] ntfs: use pagecache_isize_extended() on size extension Namjae Jeon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260716024640.13396-2-linkinjeon@kernel.org \
--to=linkinjeon@kernel.org \
--cc=hyc.lee@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=ntfs@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.