diff --git a/fs/udf/super.c b/fs/udf/super.c index 4abdba453885e..c8c037e8e57b5 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c @@ -1391,6 +1391,12 @@ static int udf_load_sparable_map(struct super_block *sb, (int)spm->numSparingTables); return -EIO; } + if (le32_to_cpu(spm->sizeSparingTable) > sb->s_blocksize) { + udf_err(sb, "error loading logical volume descriptor: " + "Too big sparing table size (%u)\n", + le32_to_cpu(spm->sizeSparingTable)); + return -EIO; + } for (i = 0; i < spm->numSparingTables; i++) { loc = le32_to_cpu(spm->locSparingTable[i]);