mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hungyu Lin <dennylin0707@gmail.com>
To: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Cc: ntfs3@lists.linux.dev, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	xfcyhuang@gmail.com, Hungyu Lin <dennylin0707@gmail.com>
Subject: [PATCH] fs/ntfs3: preserve colons in volume labels
Date: Thu, 29 Oct 2026 22:58:56 +0000	[thread overview]
Message-ID: <20261029225856.1173-1-dennylin0707@gmail.com> (raw)

With the ads mount option enabled, ntfs_nls_to_utf16() replaces an
interior colon with NUL. ntfs_set_label() restores the full length, but
does not restore the overwritten character before writing ATTR_LABEL.

For example, xfs_io -c 'label -s Backup:2026' succeeds on an NTFS3 mount,
but the label becomes "Backup" after unmounting and mounting it again.
The same-mount cached label still contains the original input, hiding
the on-disk corruption.

Disable ADS parsing when converting a volume label and remove the
incomplete attempt to undo the split. Volume labels are not stream
pathnames and should retain their complete contents.

Reported-by: 晓风残月 <xfcyhuang@gmail.com>
Link: https://lore.kernel.org/ntfs3/CAC_Ok8x21q=Fy4n7V5j78G3rn5ByHpLVRiM4FrYGaJnmdFiP_w@mail.gmail.com/
Fixes: be310476e886 ("fs/ntfs3: Add basic support for alternative data streams")
Cc: stable@vger.kernel.org
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
This applies on top of:
  [PATCH] fs/ntfs3: preserve colons in symlink targets
  https://lore.kernel.org/ntfs3/20261029203457.59990-1-dennylin0707@gmail.com/

 fs/ntfs3/fsntfs.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/fs/ntfs3/fsntfs.c b/fs/ntfs3/fsntfs.c
index b06de8566a72..df939ee18904 100644
--- a/fs/ntfs3/fsntfs.c
+++ b/fs/ntfs3/fsntfs.c
@@ -2668,16 +2668,10 @@ int ntfs_set_label(struct ntfs_sb_info *sbi, u8 *label, int len)
 		return -ENOMEM;
 
 	err = ntfs_nls_to_utf16(sbi, label, len, uni, (PATH_MAX - 2) / 2,
-				UTF16_LITTLE_ENDIAN, true);
+				UTF16_LITTLE_ENDIAN, false);
 	if (err < 0)
 		goto out;
 
-	if (uni->ads_len) {
-		/* Undo delimiter parse */
-		uni->len += uni->ads_len + 1;
-		uni->ads_len = 0;
-	}
-
 	uni_bytes = uni->len * sizeof(u16);
 	if (uni_bytes > NTFS_LABEL_MAX_LENGTH * sizeof(u16)) {
 		ntfs_warn(sbi->sb, "new label is too long");

base-commit: 4a77fa820d937fae9fe0bd6a6795c2d749fd4df7
-- 
2.43.0


                 reply	other threads:[~2026-10-29 22:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261029225856.1173-1-dennylin0707@gmail.com \
    --to=dennylin0707@gmail.com \
    --cc=almaz.alexandrovich@paragon-software.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ntfs3@lists.linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=xfcyhuang@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®