From a37c60b660e7de30a36f63a07a8149ac2fa30277 Mon Sep 17 00:00:00 2001 From: Jiaxin Wu Date: Tue, 2 Jan 2018 13:30:44 +0800 Subject: [PATCH] NetworkPkg/IScsiDxe: Set ExitBootServiceEvent to NULL after close it. 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 Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin Reviewed-by: Fu Siyuan --- NetworkPkg/IScsiDxe/IScsiMisc.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/NetworkPkg/IScsiDxe/IScsiMisc.c b/NetworkPkg/IScsiDxe/IScsiMisc.c index 9e4164c986..94f3725866 100644 --- a/NetworkPkg/IScsiDxe/IScsiMisc.c +++ b/NetworkPkg/IScsiDxe/IScsiMisc.c @@ -1,7 +1,7 @@ /** @file Miscellaneous routines for iSCSI driver. -Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2018, 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 @@ -1798,8 +1798,9 @@ IScsiCleanDriverData ( } EXIT: - - gBS->CloseEvent (Private->ExitBootServiceEvent); + if (Private->ExitBootServiceEvent != NULL) { + gBS->CloseEvent (Private->ExitBootServiceEvent); + } mCallbackInfo->Current = NULL; @@ -2485,8 +2486,10 @@ IScsiOnExitBootService ( ISCSI_DRIVER_DATA *Private; Private = (ISCSI_DRIVER_DATA *) Context; + gBS->CloseEvent (Private->ExitBootServiceEvent); - + Private->ExitBootServiceEvent = NULL; + if (Private->Session != NULL) { IScsiSessionAbort (Private->Session); } -- 2.39.2