diff options
author | Davidlohr Bueso <davidlohr@hp.com> | 2013-09-11 17:25:01 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-11 18:59:18 -0400 |
commit | aa054bc93743ecce3a27f1655d59674dabc71a54 (patch) | |
tree | ef4a3d6042ce1ae5554cea6c29e2aca6c230f5dd /block/partitions/efi.c | |
parent | 27a7c642174eaec627f6a3a254035bf8abd02c5e (diff) |
partitions/efi: compare first and last usable LBAs
When verifying GPT header integrity, make sure that first usable LBA is
smaller than last usable LBA.
Signed-off-by: Davidlohr Bueso <davidlohr@hp.com>
Reviewed-by: Karel Zak <kzak@redhat.com>
Acked-by: Matt Fleming <matt.fleming@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'block/partitions/efi.c')
-rw-r--r-- | block/partitions/efi.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/block/partitions/efi.c b/block/partitions/efi.c index b028af688361..de9f9bfa24bc 100644 --- a/block/partitions/efi.c +++ b/block/partitions/efi.c | |||
@@ -410,7 +410,12 @@ static int is_gpt_valid(struct parsed_partitions *state, u64 lba, | |||
410 | (unsigned long long)lastlba); | 410 | (unsigned long long)lastlba); |
411 | goto fail; | 411 | goto fail; |
412 | } | 412 | } |
413 | 413 | if (le64_to_cpu((*gpt)->last_usable_lba) < le64_to_cpu((*gpt)->first_usable_lba)) { | |
414 | pr_debug("GPT: last_usable_lba incorrect: %lld > %lld\n", | ||
415 | (unsigned long long)le64_to_cpu((*gpt)->last_usable_lba), | ||
416 | (unsigned long long)le64_to_cpu((*gpt)->first_usable_lba)); | ||
417 | goto fail; | ||
418 | } | ||
414 | /* Check that sizeof_partition_entry has the correct value */ | 419 | /* Check that sizeof_partition_entry has the correct value */ |
415 | if (le32_to_cpu((*gpt)->sizeof_partition_entry) != sizeof(gpt_entry)) { | 420 | if (le32_to_cpu((*gpt)->sizeof_partition_entry) != sizeof(gpt_entry)) { |
416 | pr_debug("GUID Partitition Entry Size check failed.\n"); | 421 | pr_debug("GUID Partitition Entry Size check failed.\n"); |