[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1351163753.2513.17.camel@offbook>
Date: Thu, 25 Oct 2012 13:15:53 +0200
From: Davidlohr Bueso <dave@....org>
To: Jens Axboe <axboe@...nel.dk>, Matt Domsch <Matt_Domsch@...l.com>
Cc: lkml <linux-kernel@...r.kernel.org>
Subject: [PATCH RESEND 3/3] partitions: efi: check minimum header size
As per UEFI specs 2.3.1 (June 2012),
"The Header Size must be greater than 92 and must be less than
or equal to the logical block size"
Signed-off-by: Davidlohr Bueso <dave@....org>
---
block/partitions/efi.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/block/partitions/efi.c b/block/partitions/efi.c
index abf33a2..688b59c 100644
--- a/block/partitions/efi.c
+++ b/block/partitions/efi.c
@@ -25,6 +25,9 @@
* TODO:
*
* Changelog:
+ * Oct 2012 Davidlohr Bueso <dave@....org>
+ * - tighten GPT header integrity verification.
+ *
* Mon Nov 09 2004 Matt Domsch <Matt_Domsch@...l.com>
* - test for valid PMBR and valid PGPT before ever reading
* AGPT, allow override with 'gpt' kernel command line option.
@@ -311,8 +314,8 @@ static int is_gpt_valid(struct parsed_partitions *state, u64 lba,
}
/* Check the GUID Partition Table header size */
- if (le32_to_cpu((*gpt)->header_size) >
- bdev_logical_block_size(state->bdev)) {
+ if (le32_to_cpu((*gpt)->header_size) < 92 ||
+ le32_to_cpu((*gpt)->header_size) > bdev_logical_block_size(state->bdev)) {
pr_debug("GUID Partition Table Header size is wrong: %u > %u\n",
le32_to_cpu((*gpt)->header_size),
bdev_logical_block_size(state->bdev));
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists