summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFu, Siyuan <C:/Program Files (x86)/Git/o=Intel/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=sfu5>2016-05-26 09:04:06 +0800
committerJiaxin Wu <jiaxin.wu@intel.com>2016-05-31 10:56:04 +0800
commit524813f3ab556af64ddbe8fe5d30ef3328cb7324 (patch)
tree2ac8067f9ec03ce9980c63a0864d103567fd6b4d
parent3ab7066e8d8ae43d9cdee76600b90918f8bee5d9 (diff)
downloadedk2-platforms-524813f3ab556af64ddbe8fe5d30ef3328cb7324.tar.xz
MdeModulePkg: Stop the timer before clean IP service.
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>
-rw-r--r--MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
index fb83784da9..fcd3ccb9fd 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Driver.c
@@ -393,6 +393,15 @@ Ip4CleanService (
{
EFI_STATUS Status;
+ IpSb->State = IP4_SERVICE_DESTROY;
+
+ if (IpSb->Timer != NULL) {
+ gBS->SetTimer (IpSb->Timer, TimerCancel, 0);
+ gBS->CloseEvent (IpSb->Timer);
+
+ IpSb->Timer = NULL;
+ }
+
if (IpSb->DefaultInterface != NULL) {
Status = Ip4FreeInterface (IpSb->DefaultInterface, NULL);
@@ -432,13 +441,6 @@ Ip4CleanService (
IpSb->MnpChildHandle = NULL;
}
- if (IpSb->Timer != NULL) {
- gBS->SetTimer (IpSb->Timer, TimerCancel, 0);
- gBS->CloseEvent (IpSb->Timer);
-
- IpSb->Timer = NULL;
- }
-
if (IpSb->ReconfigEvent != NULL) {
gBS->CloseEvent (IpSb->ReconfigEvent);
@@ -750,8 +752,6 @@ Ip4DriverBindingStop (
} else if (IsListEmpty (&IpSb->Children)) {
State = IpSb->State;
- IpSb->State = IP4_SERVICE_DESTROY;
-
//
// OK, clean other resources then uninstall the service binding protocol.
//