Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1403642

Re: [PATCH 3/3] udf: Use correct partition reference number for metadata

From Jan Kara <jack@suse.cz>
Newsgroups linux.kernel
Subject Re: [PATCH 3/3] udf: Use correct partition reference number for metadata
Date 2016-05-19 13:10 +0200
Message-ID <rAu01-7m2-5@gated-at.bofh.it> (permalink)
References <rAh2N-7md-7@gated-at.bofh.it> <rAh2O-7md-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed 18-05-16 14:09:19, Alden Tondettar wrote:
> 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_partition_ref) in struct udf_meta_data,
> referencing whatever physical or sparable map has the same partition number
> as the metadata partition.
> 
> Signed-off-by: Alden Tondettar <alden.tondettar@gmail.com>

Ah, I've missed this subtlety when reading the specification! Thanks for
fixing this. I've added this patch to my tree, I have just changed
s_partition_ref to s_phys_partition_ref and added a comment about it to
udf_sb.h..

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] udf: Metadata partition fixes Alden Tondettar <alden.tondettar@gmail.com> - 2016-05-18 23:20 +0200
  [PATCH 0/3] udf: Metadata partition fixes Alden Tondettar <alden.tondettar@gmail.com> - 2016-05-18 23:20 +0200
  [PATCH 1/3] udf: Don't BUG on missing metadata partition descriptor Alden Tondettar <alden.tondettar@gmail.com> - 2016-05-18 23:20 +0200
    Re: [PATCH 1/3] udf: Don't BUG on missing metadata partition  descriptor Jan Kara <jack@suse.cz> - 2016-05-19 12:30 +0200
  [PATCH 3/3] udf: Use correct partition reference number for metadata Alden Tondettar <alden.tondettar@gmail.com> - 2016-05-18 23:20 +0200
    Re: [PATCH 3/3] udf: Use correct partition reference number for  metadata Jan Kara <jack@suse.cz> - 2016-05-19 13:10 +0200

csiph-web