]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg: Freed the received packet buffer if it is not expected.
authorWang Fan <fan.wang@intel.com>
Wed, 10 Jan 2018 03:01:02 +0000 (11:01 +0800)
committerJiaxin Wu <jiaxin.wu@intel.com>
Tue, 16 Jan 2018 03:09:59 +0000 (11:09 +0800)
* When the packet is not normal packet or icmp error packet, the code
  does not recycle it by signal RecycleSignal event, and this will
  result some memory leak. This patch is to fix this issue.

Cc: Jiaxin Wu <jiaxin.wu@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: Wang Fan <fan.wang@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c

index a06c0b6a4752cdea4fb78e20ce6d74006275999e..c7bc1aa8d021a664fb1fd85cf645685a50891527 100644 (file)
@@ -1039,12 +1039,22 @@ IpIoListenHandlerDpc (
     return;\r
   }\r
 \r
-  if (((EFI_SUCCESS != Status) && (EFI_ICMP_ERROR != Status)) || (NULL == RxData)) {\r
+  if ((EFI_SUCCESS != Status) && (EFI_ICMP_ERROR != Status)) {\r
     //\r
-    // @bug Only process the normal packets and the icmp error packets, if RxData is NULL\r
-    // @bug with Status == EFI_SUCCESS or EFI_ICMP_ERROR, just resume the receive although\r
-    // @bug this should be a bug of the low layer (IP).\r
+    // Only process the normal packets and the icmp error packets.\r
     //\r
+    if (RxData != NULL) {\r
+      goto CleanUp;\r
+    } else {\r
+      goto Resume;\r
+    }\r
+  }\r
+\r
+  //\r
+  // if RxData is NULL with Status == EFI_SUCCESS or EFI_ICMP_ERROR, this should be a code issue in the low layer (IP).\r
+  //\r
+  ASSERT (RxData != NULL);\r
+  if (RxData == NULL) {\r
     goto Resume;\r
   }\r
 \r