summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Warns <Warns@pre-sense.de>2011-05-06 13:47:35 +0200
committerPaul Gortmaker <paul.gortmaker@windriver.com>2012-03-14 10:57:55 -0400
commitef587df573ad04e0ac03bc80ce1231cbcc2f3a64 (patch)
tree4a8f4488a09feb935b2a50cda7485c75fb4d8b08
parent6c245ccf08985a986f358dfc9fa8964756843072 (diff)
Validate size of EFI GUID partition entries.
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>
-rw-r--r--fs/partitions/efi.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/partitions/efi.c b/fs/partitions/efi.c
index 91babdae7587..ee59684b3694 100644
--- a/fs/partitions/efi.c
+++ b/fs/partitions/efi.c
@@ -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;