]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Validate size of EFI GUID partition entries.
authorTimo Warns <Warns@pre-sense.de>
Fri, 6 May 2011 11:47:35 +0000 (13:47 +0200)
committerAndi Kleen <ak@linux.intel.com>
Mon, 1 Aug 2011 20:54:47 +0000 (13:54 -0700)
commit fa039d5f6b126fbd65eefa05db2f67e44df8f121 upstream.

Otherwise corrupted EFI partition tables can cause total confusion.

Signed-off-by: Timo Warns <warns@pre-sense.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
fs/partitions/efi.c

index 9efb2cfe2410338914108bbc0f0abb20a61781a0..3e0ee124a1b30d607fadd1fbd178624eb313d691 100644 (file)
@@ -347,6 +347,12 @@ static int is_gpt_valid(struct parsed_partitions *state, u64 lba,
                goto fail;
        }
 
+       /* Check that sizeof_partition_entry has the correct value */
+       if (le32_to_cpu((*gpt)->sizeof_partition_entry) != sizeof(gpt_entry)) {
+               pr_debug("GUID Partitition Entry Size check failed.\n");
+               goto fail;
+       }
+
        if (!(*ptes = alloc_read_gpt_entries(state, *gpt)))
                goto fail;