提交 33afd7a7 编写于 作者: D Davidlohr Bueso 提交者: Linus Torvalds

partitions/efi: check pmbr record's starting lba

Per the UEFI Specs 2.4, June 2013, the starting lba of the partition that
has the EFI GPT (0xEE) must be set to 0x00000001 - this is obviously the
LBA of the GPT Partition Header.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: NDavidlohr Bueso <davidlohr@hp.com>
Reviewed-by: NKarel Zak <kzak@redhat.com>
Acked-by: NMatt Fleming <matt.fleming@intel.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 c2ebdc24
...@@ -151,10 +151,19 @@ static u64 last_lba(struct block_device *bdev) ...@@ -151,10 +151,19 @@ static u64 last_lba(struct block_device *bdev)
static inline int pmbr_part_valid(gpt_mbr_record *part) static inline int pmbr_part_valid(gpt_mbr_record *part)
{ {
if (part->os_type == EFI_PMBR_OSTYPE_EFI_GPT && if (part->os_type != EFI_PMBR_OSTYPE_EFI_GPT)
le32_to_cpu(part->start_sector) == 1UL) goto invalid;
return 1;
return 0; /* set to 0x00000001 (i.e., the LBA of the GPT Partition Header) */
if (le32_to_cpu(part->starting_lba) != GPT_PRIMARY_PARTITION_TABLE_LBA)
goto invalid;
if (le32_to_cpu(part->start_sector) != 1UL)
goto invalid;
return 1;
invalid:
return 0;
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册