From bfa0f472d51916b6c6b6e06afb0293fcbe807fcb Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 30 Sep 2024 17:36:17 +0000 Subject: [PATCH] Revert "udf: Avoid excessive partition lengths" This reverts commit 551966371e17912564bc387fbeb2ac13077c3db1 which is commit ebbe26fd54a9621994bc16b14f2ba8f84c089693 upstream. It breaks the Android kernel build as it adds a warning. UDF is not a supported Android filesystem, so it is safe to revert. Change-Id: I127bf634f2b8f50ff96363264393a9e9477957af Signed-off-by: Greg Kroah-Hartman --- fs/udf/super.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/fs/udf/super.c b/fs/udf/super.c index 68d9d2d3249a..d73fe54ee26f 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c @@ -1083,19 +1083,12 @@ static int udf_fill_partdesc_info(struct super_block *sb, struct udf_part_map *map; struct udf_sb_info *sbi = UDF_SB(sb); struct partitionHeaderDesc *phd; - u32 sum; int err; map = &sbi->s_partmaps[p_index]; map->s_partition_len = le32_to_cpu(p->partitionLength); /* blocks */ map->s_partition_root = le32_to_cpu(p->partitionStartingLocation); - if (check_add_overflow(map->s_partition_root, map->s_partition_len, - &sum)) { - udf_err(sb, "Partition %d has invalid location %u + %u\n", - p_index, map->s_partition_root, map->s_partition_len); - return -EFSCORRUPTED; - } if (p->accessType == cpu_to_le32(PD_ACCESS_TYPE_READ_ONLY)) map->s_partition_flags |= UDF_PART_FLAG_READ_ONLY; @@ -1151,14 +1144,6 @@ static int udf_fill_partdesc_info(struct super_block *sb, bitmap->s_extPosition = le32_to_cpu( phd->unallocSpaceBitmap.extPosition); map->s_partition_flags |= UDF_PART_FLAG_UNALLOC_BITMAP; - /* Check whether math over bitmap won't overflow. */ - if (check_add_overflow(map->s_partition_len, - sizeof(struct spaceBitmapDesc) << 3, - &sum)) { - udf_err(sb, "Partition %d is too long (%u)\n", p_index, - map->s_partition_len); - return -EFSCORRUPTED; - } udf_debug("unallocSpaceBitmap (part %d) @ %u\n", p_index, bitmap->s_extPosition); }