From: Steve Magnani <steve.magnani@digidescorp.com>
To: jack@suse.com
Cc: linux-kernel@vger.kernel.org,
"Steven J . Magnani" <steve@digidescorp.com>
Subject: [PATCH 2/2] udf: finalize integrity descriptor before writeback
Date: Fri, 8 Feb 2019 11:34:55 -0600 [thread overview]
Message-ID: <20190208173455.20151-3-steve@digidescorp.com> (raw)
In-Reply-To: <20190208173455.20151-1-steve@digidescorp.com>
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>
---
--- 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;
}
next prev parent reply other threads:[~2019-02-08 17:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-08 17:34 [PATCH 0/2] udf: Fix corrupt on-disk integrity descriptor following sync() Steve Magnani
2019-02-08 17:34 ` [PATCH 1/2] udf: factor out LVID finalization for reuse Steve Magnani
2019-02-08 17:34 ` Steve Magnani [this message]
2019-02-09 4:06 ` [PATCH 0/2] udf: Fix corrupt on-disk integrity descriptor following sync() Steve Magnani
2019-02-11 8:42 ` Jan Kara
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=20190208173455.20151-3-steve@digidescorp.com \
--to=steve.magnani@digidescorp.com \
--cc=jack@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=steve@digidescorp.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;
as well as URLs for NNTP newsgroup(s).