summaryrefslogtreecommitdiff
path: root/staging/mops_ext_rtp.c
AgeCommit message (Expand)AuthorFilesLines
2013-05-13staging: add mausezahn staging directoryDaniel Borkmann1-0/+243
>committerJan Kara <jack@suse.cz>2016-05-19 13:00:35 +0200 commit7888824b0b1c9c3753d2aedf1d00e7a1c20c18af (patch) tree1fee893e1b2ac9cb85029081986bfafe5f2b5d87 parent3743a03e72b73b6234768bce06d7bf5a57c47285 (diff)
udf: Use correct partition reference number for metadata
UDF/OSTA terminology is confusing. Partition Numbers (PNs) are arbitrary 16-bit values, one for each physical partition in the volume. Partition Reference Numbers (PRNs) are indices into the the Partition Map Table and do not necessarily equal the PN of the mapped partition. The current metadata code mistakenly uses the PN instead of the PRN when mapping metadata blocks to physical/sparable blocks. Windows-created UDF 2.5 discs for some reason use large, arbitrary PNs, resulting in mount failure and KASAN read warnings in udf_read_inode(). For example, a NetBSD UDF 2.5 partition might look like this: PRN PN Type --- -- ---- 0 0 Sparable 1 0 Metadata Since PRN == PN, we are fine. But Windows could gives us: PRN PN Type --- ---- ---- 0 8192 Sparable 1 8192 Metadata So udf_read_inode() will start out by checking the partition length in sbi->s_partmaps[8192], which is obviously out of bounds. Fix this by creating a new field (s_phys_partition_ref) in struct udf_meta_data, referencing whatever physical or sparable map has the same partition number as the metadata partition. [JK: Add comment about s_phys_partition_ref, change its name] Signed-off-by: Alden Tondettar <alden.tondettar@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat