On Thu, Jul 16, 2009 at 10:52:37PM +0200, Vladimir 'phcoder' Serbinenko wrote: > @@ -94,10 +95,28 @@ grub_chainloader_cmd (const char *filename, > grub_chainloader_flags_t flags) > dev = grub_device_open (0); > if (dev && dev->disk && dev->disk->partition) > { > - grub_disk_read (dev->disk, dev->disk->partition->offset, 446, 64, > - (void *) GRUB_MEMORY_MACHINE_PART_TABLE_ADDR); > - part_addr = (void *) (GRUB_MEMORY_MACHINE_PART_TABLE_ADDR > - + (dev->disk->partition->index << 4)); > + grub_disk_t disk = dev->disk; > + > + if (disk) > + { > + grub_partition_t p = disk->partition; > + > + /* In i386-pc, the id is equal to the BIOS drive number. */ > + drive = (int) disk->id; > + > + if (p && grub_strcmp (p->partmap->name, "pc_partition_map") == 0) > + { > + disk->partition = p->parent; > + grub_disk_read (disk, p->offset, 446, 64, > + (void *) GRUB_MEMORY_MACHINE_PART_TABLE_ADDR); > + part_addr = (void *) (GRUB_MEMORY_MACHINE_PART_TABLE_ADDR > + + (((struct grub_pc_partition *) p->data) > + ->index << 4)); > + disk->partition = p; > + } > + } > + > + grub_device_close (dev);
I don't think we should allow chainload at all in partitions other than msdos ones. There's no existing use of this for other labels "in the wild", and we shouldn't encourage it to appear IMO. If we have partitions and the "pc_partition_map" match fails, I would just abort. -- Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all." _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel