public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch 0/2] Fix some issues in HttpBootDxe driver.
@ 2017-12-21  6:50 Jiaxin Wu
  2017-12-21  6:50 ` [Patch 1/2] NetworkPkg/HttpBootDxe: Avoid the potential memory leak when eror happen Jiaxin Wu
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jiaxin Wu @ 2017-12-21  6:50 UTC (permalink / raw)
  To: edk2-devel; +Cc: Wang Fan, Ye Ting, Fu Siyuan, Wu Jiaxin

Cc: Wang Fan <fan.wang@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>

Jiaxin Wu (2):
  NetworkPkg/HttpBootDxe: Avoid the potential memory leak when eror
    happen.
  NetworkPkg/HttpBootDxe: Break the HttpBoot Callback function when meet
    redirect status.

 NetworkPkg/HttpBootDxe/HttpBootDhcp4.c | 3 +++
 NetworkPkg/HttpBootDxe/HttpBootImpl.c  | 7 ++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

-- 
1.9.5.msysgit.1



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

* [Patch 1/2] NetworkPkg/HttpBootDxe: Avoid the potential memory leak when eror happen.
  2017-12-21  6:50 [Patch 0/2] Fix some issues in HttpBootDxe driver Jiaxin Wu
@ 2017-12-21  6:50 ` Jiaxin Wu
  2017-12-21  6:50 ` [Patch 2/2] NetworkPkg/HttpBootDxe: Break the HttpBoot Callback function when meet redirect status Jiaxin Wu
  2017-12-22  7:39 ` [Patch 0/2] Fix some issues in HttpBootDxe driver Wang, Fan
  2 siblings, 0 replies; 4+ messages in thread
From: Jiaxin Wu @ 2017-12-21  6:50 UTC (permalink / raw)
  To: edk2-devel; +Cc: Wang Fan, Ye Ting, Fu Siyuan, Wu Jiaxin

Cc: Wang Fan <fan.wang@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
---
 NetworkPkg/HttpBootDxe/HttpBootDhcp4.c | 3 +++
 NetworkPkg/HttpBootDxe/HttpBootImpl.c  | 6 +++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootDhcp4.c b/NetworkPkg/HttpBootDxe/HttpBootDhcp4.c
index a8cee04..421ce6e 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootDhcp4.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootDhcp4.c
@@ -420,10 +420,13 @@ HttpBootParseDhcp4Packet (
 
   } else {
     if (!IsProxyOffer) {
       OfferType = IsDnsOffer ? HttpOfferTypeDhcpDns : HttpOfferTypeDhcpOnly;
     } else {
+      if (Cache4->UriParser != NULL) {
+        FreePool (Cache4->UriParser);
+      }
       return EFI_DEVICE_ERROR;
     }
   }
   
   Cache4->OfferType = OfferType;
diff --git a/NetworkPkg/HttpBootDxe/HttpBootImpl.c b/NetworkPkg/HttpBootDxe/HttpBootImpl.c
index 7f0616d..d4b46a6 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootImpl.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootImpl.c
@@ -120,12 +120,13 @@ HttpBootStart (
   )
 {
   UINTN                Index;
   EFI_STATUS           Status;
   CHAR8                *Uri;
-  
 
+  Uri = NULL;
+  
   if (Private == NULL || FilePath == NULL) {
     return EFI_INVALID_PARAMETER;
   }
   
   //
@@ -152,10 +153,13 @@ HttpBootStart (
       //
       // Restart is required, first stop then continue this start function.
       //
       Status = HttpBootStop (Private);
       if (EFI_ERROR (Status)) {
+        if (Uri != NULL) {
+          FreePool (Uri);
+        }
         return Status;
       }
     } else {
       //
       // Restart is not required.
-- 
1.9.5.msysgit.1



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

* [Patch 2/2] NetworkPkg/HttpBootDxe: Break the HttpBoot Callback function when meet redirect status.
  2017-12-21  6:50 [Patch 0/2] Fix some issues in HttpBootDxe driver Jiaxin Wu
  2017-12-21  6:50 ` [Patch 1/2] NetworkPkg/HttpBootDxe: Avoid the potential memory leak when eror happen Jiaxin Wu
@ 2017-12-21  6:50 ` Jiaxin Wu
  2017-12-22  7:39 ` [Patch 0/2] Fix some issues in HttpBootDxe driver Wang, Fan
  2 siblings, 0 replies; 4+ messages in thread
From: Jiaxin Wu @ 2017-12-21  6:50 UTC (permalink / raw)
  To: edk2-devel; +Cc: Wang Fan, Ye Ting, Fu Siyuan, Wu Jiaxin

In HttpBootCallback(), when data type is HttpBootHttpResponse, function may meet
the resource redirect error. In current implementation, function will still go
ahead to find header for HTTP_HEADER_CONTENT_LENGTH, this is not expected. Function
should break in redirect status error handling.

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

diff --git a/NetworkPkg/HttpBootDxe/HttpBootImpl.c b/NetworkPkg/HttpBootDxe/HttpBootImpl.c
index d4b46a6..16c1207 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootImpl.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootImpl.c
@@ -709,10 +709,11 @@ HttpBootCallback (
                  HTTP_HEADER_LOCATION
                  );
           if (HttpHeader != NULL) {
             Print (L"\n  HTTP ERROR: Resource Redirected.\n  New Location: %a\n", HttpHeader->FieldValue);
           }
+          break; 
         }
       }
       
       HttpHeader = HttpFindHeader (
                      HttpMessage->HeaderCount,
-- 
1.9.5.msysgit.1



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

* Re: [Patch 0/2] Fix some issues in HttpBootDxe driver.
  2017-12-21  6:50 [Patch 0/2] Fix some issues in HttpBootDxe driver Jiaxin Wu
  2017-12-21  6:50 ` [Patch 1/2] NetworkPkg/HttpBootDxe: Avoid the potential memory leak when eror happen Jiaxin Wu
  2017-12-21  6:50 ` [Patch 2/2] NetworkPkg/HttpBootDxe: Break the HttpBoot Callback function when meet redirect status Jiaxin Wu
@ 2017-12-22  7:39 ` Wang, Fan
  2 siblings, 0 replies; 4+ messages in thread
From: Wang, Fan @ 2017-12-22  7:39 UTC (permalink / raw)
  To: Wu, Jiaxin, edk2-devel@lists.01.org; +Cc: Ye, Ting, Fu, Siyuan

Patch series reviewed by Wang, Fan <fan.wang@intel.com>.

Best Regards
Fan

-----Original Message-----
From: Wu, Jiaxin 
Sent: Thursday, December 21, 2017 2:51 PM
To: edk2-devel@lists.01.org
Cc: Wang, Fan <fan.wang@intel.com>; Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>
Subject: [Patch 0/2] Fix some issues in HttpBootDxe driver.

Cc: Wang Fan <fan.wang@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>

Jiaxin Wu (2):
  NetworkPkg/HttpBootDxe: Avoid the potential memory leak when eror
    happen.
  NetworkPkg/HttpBootDxe: Break the HttpBoot Callback function when meet
    redirect status.

 NetworkPkg/HttpBootDxe/HttpBootDhcp4.c | 3 +++  NetworkPkg/HttpBootDxe/HttpBootImpl.c  | 7 ++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

--
1.9.5.msysgit.1



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

end of thread, other threads:[~2017-12-22  7:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-21  6:50 [Patch 0/2] Fix some issues in HttpBootDxe driver Jiaxin Wu
2017-12-21  6:50 ` [Patch 1/2] NetworkPkg/HttpBootDxe: Avoid the potential memory leak when eror happen Jiaxin Wu
2017-12-21  6:50 ` [Patch 2/2] NetworkPkg/HttpBootDxe: Break the HttpBoot Callback function when meet redirect status Jiaxin Wu
2017-12-22  7:39 ` [Patch 0/2] Fix some issues in HttpBootDxe driver Wang, Fan

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