]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Fix following problems about VLAN driver:
authorFu Siyuan <siyuan.fu@intel.com>
Fri, 24 Jan 2014 05:33:18 +0000 (05:33 +0000)
committersfu5 <sfu5@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 24 Jan 2014 05:33:18 +0000 (05:33 +0000)
1. "VLAN Configuration” form crash after 'reconnect -r'
2. disconnect VLAN driver from the managed device will return EFI_NOT_FOUND
3. disconnect MNP driver from the managed device, VLAN driver couldn't be stopped.
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ni, Ruiyu <ruiyu.ni@intel.com>
Reviewed-by: Gao, Liming <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15174 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDriver.c
MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigImpl.c
MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigImpl.h

index 52bb99fa5d82c34847ec0adcbec4b43c189b886b..7dfea2e32a810bfb832a3b74f9723b23eb65ec6e 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The driver binding for VLAN configuration module.\r
 \r
 /** @file\r
   The driver binding for VLAN configuration module.\r
 \r
-Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions\r
 of the BSD License which accompanies this distribution.  The full\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions\r
 of the BSD License which accompanies this distribution.  The full\r
@@ -275,10 +275,13 @@ VlanConfigDriverBindingStop (
   }\r
   ASSERT (PrivateData->Signature == VLAN_CONFIG_PRIVATE_DATA_SIGNATURE);\r
 \r
   }\r
   ASSERT (PrivateData->Signature == VLAN_CONFIG_PRIVATE_DATA_SIGNATURE);\r
 \r
-  //\r
-  // Uninstall VLAN configuration Form\r
-  //\r
-  UninstallVlanConfigForm (PrivateData);\r
+  if (NumberOfChildren != 0) {\r
+    if (NumberOfChildren != 1 || ChildHandleBuffer[0] != PrivateData->DriverHandle) {\r
+      return EFI_DEVICE_ERROR;\r
+    }\r
+    \r
+    return UninstallVlanConfigForm (PrivateData);\r
+  }\r
 \r
   //\r
   // Uninstall the private GUID\r
 \r
   //\r
   // Uninstall the private GUID\r
index 10fb7fa670b5bb329154af2989ba50cd4a667001..fd8555e30e8619efdc66a13e30095fc9f70fafef 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   HII Config Access protocol implementation of VLAN configuration module.\r
 \r
 /** @file\r
   HII Config Access protocol implementation of VLAN configuration module.\r
 \r
-Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions\r
 of the BSD License which accompanies this distribution.  The full\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions\r
 of the BSD License which accompanies this distribution.  The full\r
@@ -588,50 +588,54 @@ InstallVlanConfigForm (
 \r
   @param[in, out]  PrivateData   Points to VLAN configuration private data.\r
 \r
 \r
   @param[in, out]  PrivateData   Points to VLAN configuration private data.\r
 \r
+  @retval EFI_SUCCESS            HII Form has been uninstalled successfully.\r
+  @retval Others                 Other errors as indicated.\r
+\r
 **/\r
 **/\r
-VOID\r
+EFI_STATUS\r
 UninstallVlanConfigForm (\r
   IN OUT VLAN_CONFIG_PRIVATE_DATA    *PrivateData\r
   )\r
 {\r
 UninstallVlanConfigForm (\r
   IN OUT VLAN_CONFIG_PRIVATE_DATA    *PrivateData\r
   )\r
 {\r
-  //\r
-  // Free MAC string\r
-  //\r
-  if (PrivateData->MacString != NULL) {\r
-    FreePool (PrivateData->MacString);\r
-    PrivateData->MacString = NULL;\r
-  }\r
-\r
-  //\r
-  // Uninstall HII package list\r
-  //\r
-  if (PrivateData->HiiHandle != NULL) {\r
-    HiiRemovePackages (PrivateData->HiiHandle);\r
-    PrivateData->HiiHandle = NULL;\r
-  }\r
-\r
+  EFI_STATUS                   Status;\r
+  EFI_VLAN_CONFIG_PROTOCOL     *VlanConfig;\r
+  \r
   //\r
   // End the parent-child relationship.\r
   //\r
   //\r
   // End the parent-child relationship.\r
   //\r
-  gBS->CloseProtocol (\r
-         PrivateData->ControllerHandle,\r
-         &gEfiVlanConfigProtocolGuid,\r
-         PrivateData->ImageHandle,\r
-         PrivateData->DriverHandle\r
-         );\r
+  Status = gBS->CloseProtocol (\r
+                  PrivateData->ControllerHandle,\r
+                  &gEfiVlanConfigProtocolGuid,\r
+                  PrivateData->ImageHandle,\r
+                  PrivateData->DriverHandle\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
 \r
   //\r
   // Uninstall HII Config Access Protocol\r
   //\r
   if (PrivateData->DriverHandle != NULL) {\r
 \r
   //\r
   // Uninstall HII Config Access Protocol\r
   //\r
   if (PrivateData->DriverHandle != NULL) {\r
-    gBS->UninstallMultipleProtocolInterfaces (\r
-           PrivateData->DriverHandle,\r
-           &gEfiDevicePathProtocolGuid,\r
-           PrivateData->ChildDevicePath,\r
-           &gEfiHiiConfigAccessProtocolGuid,\r
-           &PrivateData->ConfigAccess,\r
-           NULL\r
-           );\r
+    Status = gBS->UninstallMultipleProtocolInterfaces (\r
+                    PrivateData->DriverHandle,\r
+                    &gEfiDevicePathProtocolGuid,\r
+                    PrivateData->ChildDevicePath,\r
+                    &gEfiHiiConfigAccessProtocolGuid,\r
+                    &PrivateData->ConfigAccess,\r
+                    NULL\r
+                    );\r
+    if (EFI_ERROR (Status)) {\r
+      gBS->OpenProtocol (\r
+             PrivateData->ControllerHandle,\r
+             &gEfiVlanConfigProtocolGuid,\r
+             (VOID **)&VlanConfig,\r
+             PrivateData->ImageHandle,\r
+             PrivateData->DriverHandle,\r
+             EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER\r
+             );\r
+      return Status;\r
+    }\r
     PrivateData->DriverHandle = NULL;\r
 \r
     if (PrivateData->ChildDevicePath != NULL) {\r
     PrivateData->DriverHandle = NULL;\r
 \r
     if (PrivateData->ChildDevicePath != NULL) {\r
@@ -639,4 +643,21 @@ UninstallVlanConfigForm (
       PrivateData->ChildDevicePath = NULL;\r
     }\r
   }\r
       PrivateData->ChildDevicePath = NULL;\r
     }\r
   }\r
+\r
+  //\r
+  // Free MAC string\r
+  //\r
+  if (PrivateData->MacString != NULL) {\r
+    FreePool (PrivateData->MacString);\r
+    PrivateData->MacString = NULL;\r
+  }\r
+\r
+  //\r
+  // Uninstall HII package list\r
+  //\r
+  if (PrivateData->HiiHandle != NULL) {\r
+    HiiRemovePackages (PrivateData->HiiHandle);\r
+    PrivateData->HiiHandle = NULL;\r
+  }\r
+  return EFI_SUCCESS;\r
 }\r
 }\r
index a1c0b2a35d09f89a91c13effa633ada18b17a626..2aa43b4230feacaafd62c1266b160d8082a34b83 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Header file for driver binding protocol and HII config access protocol.\r
 \r
 /** @file\r
   Header file for driver binding protocol and HII config access protocol.\r
 \r
-Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions\r
 of the BSD License which accompanies this distribution.  The full\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions\r
 of the BSD License which accompanies this distribution.  The full\r
@@ -282,8 +282,11 @@ InstallVlanConfigForm (
 \r
   @param[in, out]  PrivateData   Points to VLAN configuration private data.\r
 \r
 \r
   @param[in, out]  PrivateData   Points to VLAN configuration private data.\r
 \r
+  @retval EFI_SUCCESS            HII Form has been uninstalled successfully.\r
+  @retval Others                 Other errors as indicated.\r
+\r
 **/\r
 **/\r
-VOID\r
+EFI_STATUS\r
 UninstallVlanConfigForm (\r
   IN OUT VLAN_CONFIG_PRIVATE_DATA    *PrivateData\r
   );\r
 UninstallVlanConfigForm (\r
   IN OUT VLAN_CONFIG_PRIVATE_DATA    *PrivateData\r
   );\r