public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch 0/5] Refine PXE driver code logic
@ 2018-01-02  5:27 Fu Siyuan
  2018-01-02  5:27 ` [Patch 1/5] NetworkPkg: Abort the PXE process if DHCP has been started by other instance Fu Siyuan
                   ` (7 more replies)
  0 siblings, 8 replies; 12+ messages in thread
From: Fu Siyuan @ 2018-01-02  5:27 UTC (permalink / raw)
  To: edk2-devel

See each patch file for details.

Fu Siyuan (5):
  NetworkPkg: Abort the PXE process if DHCP has been started by other
    instance.
  NetworkPkg: Check allocated buffer pointer before use.
  NetworkPkg: Fix memory leak problem in PXE driver.
  NetworkPkg: Add assert for buffer pointer from DHCP driver.
  NetworkPkg: Update PXE driver to check for NULL pointer before use it.

 NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c  | 13 ++++++-------
 NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c  | 32 +++++++++++++++++++++++++-------
 NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c |  5 ++++-
 NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c   | 20 ++++++++------------
 4 files changed, 43 insertions(+), 27 deletions(-)

-- 
2.13.0.windows.1



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Patch 1/5] NetworkPkg: Abort the PXE process if DHCP has been started by other instance.
  2018-01-02  5:27 [Patch 0/5] Refine PXE driver code logic Fu Siyuan
@ 2018-01-02  5:27 ` Fu Siyuan
  2018-01-02  5:27 ` [Patch 2/5] NetworkPkg: Check allocated buffer pointer before use Fu Siyuan
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Fu Siyuan @ 2018-01-02  5:27 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ye Ting, Wu Jiaxin, Wang Fan

PXE need to use extended DHCP options and check received offers in callback
function, so there is no need to continue the PXE process if DHCP driver has
been started by other instance but not PXE driver itself.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Wang Fan <fan.wang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
---
 NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c b/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c
index 101c65824a..9c33835759 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c
@@ -1,7 +1,7 @@
 /** @file
   Functions implementation related with DHCPv4 for UefiPxeBc Driver.
 
-  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2018, 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
@@ -1697,13 +1697,8 @@ PxeBcDhcp4Dora (
   ZeroMem (Private->OfferCount, sizeof (Private->OfferCount));
   ZeroMem (Private->OfferIndex, sizeof (Private->OfferIndex));
 
-  //
-  // Start DHCPv4 D.O.R.A. process to acquire IPv4 address. This may 
-  // have already been done, thus do not leave in error if the return
-  // code is EFI_ALREADY_STARTED.
-  //
   Status = Dhcp4->Start (Dhcp4, NULL);
-  if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
+  if (EFI_ERROR (Status)) {
     if (Status == EFI_ICMP_ERROR) {
       PxeMode->IcmpErrorReceived = TRUE;
     }
-- 
2.13.0.windows.1



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [Patch 2/5] NetworkPkg: Check allocated buffer pointer before use.
  2018-01-02  5:27 [Patch 0/5] Refine PXE driver code logic Fu Siyuan
  2018-01-02  5:27 ` [Patch 1/5] NetworkPkg: Abort the PXE process if DHCP has been started by other instance Fu Siyuan
@ 2018-01-02  5:27 ` Fu Siyuan
  2018-01-02  6:26   ` Gary Lin
  2018-01-02  5:27 ` [Patch 3/5] NetworkPkg: Fix memory leak problem in PXE driver Fu Siyuan
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 12+ messages in thread
From: Fu Siyuan @ 2018-01-02  5:27 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ye Ting, Wu Jiaxin, Wang Fan

Cc: Ye Ting <ting.ye@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Wang Fan <fan.wang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
---
 NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c b/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c
index f2239fd8c0..327b4cf1cf 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c
@@ -2,7 +2,7 @@
   Functions implementation related with DHCPv6 for UefiPxeBc Driver.
 
   (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>
-  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2009 - 2018, 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
@@ -2030,6 +2030,9 @@ PxeBcDhcp6CallBack (
       SelectAd   = &Private->OfferBuffer[Private->SelectIndex - 1].Dhcp6.Packet.Offer;
       *NewPacket = AllocateZeroPool (SelectAd->Size);
       ASSERT (*NewPacket != NULL);
+      if (*NewPacket == NULL) {
+        return EFI_ABORTED;
+      }
       CopyMem (*NewPacket, SelectAd, SelectAd->Size);
     }
     break;
-- 
2.13.0.windows.1



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [Patch 3/5] NetworkPkg: Fix memory leak problem in PXE driver.
  2018-01-02  5:27 [Patch 0/5] Refine PXE driver code logic Fu Siyuan
  2018-01-02  5:27 ` [Patch 1/5] NetworkPkg: Abort the PXE process if DHCP has been started by other instance Fu Siyuan
  2018-01-02  5:27 ` [Patch 2/5] NetworkPkg: Check allocated buffer pointer before use Fu Siyuan
@ 2018-01-02  5:27 ` Fu Siyuan
  2018-01-02  5:27 ` [Patch 4/5] NetworkPkg: Add assert for buffer pointer from DHCP driver Fu Siyuan
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Fu Siyuan @ 2018-01-02  5:27 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ye Ting, Wu Jiaxin, Wang Fan

Cc: Ye Ting <ting.ye@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Wang Fan <fan.wang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
---
 NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c  | 27 +++++++++++++++++++++------
 NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c |  5 ++++-
 2 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c b/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c
index 327b4cf1cf..7c2baa8eac 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c
@@ -548,6 +548,7 @@ PxeBcExtractBootFileUrl (
     if (ModeStr != NULL && *(ModeStr + AsciiStrLen (";mode=octet")) == '\0') {
       *ModeStr = '\0';
     } else if (AsciiStrStr (BootFileNamePtr, ";mode=") != NULL) {
+      FreePool (TmpStr);
       return EFI_INVALID_PARAMETER;
     }
 
@@ -1005,7 +1006,7 @@ PxeBcRequestBootService (
                     );
 
   if (EFI_ERROR (Status)) {
-    return Status;
+    goto ON_ERROR;
   }
 
   //
@@ -1020,7 +1021,7 @@ PxeBcRequestBootService (
   //
   Status = Private->Udp6Read->Configure (Private->Udp6Read, &Private->Udp6CfgData);
   if (EFI_ERROR (Status)) {
-    return Status;
+    goto ON_ERROR;
   }
     
   Status = PxeBc->UdpRead (
@@ -1041,7 +1042,7 @@ PxeBcRequestBootService (
   Private->Udp6Read->Configure (Private->Udp6Read, NULL);
 
   if (EFI_ERROR (Status)) {
-    return Status;
+    goto ON_ERROR;
   }
 
   //
@@ -1050,6 +1051,13 @@ PxeBcRequestBootService (
   Reply->Length = (UINT32) ReadSize;
 
   return EFI_SUCCESS;
+  
+ON_ERROR:
+  if (Discover != NULL) {
+    FreePool (Discover);
+  }
+
+  return Status;
 }
 
 
@@ -2158,7 +2166,7 @@ PxeBcDhcp6Discover (
                     (VOID *) Discover
                     );
   if (EFI_ERROR (Status)) {
-    return Status;
+    goto ON_ERROR;
   }
 
   //
@@ -2178,7 +2186,7 @@ PxeBcDhcp6Discover (
   //
   Status = Private->Udp6Read->Configure (Private->Udp6Read, &Private->Udp6CfgData);
   if (EFI_ERROR (Status)) {
-    return Status;
+    goto ON_ERROR;
   }
   
   Status = PxeBc->UdpRead (
@@ -2198,10 +2206,17 @@ PxeBcDhcp6Discover (
   //
   Private->Udp6Read->Configure (Private->Udp6Read, NULL);
   if (EFI_ERROR (Status)) {
-    return Status;
+    goto ON_ERROR;
   }
 
   return EFI_SUCCESS;
+
+ON_ERROR:
+  if (Discover != NULL) {
+    FreePool (Discover);
+  }
+
+  return Status;
 }
 
 
diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c b/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
index 09c5753ad9..8dd787be1a 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c
@@ -2,7 +2,7 @@
   Driver Binding functions implementationfor for UefiPxeBc Driver.
 
   (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>
-  Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2007 - 2018, 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
@@ -254,6 +254,7 @@ PxeBcDestroyIp4Children (
            &Private->PxeBc,
            NULL
            );
+    FreePool (Private->Ip4Nic->DevicePath);
 
     if (Private->Snp != NULL) { 
       //
@@ -414,6 +415,8 @@ PxeBcDestroyIp6Children (
            &Private->PxeBc,
            NULL
            );
+    FreePool (Private->Ip6Nic->DevicePath);
+    
     if (Private->Snp != NULL) {
       //
       // Close SNP from the child virtual handle
-- 
2.13.0.windows.1



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [Patch 4/5] NetworkPkg: Add assert for buffer pointer from DHCP driver.
  2018-01-02  5:27 [Patch 0/5] Refine PXE driver code logic Fu Siyuan
                   ` (2 preceding siblings ...)
  2018-01-02  5:27 ` [Patch 3/5] NetworkPkg: Fix memory leak problem in PXE driver Fu Siyuan
@ 2018-01-02  5:27 ` Fu Siyuan
  2018-01-02  5:27 ` [Patch 5/5] NetworkPkg: Update PXE driver to check for NULL pointer before use it Fu Siyuan
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Fu Siyuan @ 2018-01-02  5:27 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ye Ting, Wu Jiaxin, Wang Fan

The PxeBcDhcp4CallBack() is provided for DHCP driver to invoke packet check
during DHCP process, the DHCP driver should make sure Packet and NewPacket
has meaningful value. This patch adds assert for this.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Wang Fan <fan.wang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
---
 NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c b/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c
index 9c33835759..b2c03eb269 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c
@@ -1210,6 +1210,8 @@ PxeBcDhcp4CallBack (
     return EFI_SUCCESS;
   }
 
+  ASSERT (Packet != NULL);
+
   Private   = (PXEBC_PRIVATE_DATA *) Context;
   Mode      = Private->PxeBc.Mode;
   Callback  = Private->PxeBcCallback;
@@ -1305,6 +1307,8 @@ PxeBcDhcp4CallBack (
     break;
 
   case Dhcp4SelectOffer:
+    ASSERT (NewPacket != NULL);
+    
     //
     // Select offer by the default policy or by order, and record the SelectIndex
     // and SelectProxyType.
-- 
2.13.0.windows.1



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [Patch 5/5] NetworkPkg: Update PXE driver to check for NULL pointer before use it.
  2018-01-02  5:27 [Patch 0/5] Refine PXE driver code logic Fu Siyuan
                   ` (3 preceding siblings ...)
  2018-01-02  5:27 ` [Patch 4/5] NetworkPkg: Add assert for buffer pointer from DHCP driver Fu Siyuan
@ 2018-01-02  5:27 ` Fu Siyuan
  2018-01-02  5:43   ` Subramanian, Sriram
  2018-01-02  5:45 ` [Patch 0/5] Refine PXE driver code logic Subramanian, Sriram
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 12+ messages in thread
From: Fu Siyuan @ 2018-01-02  5:27 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ye Ting, Wu Jiaxin, Wang Fan

This patch is to fix the issue that dereferencing of "This" (EFI_LOAD_FILE_PROTOCOL)
in EfiPxeLoadFile() is happening before the NULL check.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Wang Fan <fan.wang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
---
 NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
index dc77d256f8..93f3bfa5ba 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
@@ -1,7 +1,7 @@
 /** @file
   This implementation of EFI_PXE_BASE_CODE_PROTOCOL and EFI_LOAD_FILE_PROTOCOL.
 
-  Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2007 - 2018, 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
@@ -2349,26 +2349,22 @@ EfiPxeLoadFile (
   EFI_STATUS                  Status;
   EFI_STATUS                  MediaStatus;
 
-  if (FilePath == NULL || !IsDevicePathEnd (FilePath)) {
+  if (This == NULL || BufferSize == NULL || FilePath == NULL || !IsDevicePathEnd (FilePath)) {
     return EFI_INVALID_PARAMETER;
   }
   
-  VirtualNic = PXEBC_VIRTUAL_NIC_FROM_LOADFILE (This);
-  Private    = VirtualNic->Private;
-  PxeBc      = &Private->PxeBc;
-  UsingIpv6  = FALSE;
-  Status     = EFI_DEVICE_ERROR;
-
-  if (This == NULL || BufferSize == NULL) {
-    return EFI_INVALID_PARAMETER;
-  }
-
   //
   // Only support BootPolicy
   //
   if (!BootPolicy) {
     return EFI_UNSUPPORTED;
   }
+  
+  VirtualNic = PXEBC_VIRTUAL_NIC_FROM_LOADFILE (This);
+  Private    = VirtualNic->Private;
+  PxeBc      = &Private->PxeBc;
+  UsingIpv6  = FALSE;
+  Status     = EFI_DEVICE_ERROR;
 
   //
   // Check media status before PXE start
-- 
2.13.0.windows.1



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [Patch 5/5] NetworkPkg: Update PXE driver to check for NULL pointer before use it.
  2018-01-02  5:27 ` [Patch 5/5] NetworkPkg: Update PXE driver to check for NULL pointer before use it Fu Siyuan
@ 2018-01-02  5:43   ` Subramanian, Sriram
  0 siblings, 0 replies; 12+ messages in thread
From: Subramanian, Sriram @ 2018-01-02  5:43 UTC (permalink / raw)
  To: Fu Siyuan, edk2-devel@lists.01.org; +Cc: Ye Ting, Wang Fan, Wu Jiaxin

Reviewed-by: Sriram Subramanian <sriram-s@hpe.com>

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Fu Siyuan
Sent: Tuesday, January 2, 2018 10:58 AM
To: edk2-devel@lists.01.org
Cc: Ye Ting <ting.ye@intel.com>; Wang Fan <fan.wang@intel.com>; Wu Jiaxin <jiaxin.wu@intel.com>
Subject: [edk2] [Patch 5/5] NetworkPkg: Update PXE driver to check for NULL pointer before use it.

This patch is to fix the issue that dereferencing of "This" (EFI_LOAD_FILE_PROTOCOL)
in EfiPxeLoadFile() is happening before the NULL check.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Wang Fan <fan.wang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
---
 NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
index dc77d256f8..93f3bfa5ba 100644
--- a/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
+++ b/NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c
@@ -1,7 +1,7 @@
 /** @file
   This implementation of EFI_PXE_BASE_CODE_PROTOCOL and EFI_LOAD_FILE_PROTOCOL.
 
-  Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2007 - 2018, 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
@@ -2349,26 +2349,22 @@ EfiPxeLoadFile (
   EFI_STATUS                  Status;
   EFI_STATUS                  MediaStatus;
 
-  if (FilePath == NULL || !IsDevicePathEnd (FilePath)) {
+  if (This == NULL || BufferSize == NULL || FilePath == NULL || !IsDevicePathEnd (FilePath)) {
     return EFI_INVALID_PARAMETER;
   }
   
-  VirtualNic = PXEBC_VIRTUAL_NIC_FROM_LOADFILE (This);
-  Private    = VirtualNic->Private;
-  PxeBc      = &Private->PxeBc;
-  UsingIpv6  = FALSE;
-  Status     = EFI_DEVICE_ERROR;
-
-  if (This == NULL || BufferSize == NULL) {
-    return EFI_INVALID_PARAMETER;
-  }
-
   //
   // Only support BootPolicy
   //
   if (!BootPolicy) {
     return EFI_UNSUPPORTED;
   }
+  
+  VirtualNic = PXEBC_VIRTUAL_NIC_FROM_LOADFILE (This);
+  Private    = VirtualNic->Private;
+  PxeBc      = &Private->PxeBc;
+  UsingIpv6  = FALSE;
+  Status     = EFI_DEVICE_ERROR;
 
   //
   // Check media status before PXE start
-- 
2.13.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [Patch 0/5] Refine PXE driver code logic
  2018-01-02  5:27 [Patch 0/5] Refine PXE driver code logic Fu Siyuan
                   ` (4 preceding siblings ...)
  2018-01-02  5:27 ` [Patch 5/5] NetworkPkg: Update PXE driver to check for NULL pointer before use it Fu Siyuan
@ 2018-01-02  5:45 ` Subramanian, Sriram
  2018-01-02  5:50 ` Subramanian, Sriram
  2018-01-02  6:59 ` Wu, Jiaxin
  7 siblings, 0 replies; 12+ messages in thread
From: Subramanian, Sriram @ 2018-01-02  5:45 UTC (permalink / raw)
  To: Fu Siyuan, edk2-devel@lists.01.org

Patch Series Reviewed-by: Sriram Subramanian <sriram-s@hpe.com>

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Fu Siyuan
Sent: Tuesday, January 2, 2018 10:58 AM
To: edk2-devel@lists.01.org
Subject: [edk2] [Patch 0/5] Refine PXE driver code logic

See each patch file for details.

Fu Siyuan (5):
  NetworkPkg: Abort the PXE process if DHCP has been started by other
    instance.
  NetworkPkg: Check allocated buffer pointer before use.
  NetworkPkg: Fix memory leak problem in PXE driver.
  NetworkPkg: Add assert for buffer pointer from DHCP driver.
  NetworkPkg: Update PXE driver to check for NULL pointer before use it.

 NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c  | 13 ++++++-------
 NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c  | 32 +++++++++++++++++++++++++-------
 NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c |  5 ++++-
 NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c   | 20 ++++++++------------
 4 files changed, 43 insertions(+), 27 deletions(-)

-- 
2.13.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Patch 0/5] Refine PXE driver code logic
  2018-01-02  5:27 [Patch 0/5] Refine PXE driver code logic Fu Siyuan
                   ` (5 preceding siblings ...)
  2018-01-02  5:45 ` [Patch 0/5] Refine PXE driver code logic Subramanian, Sriram
@ 2018-01-02  5:50 ` Subramanian, Sriram
  2018-01-04  1:02   ` Fu, Siyuan
  2018-01-02  6:59 ` Wu, Jiaxin
  7 siblings, 1 reply; 12+ messages in thread
From: Subramanian, Sriram @ 2018-01-02  5:50 UTC (permalink / raw)
  To: Fu Siyuan, edk2-devel@lists.01.org

Hi Siyuan,

Some of these problems also exist in the MdeModulePkg/Universal/Network/UefiPxeBcDxe/. Is there a plan to fix them there as well, or will the MdeModulePkg copy of the drivers be removed sometime in the near future?

Thanks,
Sriram.

-----Original Message-----
From: Subramanian, Sriram 
Sent: Tuesday, January 2, 2018 11:15 AM
To: 'Fu Siyuan' <siyuan.fu@intel.com>; edk2-devel@lists.01.org
Subject: RE: [edk2] [Patch 0/5] Refine PXE driver code logic

Patch Series Reviewed-by: Sriram Subramanian <sriram-s@hpe.com>

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Fu Siyuan
Sent: Tuesday, January 2, 2018 10:58 AM
To: edk2-devel@lists.01.org
Subject: [edk2] [Patch 0/5] Refine PXE driver code logic

See each patch file for details.

Fu Siyuan (5):
  NetworkPkg: Abort the PXE process if DHCP has been started by other
    instance.
  NetworkPkg: Check allocated buffer pointer before use.
  NetworkPkg: Fix memory leak problem in PXE driver.
  NetworkPkg: Add assert for buffer pointer from DHCP driver.
  NetworkPkg: Update PXE driver to check for NULL pointer before use it.

 NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c  | 13 ++++++-------
 NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c  | 32 +++++++++++++++++++++++++-------
 NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c |  5 ++++-
 NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c   | 20 ++++++++------------
 4 files changed, 43 insertions(+), 27 deletions(-)

-- 
2.13.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Patch 2/5] NetworkPkg: Check allocated buffer pointer before use.
  2018-01-02  5:27 ` [Patch 2/5] NetworkPkg: Check allocated buffer pointer before use Fu Siyuan
@ 2018-01-02  6:26   ` Gary Lin
  0 siblings, 0 replies; 12+ messages in thread
From: Gary Lin @ 2018-01-02  6:26 UTC (permalink / raw)
  To: Fu Siyuan; +Cc: edk2-devel, Ye Ting, Wang Fan, Wu Jiaxin

On Tue, Jan 02, 2018 at 01:27:41PM +0800, Fu Siyuan wrote:
> Cc: Ye Ting <ting.ye@intel.com>
> Cc: Wu Jiaxin <jiaxin.wu@intel.com>
> Cc: Wang Fan <fan.wang@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
> ---
>  NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c b/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c
> index f2239fd8c0..327b4cf1cf 100644
> --- a/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c
> +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c
> @@ -2,7 +2,7 @@
>    Functions implementation related with DHCPv6 for UefiPxeBc Driver.
>  
>    (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>
> -  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2009 - 2018, 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
> @@ -2030,6 +2030,9 @@ PxeBcDhcp6CallBack (
>        SelectAd   = &Private->OfferBuffer[Private->SelectIndex - 1].Dhcp6.Packet.Offer;
>        *NewPacket = AllocateZeroPool (SelectAd->Size);
>        ASSERT (*NewPacket != NULL);
I guess this ASSERT can be removed since *NewPacket is checked later.

Gary Lin

> +      if (*NewPacket == NULL) {
> +        return EFI_ABORTED;
> +      }
>        CopyMem (*NewPacket, SelectAd, SelectAd->Size);
>      }
>      break;
> -- 
> 2.13.0.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
> 


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Patch 0/5] Refine PXE driver code logic
  2018-01-02  5:27 [Patch 0/5] Refine PXE driver code logic Fu Siyuan
                   ` (6 preceding siblings ...)
  2018-01-02  5:50 ` Subramanian, Sriram
@ 2018-01-02  6:59 ` Wu, Jiaxin
  7 siblings, 0 replies; 12+ messages in thread
From: Wu, Jiaxin @ 2018-01-02  6:59 UTC (permalink / raw)
  To: Fu, Siyuan, edk2-devel@lists.01.org

Series Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>



> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Fu
> Siyuan
> Sent: Tuesday, January 2, 2018 1:28 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [Patch 0/5] Refine PXE driver code logic
> 
> See each patch file for details.
> 
> Fu Siyuan (5):
>   NetworkPkg: Abort the PXE process if DHCP has been started by other
>     instance.
>   NetworkPkg: Check allocated buffer pointer before use.
>   NetworkPkg: Fix memory leak problem in PXE driver.
>   NetworkPkg: Add assert for buffer pointer from DHCP driver.
>   NetworkPkg: Update PXE driver to check for NULL pointer before use it.
> 
>  NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c  | 13 ++++++-------
>  NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c  | 32
> +++++++++++++++++++++++++-------
>  NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c |  5 ++++-
>  NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c   | 20 ++++++++------------
>  4 files changed, 43 insertions(+), 27 deletions(-)
> 
> --
> 2.13.0.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Patch 0/5] Refine PXE driver code logic
  2018-01-02  5:50 ` Subramanian, Sriram
@ 2018-01-04  1:02   ` Fu, Siyuan
  0 siblings, 0 replies; 12+ messages in thread
From: Fu, Siyuan @ 2018-01-04  1:02 UTC (permalink / raw)
  To: Subramanian, Sriram, edk2-devel@lists.01.org

Hi, Sriram

So far as I know we don't have plan to remove the MdeModulePkg copy, but we are taking priority to fix the NetworkPkg ones for these duplicate drivers. 

BestRegards
Fu Siyuan

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Subramanian, Sriram
> Sent: Tuesday, January 2, 2018 1:51 PM
> To: Fu, Siyuan <siyuan.fu@intel.com>; edk2-devel@lists.01.org
> Subject: Re: [edk2] [Patch 0/5] Refine PXE driver code logic
> 
> Hi Siyuan,
> 
> Some of these problems also exist in the
> MdeModulePkg/Universal/Network/UefiPxeBcDxe/. Is there a plan to fix them
> there as well, or will the MdeModulePkg copy of the drivers be removed
> sometime in the near future?
> 
> Thanks,
> Sriram.
> 
> -----Original Message-----
> From: Subramanian, Sriram
> Sent: Tuesday, January 2, 2018 11:15 AM
> To: 'Fu Siyuan' <siyuan.fu@intel.com>; edk2-devel@lists.01.org
> Subject: RE: [edk2] [Patch 0/5] Refine PXE driver code logic
> 
> Patch Series Reviewed-by: Sriram Subramanian <sriram-s@hpe.com>
> 
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Fu
> Siyuan
> Sent: Tuesday, January 2, 2018 10:58 AM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [Patch 0/5] Refine PXE driver code logic
> 
> See each patch file for details.
> 
> Fu Siyuan (5):
>   NetworkPkg: Abort the PXE process if DHCP has been started by other
>     instance.
>   NetworkPkg: Check allocated buffer pointer before use.
>   NetworkPkg: Fix memory leak problem in PXE driver.
>   NetworkPkg: Add assert for buffer pointer from DHCP driver.
>   NetworkPkg: Update PXE driver to check for NULL pointer before use it.
> 
>  NetworkPkg/UefiPxeBcDxe/PxeBcDhcp4.c  | 13 ++++++-------
>  NetworkPkg/UefiPxeBcDxe/PxeBcDhcp6.c  | 32 +++++++++++++++++++++++++-----
> --
>  NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c |  5 ++++-
>  NetworkPkg/UefiPxeBcDxe/PxeBcImpl.c   | 20 ++++++++------------
>  4 files changed, 43 insertions(+), 27 deletions(-)
> 
> --
> 2.13.0.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-01-04  0:58 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-02  5:27 [Patch 0/5] Refine PXE driver code logic Fu Siyuan
2018-01-02  5:27 ` [Patch 1/5] NetworkPkg: Abort the PXE process if DHCP has been started by other instance Fu Siyuan
2018-01-02  5:27 ` [Patch 2/5] NetworkPkg: Check allocated buffer pointer before use Fu Siyuan
2018-01-02  6:26   ` Gary Lin
2018-01-02  5:27 ` [Patch 3/5] NetworkPkg: Fix memory leak problem in PXE driver Fu Siyuan
2018-01-02  5:27 ` [Patch 4/5] NetworkPkg: Add assert for buffer pointer from DHCP driver Fu Siyuan
2018-01-02  5:27 ` [Patch 5/5] NetworkPkg: Update PXE driver to check for NULL pointer before use it Fu Siyuan
2018-01-02  5:43   ` Subramanian, Sriram
2018-01-02  5:45 ` [Patch 0/5] Refine PXE driver code logic Subramanian, Sriram
2018-01-02  5:50 ` Subramanian, Sriram
2018-01-04  1:02   ` Fu, Siyuan
2018-01-02  6:59 ` Wu, Jiaxin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox