Skip to content

Commit 310594d

Browse files
jankaragregkh
authored andcommitted
udf: Limit sparing table size
[ Upstream commit 44ac6b8 ] 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: syzbot+9991561e714f597095da@syzkaller.appspotmail.com Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent dcef4a1 commit 310594d

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

fs/udf/super.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,6 +1353,12 @@ static int udf_load_sparable_map(struct super_block *sb,
13531353
(int)spm->numSparingTables);
13541354
return -EIO;
13551355
}
1356+
if (le32_to_cpu(spm->sizeSparingTable) > sb->s_blocksize) {
1357+
udf_err(sb, "error loading logical volume descriptor: "
1358+
"Too big sparing table size (%u)\n",
1359+
le32_to_cpu(spm->sizeSparingTable));
1360+
return -EIO;
1361+
}
13561362

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

0 commit comments

Comments
 (0)