]> 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)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Wed, 14 Mar 2012 14:57:55 +0000 (10:57 -0400)
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: Paul Gortmaker <paul.gortmaker@windriver.com>
fs/partitions/efi.c

index 91babdae75875bc0e7510c9594529cca1247e20c..ee59684b36943bcf8e536e3bf0d4d2f402c407bd 100644 (file)
@@ -350,6 +350,12 @@ is_gpt_valid(struct block_device *bdev, 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(bdev, *gpt)))
                goto fail;