Skip to contentSkip to conversation

udf: disallow RW mount without valid integrity descriptor

PATCH In review Steve Magnani 2 participants 2 messages Feb 11, 2019 UDF filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 udf: disallow RW mount without valid integrity descriptor

Refuse to mount a volume read-write without a coherent Logical Volume Integrity Descriptor, because we can't generate truly unique IDs without one.

This fixes a bug where all inodes created on a UDF filesystem following mount without a coherent LVID are assigned UID 0.

---

fs/udf/super.c +11 -0
@@ -1474,6 +1474,17 @@ static int udf_load_logicalvol(struct su
 	if (lvd->integritySeqExt.extLength)
 		udf_load_logicalvolint(sb, leea_to_cpu(lvd->integritySeqExt));
 	ret = 0;
+
+	if (!sbi->s_lvid_bh) {
+		/* We can't generate UIDs without a valid LVID */
+		if (sb_rdonly(sb))
+			UDF_SET_FLAG(sb, UDF_FLAG_RW_INCOMPAT);
+		else {
+			udf_warn(sb, "Damaged or missing LVID, forcing "
+				     "readonly mount\n");
+			ret = -EACCES;
+		}
+	}
 out_bh:
 	brelse(bh);
 	return ret;
#1 lore raw
Quoted 8 lines · Steve Magnani

Refuse to mount a volume read-write without a coherent Logical Volume Integrity Descriptor, because we can't generate truly unique IDs without one.

This fixes a bug where all inodes created on a UDF filesystem following mount without a coherent LVID are assigned UID 0.

Thanks. Added to my tree.

Honza

Quoted 22 lines

---

fs/udf/super.c +11 -0
@@ -1474,6 +1474,17 @@ static int udf_load_logicalvol(struct su
 	if (lvd->integritySeqExt.extLength)
 		udf_load_logicalvolint(sb, leea_to_cpu(lvd->integritySeqExt));
 	ret = 0;
+
+	if (!sbi->s_lvid_bh) {
+		/* We can't generate UIDs without a valid LVID */
+		if (sb_rdonly(sb))
+			UDF_SET_FLAG(sb, UDF_FLAG_RW_INCOMPAT);
+		else {
+			udf_warn(sb, "Damaged or missing LVID, forcing "
+				     "readonly mount\n");
+			ret = -EACCES;
+		}
+	}
 out_bh:
 	brelse(bh);
 	return ret;
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR