[Description]

solve the x64 exception issue when unloading iSCSI driver
[Impaction]
add some handler for failure branch and prohibit the additional ISCSI INITIATOR NAME PROTOCOL from being installed. 
[Reference Info]
this bug is reported by DELL. it causes an exception in x64 on unloading iscsi driver.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4941 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
eric_tian 2008-03-21 03:28:56 +00:00
parent e41b500030
commit f2a94e2558
2 changed files with 50 additions and 20 deletions

View File

@ -1,6 +1,6 @@
/*++
Copyright (c) 2004 - 2007, Intel Corporation
Copyright (c) 2004 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@ -19,10 +19,10 @@ Abstract:
#include "IScsiImpl.h"
EFI_GUID mVendorGuid = ISCSI_CONFIG_GUID;
BOOLEAN mIScsiDeviceListUpdated = FALSE;
UINTN mNumberOfIScsiDevices = 0;
ISCSI_FORM_CALLBACK_INFO *mCallbackInfo;
EFI_GUID mVendorGuid = ISCSI_CONFIG_GUID;
BOOLEAN mIScsiDeviceListUpdated = FALSE;
UINTN mNumberOfIScsiDevices = 0;
ISCSI_FORM_CALLBACK_INFO *mCallbackInfo = NULL;
LIST_ENTRY mIScsiConfigFormList = {
&mIScsiConfigFormList,
@ -923,9 +923,9 @@ Returns:
return EFI_OUT_OF_RESOURCES;
}
CallbackInfo->Signature = ISCSI_FORM_CALLBACK_INFO_SIGNATURE;
CallbackInfo->Signature = ISCSI_FORM_CALLBACK_INFO_SIGNATURE;
CallbackInfo->HiiDatabase = HiiDatabase;
CallbackInfo->Current = NULL;
CallbackInfo->Current = NULL;
CallbackInfo->ConfigAccess.ExtractConfig = IScsiFormExtractConfig;
CallbackInfo->ConfigAccess.RouteConfig = IScsiFormRouteConfig;
@ -933,6 +933,7 @@ Returns:
Status = gBS->LocateProtocol (&gEfiHiiConfigRoutingProtocolGuid, NULL, (VOID **)&CallbackInfo->ConfigRouting);
if (EFI_ERROR (Status)) {
FreePool(CallbackInfo);
return Status;
}
@ -941,6 +942,7 @@ Returns:
//
Status = HiiLibCreateHiiDriverHandle (&CallbackInfo->DriverHandle);
if (EFI_ERROR (Status)) {
FreePool(CallbackInfo);
return Status;
}
@ -967,8 +969,9 @@ Returns:
CallbackInfo->DriverHandle,
&CallbackInfo->RegisteredHandle
);
gBS->FreePool (PackageList);
FreePool (PackageList);
if (EFI_ERROR (Status)) {
FreePool(CallbackInfo);
return Status;
}

View File

@ -1,6 +1,6 @@
/*++
Copyright (c) 2004 - 2007, Intel Corporation
Copyright (c) 2004 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@ -413,8 +413,21 @@ Returns:
--*/
{
EFI_STATUS Status;
//EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
EFI_STATUS Status;
EFI_ISCSI_INITIATOR_NAME_PROTOCOL *IScsiInitiatorName;
//
// There should be only one EFI_ISCSI_INITIATOR_NAME_PROTOCOL.
//
Status = gBS->LocateProtocol (
&gEfiIScsiInitiatorNameProtocolGuid,
NULL,
&IScsiInitiatorName
);
if (!EFI_ERROR (Status)) {
return EFI_ACCESS_DENIED;
}
//
// Initialize the EFI Driver Library
@ -427,12 +440,11 @@ Returns:
&gIScsiComponentName,
&gIScsiComponentName2
);
if (EFI_ERROR (Status)) {
return Status;
}
if (!EFI_ERROR (Status)) {
//
// Install the iSCSI Initiator Name Protocol.
//
Status = gBS->InstallProtocolInterface (
&ImageHandle,
&gEfiIScsiInitiatorNameProtocolGuid,
@ -450,13 +462,28 @@ Returns:
&gIScsiComponentName,
NULL
);
return Status;
}
//
// Initialize the configuration form of iSCSI.
//
Status = IScsiConfigFormInit (gIScsiDriverBinding.DriverBindingHandle);
if (EFI_ERROR (Status)) {
gBS->UninstallMultipleProtocolInterfaces (
ImageHandle,
&gEfiDriverBindingProtocolGuid,
&gIScsiDriverBinding,
&gEfiComponentName2ProtocolGuid,
&gIScsiComponentName2,
&gEfiComponentNameProtocolGuid,
&gIScsiComponentName,
&gEfiIScsiInitiatorNameProtocolGuid,
&gIScsiInitiatorName,
NULL
);
}
}
//
// Initialize the configuration form of iSCSI.
//
IScsiConfigFormInit (gIScsiDriverBinding.DriverBindingHandle);
return Status;
}