Kernel: Fix booting from "inactive" MBR partitions

Apparently you can boot from any MBR partition, not just the one labeled
as "bootable" or "active". The only ones you don't want to boot from are
the ones that don't exist.
This commit is contained in:
Conrad Pankoff 2019-06-08 18:31:36 +10:00 committed by Andreas Kling
parent de65c960e9
commit 842bf96e2c
Notes: sideshowbarker 2024-07-19 13:40:30 +09:00

View File

@ -53,9 +53,17 @@ RetainPtr<DiskPartition> MBRPartitionTable::partition(unsigned index)
kprintf("MBRPartitionTable::partition: status=%#x offset=%#x\n", entry.status, entry.offset);
#endif
if (entry.status == 0x00) {
if (entry.offset == 0x00) {
#ifdef MBR_DEBUG
kprintf("MBRPartitionTable::partition: missing partition requested index=%d\n", index);
#endif
return nullptr;
}
#ifdef MBR_DEBUG
kprintf("MBRPartitionTable::partition: found partition index=%d type=%x\n", index, entry.type);
#endif
return DiskPartition::create(m_device.copy_ref(), entry.offset);
}