summaryrefslogtreecommitdiff
path: root/fs/udf
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2020-09-25 15:53:08 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-10-29 11:58:05 +0300
commit01d886b89eb831d3366994064ddb805e66416c61 (patch)
treec2abe8b250cbcbbc0aa099a02d7b2269ac79c8d1 /fs/udf
parente9e791f5c39ab30e374a3b1a9c25ca7ff24988f3 (diff)
downloadlinux-01d886b89eb831d3366994064ddb805e66416c61.tar.xz
udf: Limit sparing table size
[ Upstream commit 44ac6b829c4e173fdf6df18e6dd86aecf9a3dc99 ] 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>
Diffstat (limited to 'fs/udf')
-rw-r--r--fs/udf/super.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 4baa1ca91e9b..a0cd766b41cd 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -1352,6 +1352,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]);