|
@@ -310,6 +310,15 @@ static int is_gpt_valid(struct parsed_partitions *state, u64 lba,
|
|
goto fail;
|
|
goto fail;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /* Check the GUID Partition Table header size */
|
|
|
|
+ if (le32_to_cpu((*gpt)->header_size) >
|
|
|
|
+ bdev_logical_block_size(state->bdev)) {
|
|
|
|
+ pr_debug("GUID Partition Table Header size is wrong: %u > %u\n",
|
|
|
|
+ le32_to_cpu((*gpt)->header_size),
|
|
|
|
+ bdev_logical_block_size(state->bdev));
|
|
|
|
+ goto fail;
|
|
|
|
+ }
|
|
|
|
+
|
|
/* Check the GUID Partition Table CRC */
|
|
/* Check the GUID Partition Table CRC */
|
|
origcrc = le32_to_cpu((*gpt)->header_crc32);
|
|
origcrc = le32_to_cpu((*gpt)->header_crc32);
|
|
(*gpt)->header_crc32 = 0;
|
|
(*gpt)->header_crc32 = 0;
|