+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>
* grub-core/fs/squash4.c (grub_squash_read_data): Add missing byte-swap.
return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature");
/* 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");
/* Read the GPT header. */
if (grub_disk_read (disk, p.offset, 0, sizeof (mbr), &mbr))
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:
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
(unsigned long long) p.start,
(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 (! grub_msdos_partition_is_empty (e->type)
&& ! grub_msdos_partition_is_extended (e->type))