The patch titled Subject: block/partitions/efi.c: ensure that the GPT header is at least the size of the structure. has been added to the -mm tree. Its filename is ensure-that-the-gpt-header-is-at-least-the-size-of-the-structure.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Peter Jones <pjones@xxxxxxxxxx> Subject: block/partitions/efi.c: ensure that the GPT header is at least the size of the structure. UEFI 2.3.1D will include a change to the spec language mandating that a GPT header must be greater than *or equal to* the size of the defined structure. While verifying that this would work on Linux, I discovered that we're not actually checking the minimum bound at all. The result of this is that when we verify the checksum, it's possible that on a malformed header (with header_size of 0), we won't actually verify any data. Signed-off-by: Peter Jones <pjones@xxxxxxxxxx> Acked-by: Matt Fleming <matt.fleming@xxxxxxxxx> Cc: Jens Axboe <axboe@xxxxxxxxx> Cc: Stephen Warren <swarren@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- block/partitions/efi.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff -puN block/partitions/efi.c~ensure-that-the-gpt-header-is-at-least-the-size-of-the-structure block/partitions/efi.c --- a/block/partitions/efi.c~ensure-that-the-gpt-header-is-at-least-the-size-of-the-structure +++ a/block/partitions/efi.c @@ -310,15 +310,23 @@ static int is_gpt_valid(struct parsed_pa goto fail; } - /* Check the GUID Partition Table header size */ + /* Check the GUID Partition Table header size is too big */ if (le32_to_cpu((*gpt)->header_size) > bdev_logical_block_size(state->bdev)) { - pr_debug("GUID Partition Table Header size is wrong: %u > %u\n", + pr_debug("GUID Partition Table Header size is too large: %u > %u\n", le32_to_cpu((*gpt)->header_size), bdev_logical_block_size(state->bdev)); goto fail; } + /* Check the GUID Partition Table header size is too small */ + if (le32_to_cpu((*gpt)->header_size) < sizeof(gpt_header)) { + pr_debug("GUID Partition Table Header size is too small: %u < %lu\n", + le32_to_cpu((*gpt)->header_size), + sizeof(gpt_header)); + goto fail; + } + /* Check the GUID Partition Table CRC */ origcrc = le32_to_cpu((*gpt)->header_crc32); (*gpt)->header_crc32 = 0; _ Patches currently in -mm which might be from pjones@xxxxxxxxxx are ensure-that-the-gpt-header-is-at-least-the-size-of-the-structure.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html