Skip to content

Commit

Permalink
MdeModulePkg/IScsiDxe: Set ExitBootServiceEvent to NULL after close it.
Browse files Browse the repository at this point in the history
v2:
* Refine the commit log.

There are two place to close the ISCSI ExitBootServiceEvent:
#1.IScsiOnExitBootService(), which is the callback function of
   ExitBootServiceEvent.
#2.IScsiCleanDriverData(), which will be invoked by ISCSI driver
   binding stop().

So, the ExitBootServiceEvent will be closed and freed when exit boot
server is triggered. But it may be closed and freed again in ISCSI driver
binding stop(), which will result in the issue recorded at
https://bugzilla.tianocore.org/show_bug.cgi?id=742.

This patch is to resolve the issue.

Cc: Ye Ting <[email protected]>
Cc: Fu Siyuan <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <[email protected]>
Reviewed-by: Fu Siyuan <[email protected]>
(cherry picked from commit d321598)
  • Loading branch information
jiaxinwu committed Jan 10, 2018
1 parent 4276a38 commit 4c33ac7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions MdeModulePkg/Universal/Network/IScsiDxe/IScsiMisc.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @file
Miscellaneous routines for iSCSI driver.
Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
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
Expand Down Expand Up @@ -624,9 +624,10 @@ IScsiCleanDriverData (
}

EXIT:

gBS->CloseEvent (Private->ExitBootServiceEvent);

if (Private->ExitBootServiceEvent != NULL) {
gBS->CloseEvent (Private->ExitBootServiceEvent);
}

FreePool (Private);
return Status;
}
Expand Down Expand Up @@ -872,7 +873,9 @@ IScsiOnExitBootService (
ISCSI_DRIVER_DATA *Private;

Private = (ISCSI_DRIVER_DATA *) Context;

gBS->CloseEvent (Private->ExitBootServiceEvent);
Private->ExitBootServiceEvent = NULL;

IScsiSessionAbort (&Private->Session);
}
Expand Down

0 comments on commit 4c33ac7

Please sign in to comment.