Hi Edk2 network developers,
Would like to bring up a potential issue here for current Mtftp6 implement when 
its comsumer, PxeBc for example, use configure() for different operations.
In case of Mtftp6->Configure (Mtftp6, Config) and Mtftp6->Configure (Mtftp6, 
NULL) been used in pair for specific Mtftp operation, it could cause dangling 
Udp6Io left in system due to we always create a new Udp6Io for Mtftp6 instance 
when ConfigData is not null but does not destroy created UdpIo when ConfigData 
is NULL.

[Function EfiMtftp6Configure]

  if (MtftpConfigData == NULL) {
    //
    // Configure the instance as NULL to abort the current session.
    //
    Mtftp6OperationClean (Instance, EFI_ABORTED); <-- Udp6Io is not really 
destroyed here and become "orphan"
    FreePool (Instance->Config);
    Instance->Config = NULL;
  } else {
    //
    // It's not allowed to configure one instance twice without configure null.
    //
    if (Instance->Config != NULL) {
      Status = EFI_ACCESS_DENIED;
      goto ON_EXIT;
    }
    //
    // Allocate the configure buffer of the instance and store the user's data.
    //
    Instance->Config = AllocateZeroPool (sizeof (EFI_MTFTP6_CONFIG_DATA));

    if (Instance->Config == NULL) {
      Status = EFI_OUT_OF_RESOURCES;
      goto ON_EXIT;
    }

    CopyMem (Instance->Config, MtftpConfigData, sizeof 
(EFI_MTFTP6_CONFIG_DATA));

    //
    // Don't configure the udpio here because each operation might override
    // the configuration, so delay udpio configuration in each operation.
    //
    Instance->UdpIo = UdpIoCreateIo (
                     Service->Controller,
                     Service->Image,
                     Mtftp6ConfigDummyUdpIo,
                     UDP_IO_UDP6_VERSION,
                     NULL
                     );  <- a new Udp6Io created for Mtftp6 instance here.
Suggest change:

if (Instance->UdpIo != NULL) {
  UdpIoFreeIo (Instance->UdpIo);
  Instance->UdpIo = NULL;
}
Instance->UdpIo = UdpIoCreateIo (
Service->Controller,
                         Service->Image,
                         Mtftp6ConfigDummyUdpIo,
                         UDP_IO_UDP6_VERSION,
                         NULL
                         );

-Mars
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://ad.doubleclick.net/clk;258768047;13503038;j?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to