projects/linux·commit fa039d5f

Validate size of EFI GUID partition entries.

fa039d5f · Timo Warns <[email protected]> · 2011-05-06 13:47:35 +02:00

Otherwise corrupted EFI partition tables can cause total confusion.

Signed-off-by: Timo Warns <[email protected]>
Cc: [email protected]
Signed-off-by: Linus Torvalds <[email protected]>
Commit
fa039d5f6b126fbd65eefa05db2f67e44df8f121
Parents
bfd412db

Changes

1 files changed · +6 −0

FileStatusAddDelContent
fs/partitions/efi.cmodified+6−0View file

fs/partitions/efi.c

View file
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;