lkml.org 
[lkml]   [2012]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[34-longterm 172/196] Validate size of EFI GUID partition entries.
Date
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


\
 
 \ /
  Last update: 2012-03-13 01:35    [W:0.377 / U:0.824 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site