From: Timo Warns Date: Fri, 6 May 2011 11:47:35 +0000 (+0200) Subject: Validate size of EFI GUID partition entries. X-Git-Tag: v3.12-rc1~6221 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fa039d5f6b126fbd65eefa05db2f67e44df8f121;p=kernel%2Fkernel-generic.git Validate size of EFI GUID partition entries. Otherwise corrupted EFI partition tables can cause total confusion. Signed-off-by: Timo Warns Cc: stable@kernel.org Signed-off-by: Linus Torvalds --- diff --git a/fs/partitions/efi.c b/fs/partitions/efi.c index ac0ccb5..19d6750 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;