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 <hao.a...@intel.com>
---
 MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

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);
-- 
1.9.5.msysgit.0

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to