]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg: Stop the timer before clean IP service.
authorFu, Siyuan <C:/Program Files (x86)/Git/o=Intel/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=sfu5>
Thu, 26 May 2016 01:04:06 +0000 (09:04 +0800)
committerJiaxin Wu <jiaxin.wu@intel.com>
Tue, 31 May 2016 02:56:04 +0000 (10:56 +0800)
In Ip4CleanService()it first cleaned some resources, then stop the timer .
While before the timer stopped it may try to access some already freed
data, which may generate an exception.
This patch updates the driver to stop the timer event before starting to
clean up the service data.

Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Subramanian Sriram <sriram-s@hpe.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hpe.com>
Reviewed-by: Sriram Subramanian <sriram-s@hpe.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c

index fb83784da96a6403487bb8637bbe384ec41d5ee8..fcd3ccb9fd2c218201dd032dff1a32822e9e6edb 100644 (file)
@@ -393,6 +393,15 @@ Ip4CleanService (
 {\r
   EFI_STATUS                Status;\r
 \r
 {\r
   EFI_STATUS                Status;\r
 \r
+  IpSb->State     = IP4_SERVICE_DESTROY;\r
+\r
+  if (IpSb->Timer != NULL) {\r
+    gBS->SetTimer (IpSb->Timer, TimerCancel, 0);\r
+    gBS->CloseEvent (IpSb->Timer);\r
+\r
+    IpSb->Timer = NULL;\r
+  }\r
+\r
   if (IpSb->DefaultInterface != NULL) {\r
     Status = Ip4FreeInterface (IpSb->DefaultInterface, NULL);\r
 \r
   if (IpSb->DefaultInterface != NULL) {\r
     Status = Ip4FreeInterface (IpSb->DefaultInterface, NULL);\r
 \r
@@ -432,13 +441,6 @@ Ip4CleanService (
     IpSb->MnpChildHandle = NULL;\r
   }\r
 \r
     IpSb->MnpChildHandle = NULL;\r
   }\r
 \r
-  if (IpSb->Timer != NULL) {\r
-    gBS->SetTimer (IpSb->Timer, TimerCancel, 0);\r
-    gBS->CloseEvent (IpSb->Timer);\r
-\r
-    IpSb->Timer = NULL;\r
-  }\r
-\r
   if (IpSb->ReconfigEvent != NULL) {\r
     gBS->CloseEvent (IpSb->ReconfigEvent);\r
 \r
   if (IpSb->ReconfigEvent != NULL) {\r
     gBS->CloseEvent (IpSb->ReconfigEvent);\r
 \r
@@ -750,8 +752,6 @@ Ip4DriverBindingStop (
 \r
   } else if (IsListEmpty (&IpSb->Children)) {\r
     State           = IpSb->State;\r
 \r
   } else if (IsListEmpty (&IpSb->Children)) {\r
     State           = IpSb->State;\r
-    IpSb->State     = IP4_SERVICE_DESTROY;\r
-\r
     //\r
     // OK, clean other resources then uninstall the service binding protocol.\r
     //\r
     //\r
     // OK, clean other resources then uninstall the service binding protocol.\r
     //\r