Message ID | 1307700359-18350-3-git-send-email-apw@canonical.com |
---|---|
State | New |
Headers | show |
diff --git a/fs/partitions/efi.c b/fs/partitions/efi.c index 2aac776..6ab70f4 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;