summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorTimo Warns <Warns@pre-sense.de>2011-05-06 13:47:35 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2011-05-23 11:20:14 -0700
commit88b5ff36c09c33d8b47d4c485bbb9c4ec136232b (patch)
treea7c9a61da75855997fc13f4946ef757833b3895f /fs
parentb3f815365f0bf897ece5d2896cb0534a9b70d28c (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: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs')
-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 49cfd5f54238..2aac7764b7e5 100644
--- a/fs/partitions/efi.c
+++ b/fs/partitions/efi.c
@@ -349,6 +349,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;