| From | Paul Gortmaker <> | Subject | [34-longterm 172/196] Validate size of EFI GUID partition entries. | Date | Mon, 12 Mar 2012 20:21:25 -0400 |
| |
From: Timo Warns <Warns@pre-sense.de>
------------------- This is a commit scheduled for the next v2.6.34 longterm release. If you see a problem with using this for longterm, please comment. -------------------
commit fa039d5f6b126fbd65eefa05db2f67e44df8f121 upstream.
Otherwise corrupted EFI partition tables can cause total confusion.
Signed-off-by: Timo Warns <warns@pre-sense.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> --- fs/partitions/efi.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/fs/partitions/efi.c b/fs/partitions/efi.c index 91babda..ee59684 100644 --- a/fs/partitions/efi.c +++ b/fs/partitions/efi.c @@ -350,6 +350,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; -- 1.7.9.3
|