[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190208173455.20151-3-steve@digidescorp.com>
Date: Fri, 8 Feb 2019 11:34:55 -0600
From: Steve Magnani <steve.magnani@...idescorp.com>
To: jack@...e.com
Cc: linux-kernel@...r.kernel.org,
"Steven J . Magnani" <steve@...idescorp.com>
Subject: [PATCH 2/2] 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@...idescorp.com>
---
--- a/fs/udf/super.c 2019-02-08 10:39:48.351039434 -0600
+++ b/fs/udf/super.c 2019-02-08 10:42:26.017400020 -0600
@@ -1856,8 +1856,8 @@ u64 lvid_get_unique_id(struct super_bloc
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;
}
@@ -2154,11 +2154,20 @@ static int udf_sync_fs(struct super_bloc
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);
sb->s_dirt = 0;
sbi->s_lvid_dirty = 0;
}
Powered by blists - more mailing lists