mirror of https://github.com/acidanthera/audk.git
ShellPkg/Shell: Check the OpenVolume result in OpenRootByHandle()
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=779 For the API EfiShellOpenRootByHandle(): The return status of the call to SimpleFileSystem->OpenVolume should be checked. It is possible that there is a media change in the device (like CD/DVD ROM). In such case, the volume root opened and/or the device path opened previously (also within EfiShellOpenRootByHandle) may be invalid. This commit adds a check for the result of OpenVolume before subsequently calling functions like EfiShellGetMapFromDevicePath() & ConvertEfiFileProtocolToShellHandle(). Cc: Jaben Carsey <jaben.carsey@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
This commit is contained in:
parent
1fbe8276c4
commit
996bd353d2
|
@ -827,7 +827,8 @@ EfiShellGetDeviceName(
|
|||
@retval EFI_NOT_FOUND EFI_SIMPLE_FILE_SYSTEM could not be found or the root directory
|
||||
could not be opened.
|
||||
@retval EFI_VOLUME_CORRUPTED The data structures in the volume were corrupted.
|
||||
@retval EFI_DEVICE_ERROR The device had an error
|
||||
@retval EFI_DEVICE_ERROR The device had an error.
|
||||
@retval Others Error status returned from EFI_SIMPLE_FILE_SYSTEM_PROTOCOL->OpenVolume().
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
|
@ -867,8 +868,12 @@ EfiShellOpenRootByHandle(
|
|||
// Open the root volume now...
|
||||
//
|
||||
Status = SimpleFileSystem->OpenVolume(SimpleFileSystem, &RealFileHandle);
|
||||
if (EFI_ERROR(Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
*FileHandle = ConvertEfiFileProtocolToShellHandle(RealFileHandle, EfiShellGetMapFromDevicePath(&DevPath));
|
||||
return (Status);
|
||||
return (EFI_SUCCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue