Skip to contentSkip to conversation

fs/ntfs3: preserve colons in volume labels

PATCH New Hungyu Lin 1 participant 1 message Oct 29

Subsystems (3)
lore
Share & tools
lore

Hungyu Lin

author
#0 lore raw

PATCH 1/1 fs/ntfs3: preserve colons in volume labels

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.

---
This applies on top of:
[PATCH] fs/ntfs3: preserve colons in symlink targets
https://lore.kernel.org/ntfs3/[email protected]/

 fs/ntfs3/fsntfs.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
fs/ntfs3/fsntfs.c +1 -7
index b06de8566a72..df939ee18904 100644
@@ -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

Signature · 1 line
2.43.0