Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fa039d5f authored by Timo Warns's avatar Timo Warns Committed by Linus Torvalds
Browse files

Validate size of EFI GUID partition entries.



Otherwise corrupted EFI partition tables can cause total confusion.

Signed-off-by: default avatarTimo Warns <warns@pre-sense.de>
Cc: stable@kernel.org
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent bfd412db
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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;