mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-26 19:25:02 +00:00
Make VbTryLoadKernel() go to recovery when no valid disks are found
Previously, it was going to recovery only when no disks existed. That didn't catch the case where disks exist but none of them are usable. BUG=chrome-os-partner:7715 TEST=manual I've added a test specifically for this, so just make make runtests should verify it. To test on actual hardware, find a disk or USB drive that has something other than 512 bytes per LBA, and try it. It won't be bootable, but using it shouldn't hang the system or cause weird behavior. Once in recovery, press TAB, and you should see the reason code VBNV_RECOVERY_RW_NO_DISK Change-Id: I475ddd01e13fa806025a2107c260c030d098a17e Reviewed-on: https://gerrit.chromium.org/gerrit/14816 Tested-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@chromium.org> Commit-Ready: Bill Richardson <wfrichar@chromium.org>
This commit is contained in:
committed by
Stefan Reinauer
parent
5fd35971de
commit
bf020a0d4d
@@ -75,7 +75,9 @@ uint32_t VbTryLoadKernel(VbCommonParams* cparams, LoadKernelParams* p,
|
||||
if (512 != disk_info[i].bytes_per_lba || /* cgptlib restriction */
|
||||
32 > disk_info[i].lba_count || /* ditto */
|
||||
get_info_flags != disk_info[i].flags) { /* got only what we asked for */
|
||||
VBDEBUG((" skipping - bogus parameters\n"));
|
||||
VBDEBUG((" skipping: bytes_per_lba=%Ld lba_count=%Ld flags=0x%x\n",
|
||||
disk_info[i].bytes_per_lba, disk_info[i].lba_count,
|
||||
disk_info[i].flags));
|
||||
continue;
|
||||
}
|
||||
p->disk_handle = disk_info[i].handle;
|
||||
@@ -92,8 +94,11 @@ uint32_t VbTryLoadKernel(VbCommonParams* cparams, LoadKernelParams* p,
|
||||
}
|
||||
|
||||
/* If we didn't succeed, don't return a disk handle */
|
||||
if (VBERROR_SUCCESS != retval)
|
||||
if (VBERROR_SUCCESS != retval) {
|
||||
VbSetRecoveryRequest(VBNV_RECOVERY_RW_NO_DISK);
|
||||
retval = VBERROR_NO_DISK_FOUND;
|
||||
p->disk_handle = NULL;
|
||||
}
|
||||
|
||||
VbExDiskFreeInfo(disk_info, p->disk_handle);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user