]> git.proxmox.com Git - mirror_edk2.git/commitdiff
NetworkPkg: 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:07 +0000 (09:04 +0800)
committerJiaxin Wu <jiaxin.wu@intel.com>
Tue, 31 May 2016 02:56:21 +0000 (10:56 +0800)
In Ip6CleanService()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>
NetworkPkg/Ip6Dxe/Ip6Driver.c

index 16617c12b174163bfc7279e082c44582b07e1493..f2df200602abfdfc4aaf0dcf380abc7006b568ad 100644 (file)
@@ -149,6 +149,22 @@ Ip6CleanService (
   EFI_IPv6_ADDRESS          AllNodes;\r
   IP6_NEIGHBOR_ENTRY        *NeighborCache;\r
 \r
+  IpSb->State     = IP6_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->FasterTimer != NULL) {\r
+    gBS->SetTimer (IpSb->FasterTimer, TimerCancel, 0);\r
+    gBS->CloseEvent (IpSb->FasterTimer);\r
+\r
+    IpSb->FasterTimer = NULL;\r
+  }\r
+\r
   Ip6ConfigCleanInstance (&IpSb->Ip6ConfigInstance);\r
 \r
   if (!IpSb->LinkLocalDadFail) {\r
@@ -214,19 +230,6 @@ Ip6CleanService (
     gBS->CloseEvent (IpSb->RecvRequest.MnpToken.Event);\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->FasterTimer != NULL) {\r
-    gBS->SetTimer (IpSb->FasterTimer, TimerCancel, 0);\r
-    gBS->CloseEvent (IpSb->FasterTimer);\r
-\r
-    IpSb->FasterTimer = NULL;\r
-  }\r
   //\r
   // Free the Neighbor Discovery resources\r
   //\r
@@ -759,8 +762,6 @@ Ip6DriverBindingStop (
                );\r
   } else if (IsListEmpty (&IpSb->Children)) {\r
     State           = IpSb->State;\r
-    IpSb->State     = IP6_SERVICE_DESTROY;\r
-\r
     Status = Ip6CleanService (IpSb);\r
     if (EFI_ERROR (Status)) {\r
       IpSb->State = State;\r