summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorTimo Warns <Warns@pre-sense.de>2011-05-06 13:47:35 +0200
committerAndy Green <andy.green@linaro.org>2011-05-31 11:01:40 +0100
commitdb5319140624253ab9968ff5a3ef4e84d8a53ee4 (patch)
tree8bd812f6ca21fb8ef143304b4e09f4a4b9e1b86c /fs
parent1133b2b37ee2018f1de99b15f74f8bf06bf5f42b (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 ac0ccb5026a..19d6750d1d6 100644
--- a/fs/partitions/efi.c
+++ b/fs/partitions/efi.c
@@ -348,6 +348,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;