mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alden Tondettar <alden.tondettar@gmail.com>
To: Jan Kara <jack@suse.com>
Cc: Laura Abbott <labbott@fedoraproject.org>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Alden Tondettar <alden.tondettar@gmail.com>
Subject: [PATCH 1/3] udf: Don't BUG on missing metadata partition descriptor
Date: Wed, 18 May 2016 14:09:17 -0700	[thread overview]
Message-ID: <1463605759-7616-3-git-send-email-alden.tondettar@gmail.com> (raw)
In-Reply-To: <1463605759-7616-1-git-send-email-alden.tondettar@gmail.com>

Currently, if a metadata partition map is missing its partition descriptor,
then udf_get_pblock_meta25() will BUG() out the first time it is called.
This is rather drastic for a corrupted filesystem, so just treat this case
as an invalid mapping instead.

Signed-off-by: Alden Tondettar <alden.tondettar@gmail.com>
---
 fs/udf/partition.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/udf/partition.c b/fs/udf/partition.c
index 5f861ed2..e4e9e70 100644
--- a/fs/udf/partition.c
+++ b/fs/udf/partition.c
@@ -317,8 +317,9 @@ uint32_t udf_get_pblock_meta25(struct super_block *sb, uint32_t block,
 	mdata = &map->s_type_specific.s_metadata;
 	inode = mdata->s_metadata_fe ? : mdata->s_mirror_fe;
 
-	/* We shouldn't mount such media... */
-	BUG_ON(!inode);
+	if (!inode)
+		return 0xFFFFFFFF;
+
 	retblk = udf_try_read_meta(inode, block, partition, offset);
 	if (retblk == 0xFFFFFFFF && mdata->s_metadata_fe) {
 		udf_warn(sb, "error reading from METADATA, trying to read from MIRROR\n");
-- 
2.1.4

  parent reply	other threads:[~2016-05-18 21:12 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 ` Alden Tondettar [this message]
2016-05-19 10:25   ` [PATCH 1/3] udf: Don't BUG on missing metadata partition descriptor 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

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=1463605759-7616-3-git-send-email-alden.tondettar@gmail.com \
    --to=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

all inboxes | Powered by JetHome®