summaryrefslogtreecommitdiffstats
path: root/fs/udf/inode.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2018-12-12 14:29:20 +0100
committerJan Kara <jack@suse.cz>2018-12-12 15:48:49 +0100
commitd288d95842f1503414b7eebce3773bac3390457e (patch)
treecf00bbda980da51717881fae02b41854c57a0bac /fs/udf/inode.c
parentext2: change reusable parameter to true when calling mb_cache_entry_create() (diff)
downloadlinux-d288d95842f1503414b7eebce3773bac3390457e.tar.xz
linux-d288d95842f1503414b7eebce3773bac3390457e.zip
udf: Fix BUG on corrupted inode
When inode is corrupted so that extent type is invalid, some functions (such as udf_truncate_extents()) will just BUG. Check that extent type is valid when loading the inode to memory. Reported-by: Anatoly Trosinenko <anatoly.trosinenko@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/udf/inode.c')
-rw-r--r--fs/udf/inode.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 5df554a9f9c9..ae796e10f68b 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -1357,6 +1357,12 @@ reread:
iinfo->i_alloc_type = le16_to_cpu(fe->icbTag.flags) &
ICBTAG_FLAG_AD_MASK;
+ if (iinfo->i_alloc_type != ICBTAG_FLAG_AD_SHORT &&
+ iinfo->i_alloc_type != ICBTAG_FLAG_AD_LONG &&
+ iinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB) {
+ ret = -EIO;
+ goto out;
+ }
iinfo->i_unique = 0;
iinfo->i_lenEAttr = 0;
iinfo->i_lenExtents = 0;