When we find a disk device, we try to read its partition table to perhaps divide the device into several partitions. If we fail to find this partition table, it is fine - it means the disk has no partitions. However, if we had an I/O error reading the partition table, the exiting code continued to process the read data, even though it wasn't, and crashed on this processing or on the brelse() at its end.
In this case, the read_partition_table() should just do nothing, and certainly not crash. Refs #903. Signed-off-by: Nadav Har'El <n...@scylladb.com> --- fs/devfs/device.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/devfs/device.cc b/fs/devfs/device.cc index 1cab939..7f19049 100644 --- a/fs/devfs/device.cc +++ b/fs/devfs/device.cc @@ -107,7 +107,10 @@ void read_partition_table(struct device *dev) unsigned long offset; int index; - bread(dev, 0, &bp); + if (bread(dev, 0, &bp) != 0) { + debugf("read_partition_table failed for %s", dev->name); + return; + } sched_lock(); // A real partition table (MBR) ends in the two bytes 0x55, 0xAA (see -- 2.9.5 -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to osv-dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.