From: Timo Warns Date: Fri, 6 May 2011 11:47:35 +0000 (+0200) Subject: Validate size of EFI GUID partition entries. X-Git-Tag: firefly_0821_release~10186^2~20 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=88b5ff36c09c33d8b47d4c485bbb9c4ec136232b;p=firefly-linux-kernel-4.4.55.git Validate size of EFI GUID partition entries. commit fa039d5f6b126fbd65eefa05db2f67e44df8f121 upstream. Otherwise corrupted EFI partition tables can cause total confusion. Signed-off-by: Timo Warns Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- 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;