Revision: 15174
          http://sourceforge.net/p/edk2/code/15174
Author:   sfu5
Date:     2014-01-24 05:33:18 +0000 (Fri, 24 Jan 2014)
Log Message:
-----------
Fix following problems about VLAN driver:
1. "VLAN Configuration?\226?\128?\157 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 <[email protected]>
Reviewed-by: Ni, Ruiyu <[email protected]>
Reviewed-by: Gao, Liming <[email protected]>

Modified Paths:
--------------
    trunk/edk2/MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDriver.c
    trunk/edk2/MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigImpl.c
    trunk/edk2/MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigImpl.h

Modified: 
trunk/edk2/MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDriver.c
===================================================================
--- trunk/edk2/MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDriver.c  
2014-01-23 08:36:37 UTC (rev 15173)
+++ trunk/edk2/MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDriver.c  
2014-01-24 05:33:18 UTC (rev 15174)
@@ -1,7 +1,7 @@
 /** @file
   The driver binding for VLAN configuration module.
 
-Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions
 of the BSD License which accompanies this distribution.  The full
@@ -275,10 +275,13 @@
   }
   ASSERT (PrivateData->Signature == VLAN_CONFIG_PRIVATE_DATA_SIGNATURE);
 
-  //
-  // Uninstall VLAN configuration Form
-  //
-  UninstallVlanConfigForm (PrivateData);
+  if (NumberOfChildren != 0) {
+    if (NumberOfChildren != 1 || ChildHandleBuffer[0] != 
PrivateData->DriverHandle) {
+      return EFI_DEVICE_ERROR;
+    }
+    
+    return UninstallVlanConfigForm (PrivateData);
+  }
 
   //
   // Uninstall the private GUID

Modified: 
trunk/edk2/MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigImpl.c
===================================================================
--- trunk/edk2/MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigImpl.c    
2014-01-23 08:36:37 UTC (rev 15173)
+++ trunk/edk2/MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigImpl.c    
2014-01-24 05:33:18 UTC (rev 15174)
@@ -1,7 +1,7 @@
 /** @file
   HII Config Access protocol implementation of VLAN configuration module.
 
-Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions
 of the BSD License which accompanies this distribution.  The full
@@ -588,13 +588,63 @@
 
   @param[in, out]  PrivateData   Points to VLAN configuration private data.
 
+  @retval EFI_SUCCESS            HII Form has been uninstalled successfully.
+  @retval Others                 Other errors as indicated.
+
 **/
-VOID
+EFI_STATUS
 UninstallVlanConfigForm (
   IN OUT VLAN_CONFIG_PRIVATE_DATA    *PrivateData
   )
 {
+  EFI_STATUS                   Status;
+  EFI_VLAN_CONFIG_PROTOCOL     *VlanConfig;
+  
   //
+  // End the parent-child relationship.
+  //
+  Status = gBS->CloseProtocol (
+                  PrivateData->ControllerHandle,
+                  &gEfiVlanConfigProtocolGuid,
+                  PrivateData->ImageHandle,
+                  PrivateData->DriverHandle
+                  );
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
+
+  //
+  // Uninstall HII Config Access Protocol
+  //
+  if (PrivateData->DriverHandle != NULL) {
+    Status = gBS->UninstallMultipleProtocolInterfaces (
+                    PrivateData->DriverHandle,
+                    &gEfiDevicePathProtocolGuid,
+                    PrivateData->ChildDevicePath,
+                    &gEfiHiiConfigAccessProtocolGuid,
+                    &PrivateData->ConfigAccess,
+                    NULL
+                    );
+    if (EFI_ERROR (Status)) {
+      gBS->OpenProtocol (
+             PrivateData->ControllerHandle,
+             &gEfiVlanConfigProtocolGuid,
+             (VOID **)&VlanConfig,
+             PrivateData->ImageHandle,
+             PrivateData->DriverHandle,
+             EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
+             );
+      return Status;
+    }
+    PrivateData->DriverHandle = NULL;
+
+    if (PrivateData->ChildDevicePath != NULL) {
+      FreePool (PrivateData->ChildDevicePath);
+      PrivateData->ChildDevicePath = NULL;
+    }
+  }
+
+  //
   // Free MAC string
   //
   if (PrivateData->MacString != NULL) {
@@ -609,34 +659,5 @@
     HiiRemovePackages (PrivateData->HiiHandle);
     PrivateData->HiiHandle = NULL;
   }
-
-  //
-  // End the parent-child relationship.
-  //
-  gBS->CloseProtocol (
-         PrivateData->ControllerHandle,
-         &gEfiVlanConfigProtocolGuid,
-         PrivateData->ImageHandle,
-         PrivateData->DriverHandle
-         );
-
-  //
-  // Uninstall HII Config Access Protocol
-  //
-  if (PrivateData->DriverHandle != NULL) {
-    gBS->UninstallMultipleProtocolInterfaces (
-           PrivateData->DriverHandle,
-           &gEfiDevicePathProtocolGuid,
-           PrivateData->ChildDevicePath,
-           &gEfiHiiConfigAccessProtocolGuid,
-           &PrivateData->ConfigAccess,
-           NULL
-           );
-    PrivateData->DriverHandle = NULL;
-
-    if (PrivateData->ChildDevicePath != NULL) {
-      FreePool (PrivateData->ChildDevicePath);
-      PrivateData->ChildDevicePath = NULL;
-    }
-  }
+  return EFI_SUCCESS;
 }

Modified: 
trunk/edk2/MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigImpl.h
===================================================================
--- trunk/edk2/MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigImpl.h    
2014-01-23 08:36:37 UTC (rev 15173)
+++ trunk/edk2/MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigImpl.h    
2014-01-24 05:33:18 UTC (rev 15174)
@@ -1,7 +1,7 @@
 /** @file
   Header file for driver binding protocol and HII config access protocol.
 
-Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions
 of the BSD License which accompanies this distribution.  The full
@@ -282,8 +282,11 @@
 
   @param[in, out]  PrivateData   Points to VLAN configuration private data.
 
+  @retval EFI_SUCCESS            HII Form has been uninstalled successfully.
+  @retval Others                 Other errors as indicated.
+
 **/
-VOID
+EFI_STATUS
 UninstallVlanConfigForm (
   IN OUT VLAN_CONFIG_PRIVATE_DATA    *PrivateData
   );

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to