From: Jan Kara <jack@suse.cz>
To: Alden Tondettar <alden.tondettar@gmail.com>
Cc: Jan Kara <jack@suse.com>,
Laura Abbott <labbott@fedoraproject.org>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] udf: Use correct partition reference number for metadata
Date: Thu, 19 May 2016 13:03:32 +0200 [thread overview]
Message-ID: <20160519110332.GC8839@quack2.suse.cz> (raw)
In-Reply-To: <1463605759-7616-5-git-send-email-alden.tondettar@gmail.com>
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
prev parent reply other threads:[~2016-05-19 11:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-18 21:09 [PATCH 0/3] udf: Metadata partition fixes Alden Tondettar
2016-05-18 21:09 ` Alden Tondettar
2016-05-18 21:09 ` [PATCH 1/3] udf: Don't BUG on missing metadata partition descriptor Alden Tondettar
2016-05-19 10:25 ` Jan Kara
2016-05-18 21:09 ` [PATCH 2/3] udf: Use IS_ERR when loading metadata mirror file entry Alden Tondettar
2016-05-19 10:25 ` Jan Kara
2016-05-18 21:09 ` [PATCH 3/3] udf: Use correct partition reference number for metadata Alden Tondettar
2016-05-19 11:03 ` Jan Kara [this message]
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=20160519110332.GC8839@quack2.suse.cz \
--to=jack@suse.cz \
--cc=alden.tondettar@gmail.com \
--cc=jack@suse.com \
--cc=labbott@fedoraproject.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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).