mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
udf: Make sure there's enough space for LVID implementation use field
udf_lvid_valid() verifies that the LVID has enough space for all the
tables and the reported length of ImplementationUse field. However it
doesn't make sure the reported length is large enough to contain
logicalVolIntegrityDescImpUse structure which OSTA specification
requires. This can thus lead to accesses beyond the end of LVID buffer
for suitably corrupted UDF filesystem. Add the length check.
Reported-by: Yunpeng Tian <shionthanatos@gmail.com>
Reported-by: Gongming Wang <gmwgg05@gmail.com>
Reported-by: Mingda Zhang <npczmd@qq.com>
Reported-by: Qinrun Dai <jupmouse@gmail.com>
Cc: stable@vger.kernel.org
Fixes: 781d2a9a2f ("udf: Check LVID earlier")
Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
parent
cee9395acd
commit
a61fb39759
|
|
@ -1617,7 +1617,10 @@ static bool udf_lvid_valid(struct super_block *sb,
|
|||
|
||||
parts = le32_to_cpu(lvid->numOfPartitions);
|
||||
impuselen = le32_to_cpu(lvid->lengthOfImpUse);
|
||||
if (parts >= sb->s_blocksize || impuselen >= sb->s_blocksize ||
|
||||
if (sizeof(struct logicalVolIntegrityDescImpUse) > impuselen ||
|
||||
impuselen >= sb->s_blocksize)
|
||||
return false;
|
||||
if (parts >= sb->s_blocksize ||
|
||||
sizeof(struct logicalVolIntegrityDesc) + impuselen +
|
||||
2 * parts * sizeof(u32) > sb->s_blocksize)
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user