aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorTimo Warns <Warns@pre-sense.de>2011-05-06 13:47:35 +0200
committerWilly Tarreau <w@1wt.eu>2012-02-11 15:37:26 +0100
commit78502a11878ae97dab80957b5f1a57c2ac556202 (patch)
tree1533efaa6d1e5765cf9ba8a320048ca5ee96f5f2 /fs
parent5deca54d37cd52333783def09203ac245d73de92 (diff)
Validate size of EFI GUID partition entries.
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: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Willy Tarreau <w@1wt.eu>
Diffstat (limited to 'fs')
-rw-r--r--fs/partitions/efi.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/partitions/efi.c b/fs/partitions/efi.c
index 038a6022152..20b583e37c5 100644
--- a/fs/partitions/efi.c
+++ b/fs/partitions/efi.c
@@ -343,6 +343,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;