Skip to content

Commit

Permalink
Validate size of EFI GUID partition entries.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Timo Warns authored and Linus Torvalds committed May 6, 2011
1 parent bfd412d commit fa039d5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fs/partitions/efi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit fa039d5

Please sign in to comment.