Skip to content

Commit 44ac6b8

Browse files
committed
udf: Limit sparing table size
Although UDF standard allows it, we don't support sparing table larger than a single block. Check it during mount so that we don't try to access memory beyond end of buffer. Reported-by: [email protected] Signed-off-by: Jan Kara <[email protected]>
1 parent 382a228 commit 44ac6b8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

fs/udf/super.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,6 +1345,12 @@ static int udf_load_sparable_map(struct super_block *sb,
13451345
(int)spm->numSparingTables);
13461346
return -EIO;
13471347
}
1348+
if (le32_to_cpu(spm->sizeSparingTable) > sb->s_blocksize) {
1349+
udf_err(sb, "error loading logical volume descriptor: "
1350+
"Too big sparing table size (%u)\n",
1351+
le32_to_cpu(spm->sizeSparingTable));
1352+
return -EIO;
1353+
}
13481354

13491355
for (i = 0; i < spm->numSparingTables; i++) {
13501356
loc = le32_to_cpu(spm->locSparingTable[i]);

0 commit comments

Comments
 (0)