[2/2] udf:check if buffer head's data when getting lvidiu
Commit Message
We can not always assume udf_sb_info->s_lvid_bh's data is valid. If the
data is corrupted, we would get an incorrect offset and cause the
following code access an illegal address.
Signed-off-by: Wenchao Hao <haowenchao2@huawei.com>
---
fs/udf/super.c | 2 ++
1 file changed, 2 insertions(+)
@@ -114,6 +114,8 @@ struct logicalVolIntegrityDescImpUse *udf_sb_lvidiu(struct super_block *sb)
if (!UDF_SB(sb)->s_lvid_bh)
return NULL;
+ if (!udf_check_tagged_bh(sb, UDF_SB(sb)->s_lvid_bh))
+ return NULL;
lvid = (struct logicalVolIntegrityDesc *)UDF_SB(sb)->s_lvid_bh->b_data;
partnum = le32_to_cpu(lvid->numOfPartitions);
/* The offset is to skip freeSpaceTable and sizeTable arrays */