public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 2/2] NetworkPkg: Do not free memory during ExitBootServices ().
@ 2016-11-03 23:10 Marvin Häuser
  2016-11-04  1:34 ` Zeng, Star
  0 siblings, 1 reply; 2+ messages in thread
From: Marvin Häuser @ 2016-11-03 23:10 UTC (permalink / raw)
  To: edk2-devel@lists.01.org; +Cc: siyuan.fu@intel.com, jiaxin.wu@intel.com

During exiting Boot Services, there should be no changes made to the
Memory Map. This patch eliminates explicit and implicit calls to the
Memory Allocation Services and, where applicable, zeros the memory
instead.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Marvin Haeuser <Marvin.Haeuser@outlook.com>
---
 NetworkPkg/IScsiDxe/IScsiMisc.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/NetworkPkg/IScsiDxe/IScsiMisc.c b/NetworkPkg/IScsiDxe/IScsiMisc.c
index deebf5d9a387..0825e2a5e944 100644
--- a/NetworkPkg/IScsiDxe/IScsiMisc.c
+++ b/NetworkPkg/IScsiDxe/IScsiMisc.c
@@ -1486,10 +1486,19 @@ IScsiOnExitBootService (
   ISCSI_DRIVER_DATA *Private;
 
   Private = (ISCSI_DRIVER_DATA *) Context;
-  gBS->CloseEvent (Private->ExitBootServiceEvent);
 
   if (Private->Session != NULL) {
     IScsiSessionAbort (Private->Session);
+
+    //
+    // Empty Session as it will not be freed.
+    //
+    ZeroMem (Private->Session, sizeof (*Private->Session));
+
+    //
+    // Set Session to NULL so this code is not re-run.
+    //
+    Private->Session = NULL;
   }
 }
 
-- 
2.10.1.windows.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2 2/2] NetworkPkg: Do not free memory during ExitBootServices ().
  2016-11-03 23:10 [PATCH v2 2/2] NetworkPkg: Do not free memory during ExitBootServices () Marvin Häuser
@ 2016-11-04  1:34 ` Zeng, Star
  0 siblings, 0 replies; 2+ messages in thread
From: Zeng, Star @ 2016-11-04  1:34 UTC (permalink / raw)
  To: Marvin.Haeuser@outlook.com, edk2-devel@lists.01.org
  Cc: Fu, Siyuan, Wu, Jiaxin, Zeng, Star

Reviewed-by: Star Zeng <star.zeng@intel.com>

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Marvin H?user
Sent: Friday, November 4, 2016 7:11 AM
To: edk2-devel@lists.01.org
Cc: Fu, Siyuan <siyuan.fu@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>
Subject: [edk2] [PATCH v2 2/2] NetworkPkg: Do not free memory during ExitBootServices ().

During exiting Boot Services, there should be no changes made to the Memory Map. This patch eliminates explicit and implicit calls to the Memory Allocation Services and, where applicable, zeros the memory instead.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Marvin Haeuser <Marvin.Haeuser@outlook.com>
---
 NetworkPkg/IScsiDxe/IScsiMisc.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/NetworkPkg/IScsiDxe/IScsiMisc.c b/NetworkPkg/IScsiDxe/IScsiMisc.c index deebf5d9a387..0825e2a5e944 100644
--- a/NetworkPkg/IScsiDxe/IScsiMisc.c
+++ b/NetworkPkg/IScsiDxe/IScsiMisc.c
@@ -1486,10 +1486,19 @@ IScsiOnExitBootService (
   ISCSI_DRIVER_DATA *Private;
 
   Private = (ISCSI_DRIVER_DATA *) Context;
-  gBS->CloseEvent (Private->ExitBootServiceEvent);
 
   if (Private->Session != NULL) {
     IScsiSessionAbort (Private->Session);
+
+    //
+    // Empty Session as it will not be freed.
+    //
+    ZeroMem (Private->Session, sizeof (*Private->Session));
+
+    //
+    // Set Session to NULL so this code is not re-run.
+    //
+    Private->Session = NULL;
   }
 }
 
--
2.10.1.windows.1

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-04  1:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-03 23:10 [PATCH v2 2/2] NetworkPkg: Do not free memory during ExitBootServices () Marvin Häuser
2016-11-04  1:34 ` Zeng, Star

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox