* grub-core/partmap/gpt.c (grub_gpt_partition_map_iterate): Accept
protective entry in any slot. * grub-core/partmap/msdos.c (grub_partition_msdos_iterate): Reject if protective entry is found in any slot. Protective entry in non-first slot make no sense but is a widespread brain damage.
This commit is contained in:
parent
4cf6be1bd9
commit
13c6353fc7
3 changed files with 20 additions and 5 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2012-05-22 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/partmap/gpt.c (grub_gpt_partition_map_iterate): Accept
|
||||||
|
protective entry in any slot.
|
||||||
|
* grub-core/partmap/msdos.c (grub_partition_msdos_iterate): Reject
|
||||||
|
if protective entry is found in any slot.
|
||||||
|
|
||||||
|
Protective entry in non-first slot make no sense but is a widespread
|
||||||
|
brain damage.
|
||||||
|
|
||||||
2012-05-22 Vladimir Serbinenko <phcoder@gmail.com>
|
2012-05-22 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* grub-core/fs/squash4.c (grub_squash_read_data): Add missing byte-swap.
|
* grub-core/fs/squash4.c (grub_squash_read_data): Add missing byte-swap.
|
||||||
|
|
|
@ -69,7 +69,10 @@ grub_gpt_partition_map_iterate (grub_disk_t disk,
|
||||||
return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature");
|
return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature");
|
||||||
|
|
||||||
/* Make sure the MBR is a protective MBR and not a normal MBR. */
|
/* Make sure the MBR is a protective MBR and not a normal MBR. */
|
||||||
if (mbr.entries[0].type != GRUB_PC_PARTITION_TYPE_GPT_DISK)
|
for (i = 0; i < 4; i++)
|
||||||
|
if (mbr.entries[i].type == GRUB_PC_PARTITION_TYPE_GPT_DISK)
|
||||||
|
break;
|
||||||
|
if (i == 4)
|
||||||
return grub_error (GRUB_ERR_BAD_PART_TABLE, "no GPT partition map found");
|
return grub_error (GRUB_ERR_BAD_PART_TABLE, "no GPT partition map found");
|
||||||
|
|
||||||
/* Read the GPT header. */
|
/* Read the GPT header. */
|
||||||
|
|
|
@ -136,6 +136,12 @@ grub_partition_msdos_iterate (grub_disk_t disk,
|
||||||
if (grub_disk_read (disk, p.offset, 0, sizeof (mbr), &mbr))
|
if (grub_disk_read (disk, p.offset, 0, sizeof (mbr), &mbr))
|
||||||
goto finish;
|
goto finish;
|
||||||
|
|
||||||
|
/* If this is a GPT partition, this MBR is just a dummy. */
|
||||||
|
if (p.offset == 0)
|
||||||
|
for (i = 0; i < 4; i++)
|
||||||
|
if (mbr.entries[i].type == GRUB_PC_PARTITION_TYPE_GPT_DISK)
|
||||||
|
return grub_error (GRUB_ERR_BAD_PART_TABLE, "dummy mbr");
|
||||||
|
|
||||||
/* This is our loop-detection algorithm. It works the following way:
|
/* This is our loop-detection algorithm. It works the following way:
|
||||||
It saves last position which was a power of two. Then it compares the
|
It saves last position which was a power of two. Then it compares the
|
||||||
saved value with a current one. This way it's guaranteed that the loop
|
saved value with a current one. This way it's guaranteed that the loop
|
||||||
|
@ -174,10 +180,6 @@ grub_partition_msdos_iterate (grub_disk_t disk,
|
||||||
(unsigned long long) p.start,
|
(unsigned long long) p.start,
|
||||||
(unsigned long long) p.len);
|
(unsigned long long) p.len);
|
||||||
|
|
||||||
/* If this is a GPT partition, this MBR is just a dummy. */
|
|
||||||
if (e->type == GRUB_PC_PARTITION_TYPE_GPT_DISK && p.index == 0)
|
|
||||||
return grub_error (GRUB_ERR_BAD_PART_TABLE, "dummy mbr");
|
|
||||||
|
|
||||||
/* If this partition is a normal one, call the hook. */
|
/* If this partition is a normal one, call the hook. */
|
||||||
if (! grub_msdos_partition_is_empty (e->type)
|
if (! grub_msdos_partition_is_empty (e->type)
|
||||||
&& ! grub_msdos_partition_is_extended (e->type))
|
&& ! grub_msdos_partition_is_extended (e->type))
|
||||||
|
|
Loading…
Reference in a new issue