Message ID | 1307700359-18350-2-git-send-email-apw@canonical.com |
---|---|
State | New |
Headers | show |
diff --git a/fs/partitions/efi.c b/fs/partitions/efi.c index e7b0700..46e9f47 100644 --- a/fs/partitions/efi.c +++ b/fs/partitions/efi.c @@ -312,6 +312,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_hardsect_size(bdev)) { + Dprintk("GUID Partition Table Header size is wrong: %u > %u\n", + le32_to_cpu((*gpt)->header_size), + bdev_hardsect_size(bdev)); + goto fail; + } + /* Check the GUID Partition Table CRC */ origcrc = le32_to_cpu((*gpt)->header_crc32); (*gpt)->header_crc32 = 0;