[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190711133852.16887-2-steve@digidescorp.com>
Date: Thu, 11 Jul 2019 08:38:52 -0500
From: "Steven J. Magnani" <steve.magnani@...idescorp.com>
To: Jan Kara <jack@...e.com>
Cc: linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
Pali Rohár <pali.rohar@...il.com>,
"Steven J . Magnani" <steve@...idescorp.com>
Subject: [PATCH v2 2/2] udf: support 2048-byte spacing of VRS descriptors on 4K media
Some UDF creators (specifically Microsoft, but perhaps others) mishandle
the ECMA-167 corner case that requires descriptors within a Volume
Recognition Sequence to be placed at 4096-byte intervals on media where
the block size is 4K. Instead, the descriptors are placed at the 2048-
byte interval mandated for media with smaller blocks. This nonconformity
currently prevents Linux from recognizing the filesystem as UDF.
Modify the driver to tolerate a misformatted VRS on 4K media.
Signed-off-by: Steven J. Magnani <steve@...idescorp.com>
--- a/fs/udf/super.c 2019-07-10 20:55:33.334359446 -0500
+++ b/fs/udf/super.c 2019-07-10 21:20:58.138382326 -0500
@@ -741,6 +741,7 @@ static int udf_check_vsd(struct super_bl
int sectorsize;
struct buffer_head *bh = NULL;
int nsr = 0;
+ int quirk_nsr = 0;
struct udf_sb_info *sbi;
sbi = UDF_SB(sb);
@@ -780,11 +781,27 @@ static int udf_check_vsd(struct super_bl
if (vsd_id > nsr)
nsr = vsd_id;
+ /* Special handling for improperly formatted VRS (e.g., Win10)
+ * where components are separated by 2048 bytes
+ * even though sectors are 4K
+ */
+ if ((sb->s_blocksize == 4096) && (quirk_nsr < 2)) {
+ vsd_id = identify_vsd(vsd + 1);
+ if ((nsr == 1) || (quirk_nsr == 1)) {
+ /* BEA01 has been seen, allow quirk NSR */
+ if (vsd_id > quirk_nsr)
+ quirk_nsr = vsd_id;
+ } else if (vsd_id > 3)
+ quirk_nsr = vsd_id; /* 0 -> 255 */
+ }
+
brelse(bh);
}
if ((nsr >= 2) && (nsr <= 3))
return nsr;
+ else if ((quirk_nsr >= 2) && (quirk_nsr <= 3))
+ return quirk_nsr;
else if (!bh && sector - (sbi->s_session << sb->s_blocksize_bits) ==
VSD_FIRST_SECTOR_OFFSET)
return -1;
Powered by blists - more mailing lists