Validate size of EFI GUID partition entries.

Otherwise corrupted EFI partition tables can cause total confusion.

Signed-off-by: Timo Warns <warns@pre-sense.de>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by Timo Warns and committed by Linus Torvalds fa039d5f bfd412db

+6
+6
fs/partitions/efi.c
··· 348 348 goto fail; 349 349 } 350 350 351 + /* Check that sizeof_partition_entry has the correct value */ 352 + if (le32_to_cpu((*gpt)->sizeof_partition_entry) != sizeof(gpt_entry)) { 353 + pr_debug("GUID Partitition Entry Size check failed.\n"); 354 + goto fail; 355 + } 356 + 351 357 if (!(*ptes = alloc_read_gpt_entries(state, *gpt))) 352 358 goto fail; 353 359