Commit f7d80da8 authored by Jan Kara's avatar Jan Kara Committed by Stefan Bader

udf: Fix BUG on corrupted inode

BugLink: https://bugs.launchpad.net/bugs/1818813

[ Upstream commit d288d958 ]

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: default avatarAnatoly Trosinenko <anatoly.trosinenko@gmail.com>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent 800422d7
......@@ -1364,6 +1364,12 @@ static int udf_read_inode(struct inode *inode, bool hidden_inode)
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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment