Ticket #10717: ensure_blocksize.patch

File ensure_blocksize.patch, 1.3 KB (added by waddlesplash, 10 years ago)

Patch v2.

  • src/system/kernel/disk_device_manager/KPartitioningSystem.cpp

    From 262b145d58a1629c2c495801a77e70542a55ab4a Mon Sep 17 00:00:00 2001
    From: Augustin Cavalier <waddlesplash@gmail.com>
    Date: Sat, 5 Jul 2014 16:57:26 -0400
    Subject: [PATCH] Ensure partition block size is not 0.
    
     * I tried having this test in KDiskDeviceManager.cpp, but it
       failed booting in one case and did not solve the problem in another.
       I think this is because there is an Open() call here, and that rereads
       the blocksize.
     * Tested and it solved the problem for me.
     * Should fix #10717 and #9489 at least.
    ---
     src/system/kernel/disk_device_manager/KPartitioningSystem.cpp | 5 +++++
     1 file changed, 5 insertions(+)
    
    diff --git a/src/system/kernel/disk_device_manager/KPartitioningSystem.cpp b/src/system/kernel/disk_device_manager/KPartitioningSystem.cpp
    index 790028e..46e24c8 100644
    a b KPartitioningSystem::Identify(KPartition *partition, void **cookie)  
    6969    int fd = -1;
    7070    if (partition->Open(O_RDONLY, &fd) != B_OK)
    7171        return -1;
     72   
     73    // if BlockSize is 0, identify_partition will cause a KDL
     74    if (partition->BlockSize() == 0)
     75        return -1;
     76       
    7277    float result = fModule->identify_partition(fd, partition->PartitionData(),
    7378        cookie);
    7479    close(fd);