bootloader/efi: remove partition before adding to new list.

* A Node/Partition cannot be member of two lists at once. This
  resolves an issue where a partition cannot be found later
  due to corruption of a NodeList.
This commit is contained in:
Jessica Hamilton
2018-05-05 14:14:35 +12:00
parent bb96d47d9b
commit f599721237
+3 -1
View File
@@ -488,8 +488,10 @@ platform_get_boot_partitions(struct stage2_args *args, Node *bootDevice,
NodeIterator iterator = partitions->GetIterator();
boot::Partition *partition = NULL;
while ((partition = (boot::Partition*)iterator.Next()) != NULL) {
if (device_contains_partition((EfiDevice*)bootDevice, partition))
if (device_contains_partition((EfiDevice*)bootDevice, partition)) {
iterator.Remove();
bootPartitions->Insert(partition);
}
}
return bootPartitions->Count() > 0 ? B_OK : B_ENTRY_NOT_FOUND;