diff options
author | Fu, Siyuan <C:/Program Files (x86)/Git/o=Intel/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=sfu5> | 2016-05-26 09:04:07 +0800 |
---|---|---|
committer | Jiaxin Wu <jiaxin.wu@intel.com> | 2016-05-31 10:56:21 +0800 |
commit | 5c944a654a687a06e03b971120faace870dc91f7 (patch) | |
tree | 97d99096bcc2e8357dd3e8f541c1e00a7a0db6c4 | |
parent | 524813f3ab556af64ddbe8fe5d30ef3328cb7324 (diff) | |
download | edk2-platforms-5c944a654a687a06e03b971120faace870dc91f7.tar.xz |
NetworkPkg: Stop the timer before clean IP service.
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>
-rw-r--r-- | NetworkPkg/Ip6Dxe/Ip6Driver.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/NetworkPkg/Ip6Dxe/Ip6Driver.c b/NetworkPkg/Ip6Dxe/Ip6Driver.c index 16617c12b1..f2df200602 100644 --- a/NetworkPkg/Ip6Dxe/Ip6Driver.c +++ b/NetworkPkg/Ip6Dxe/Ip6Driver.c @@ -149,6 +149,22 @@ Ip6CleanService ( EFI_IPv6_ADDRESS AllNodes;
IP6_NEIGHBOR_ENTRY *NeighborCache;
+ IpSb->State = IP6_SERVICE_DESTROY;
+
+ if (IpSb->Timer != NULL) {
+ gBS->SetTimer (IpSb->Timer, TimerCancel, 0);
+ gBS->CloseEvent (IpSb->Timer);
+
+ IpSb->Timer = NULL;
+ }
+
+ if (IpSb->FasterTimer != NULL) {
+ gBS->SetTimer (IpSb->FasterTimer, TimerCancel, 0);
+ gBS->CloseEvent (IpSb->FasterTimer);
+
+ IpSb->FasterTimer = NULL;
+ }
+
Ip6ConfigCleanInstance (&IpSb->Ip6ConfigInstance);
if (!IpSb->LinkLocalDadFail) {
@@ -214,19 +230,6 @@ Ip6CleanService ( gBS->CloseEvent (IpSb->RecvRequest.MnpToken.Event);
}
- if (IpSb->Timer != NULL) {
- gBS->SetTimer (IpSb->Timer, TimerCancel, 0);
- gBS->CloseEvent (IpSb->Timer);
-
- IpSb->Timer = NULL;
- }
-
- if (IpSb->FasterTimer != NULL) {
- gBS->SetTimer (IpSb->FasterTimer, TimerCancel, 0);
- gBS->CloseEvent (IpSb->FasterTimer);
-
- IpSb->FasterTimer = NULL;
- }
//
// Free the Neighbor Discovery resources
//
@@ -759,8 +762,6 @@ Ip6DriverBindingStop ( );
} else if (IsListEmpty (&IpSb->Children)) {
State = IpSb->State;
- IpSb->State = IP6_SERVICE_DESTROY;
-
Status = Ip6CleanService (IpSb);
if (EFI_ERROR (Status)) {
IpSb->State = State;
|