summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSteve Magnani <steve.magnani@digidescorp.com>2019-02-08 11:34:55 -0600
committerJan Kara <jack@suse.cz>2019-02-11 09:26:02 +0100
commite8b4274735e416621cfb28c2802b4ad52da35d0f (patch)
treeb1569ebbc437c6f29fbc41892863c15b53fc6c93 /fs
parentebbd5e99f60aca79b6c723c17a4ad1a8f26fcd98 (diff)
downloadlinux-e8b4274735e416621cfb28c2802b4ad52da35d0f.tar.bz2
udf: finalize integrity descriptor before writeback
Make sure the CRC and tag checksum of the Logical Volume Integrity Descriptor are valid before the structure is written out to disk. Otherwise, unless the filesystem is unmounted gracefully, the on-disk LVID will be invalid - which is unnecessary filesystem damage. Signed-off-by: Steven J. Magnani <steve@digidescorp.com> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs')
-rw-r--r--fs/udf/super.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 2d8742801060..2cf435c87583 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -2046,8 +2046,8 @@ u64 lvid_get_unique_id(struct super_block *sb)
if (!(++uniqueID & 0xFFFFFFFF))
uniqueID += 16;
lvhd->uniqueID = cpu_to_le64(uniqueID);
+ udf_updated_lvid(sb);
mutex_unlock(&sbi->s_alloc_mutex);
- mark_buffer_dirty(bh);
return ret;
}
@@ -2318,11 +2318,20 @@ static int udf_sync_fs(struct super_block *sb, int wait)
mutex_lock(&sbi->s_alloc_mutex);
if (sbi->s_lvid_dirty) {
+ struct buffer_head *bh = sbi->s_lvid_bh;
+
+ if (bh) {
+ struct logicalVolIntegrityDesc *lvid;
+
+ lvid = (struct logicalVolIntegrityDesc *)bh->b_data;
+ udf_finalize_lvid(lvid);
+ }
+
/*
* Blockdevice will be synced later so we don't have to submit
* the buffer for IO
*/
- mark_buffer_dirty(sbi->s_lvid_bh);
+ mark_buffer_dirty(bh);
sbi->s_lvid_dirty = 0;
}
mutex_unlock(&sbi->s_alloc_mutex);