From 1f09197d196b2a1befaa587e0504d0f2f408f594 Mon Sep 17 00:00:00 2001 From: Hao Wu Date: Tue, 22 Dec 2015 13:56:30 +0000 Subject: MdeModulePkg ScsiDiskDxe: Close event when SCSI command fails The functions ScsiRead10CommandEx(), ScsiWrite10CommandEx(), ScsiRead16CommandEx() and ScsiWrite16CommandEx() in UefiScsiLib will not signal the event passed from ScsiDiskDxe when error occurs. In this case, ScsiDiskDxe should close the event passing to these APIs in UefiScsiLib. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu Reviewed-by: Feng Tian git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19449 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'MdeModulePkg/Bus/Scsi') diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c index 3e19fad..ba7f5a5 100644 --- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c +++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c @@ -3700,6 +3700,8 @@ ScsiDiskAsyncRead10 ( SCSI_ASYNC_RW_REQUEST *Request; EFI_EVENT AsyncIoEvent; + AsyncIoEvent = NULL; + Request = AllocateZeroPool (sizeof (SCSI_ASYNC_RW_REQUEST)); if (Request == NULL) { return EFI_OUT_OF_RESOURCES; @@ -3755,6 +3757,10 @@ ScsiDiskAsyncRead10 ( return EFI_SUCCESS; ErrorExit: + if (AsyncIoEvent != NULL) { + gBS->CloseEvent (AsyncIoEvent); + } + if (Request != NULL) { if (Request->SenseData != NULL) { FreePool (Request->SenseData); @@ -3803,6 +3809,8 @@ ScsiDiskAsyncWrite10 ( SCSI_ASYNC_RW_REQUEST *Request; EFI_EVENT AsyncIoEvent; + AsyncIoEvent = NULL; + Request = AllocateZeroPool (sizeof (SCSI_ASYNC_RW_REQUEST)); if (Request == NULL) { return EFI_OUT_OF_RESOURCES; @@ -3858,6 +3866,10 @@ ScsiDiskAsyncWrite10 ( return EFI_SUCCESS; ErrorExit: + if (AsyncIoEvent != NULL) { + gBS->CloseEvent (AsyncIoEvent); + } + if (Request != NULL) { if (Request->SenseData != NULL) { FreePool (Request->SenseData); @@ -3906,6 +3918,8 @@ ScsiDiskAsyncRead16 ( SCSI_ASYNC_RW_REQUEST *Request; EFI_EVENT AsyncIoEvent; + AsyncIoEvent = NULL; + Request = AllocateZeroPool (sizeof (SCSI_ASYNC_RW_REQUEST)); if (Request == NULL) { return EFI_OUT_OF_RESOURCES; @@ -3961,6 +3975,10 @@ ScsiDiskAsyncRead16 ( return EFI_SUCCESS; ErrorExit: + if (AsyncIoEvent != NULL) { + gBS->CloseEvent (AsyncIoEvent); + } + if (Request != NULL) { if (Request->SenseData != NULL) { FreePool (Request->SenseData); @@ -4009,6 +4027,8 @@ ScsiDiskAsyncWrite16 ( SCSI_ASYNC_RW_REQUEST *Request; EFI_EVENT AsyncIoEvent; + AsyncIoEvent = NULL; + Request = AllocateZeroPool (sizeof (SCSI_ASYNC_RW_REQUEST)); if (Request == NULL) { return EFI_OUT_OF_RESOURCES; @@ -4064,6 +4084,10 @@ ScsiDiskAsyncWrite16 ( return EFI_SUCCESS; ErrorExit: + if (AsyncIoEvent != NULL) { + gBS->CloseEvent (AsyncIoEvent); + } + if (Request != NULL) { if (Request->SenseData != NULL) { FreePool (Request->SenseData); -- cgit v1.1