]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
udf: Don't BUG on missing metadata partition descriptor
authorAlden Tondettar <alden.tondettar@gmail.com>
Wed, 18 May 2016 21:09:17 +0000 (14:09 -0700)
committerJan Kara <jack@suse.cz>
Thu, 19 May 2016 09:55:53 +0000 (11:55 +0200)
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>
Signed-off-by: Jan Kara <jack@suse.cz>
fs/udf/partition.c

index 5f861ed287c3fde0fbf87de4c740e672213acd5d..e4e9e70c37f2eb8c0f03666e4bd01dc5ebe97a05 100644 (file)
@@ -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");