summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fs/partitions/efi.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/partitions/efi.c b/fs/partitions/efi.c
index 2aac7764b7e5..6ab70f413a57 100644
--- a/fs/partitions/efi.c
+++ b/fs/partitions/efi.c
@@ -311,6 +311,15 @@ is_gpt_valid(struct block_device *bdev, u64 lba,
goto fail;
}
+ /* Check the GUID Partition Table header size */
+ if (le32_to_cpu((*gpt)->header_size) >
+ bdev_logical_block_size(bdev)) {
+ pr_debug("GUID Partition Table Header size is wrong: %u > %u\n",
+ le32_to_cpu((*gpt)->header_size),
+ bdev_logical_block_size(bdev));
+ goto fail;
+ }
+
/* Check the GUID Partition Table CRC */
origcrc = le32_to_cpu((*gpt)->header_crc32);
(*gpt)->header_crc32 = 0;