public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Wang Fan <fan.wang@intel.com>
To: edk2-devel@lists.01.org
Cc: Jiaxin Wu <jiaxin.wu@intel.com>, Ye Ting <ting.ye@intel.com>,
	Fu Siyuan <siyuan.fu@intel.com>
Subject: [Patch 1/2] MdeModulePkg: Freed the received packet buffer if it is not expected.
Date: Wed, 10 Jan 2018 11:16:27 +0800	[thread overview]
Message-ID: <1515554188-2560-2-git-send-email-fan.wang@intel.com> (raw)
In-Reply-To: <1515554188-2560-1-git-send-email-fan.wang@intel.com>

* 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>
---
 MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c b/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c
index a06c0b6..c7bc1aa 100644
--- a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c
+++ b/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c
@@ -1037,16 +1037,26 @@ IpIoListenHandlerDpc (
     // The reception is actively aborted by the consumer, directly return.
     //
     return;
   }
 
-  if (((EFI_SUCCESS != Status) && (EFI_ICMP_ERROR != Status)) || (NULL == RxData)) {
+  if ((EFI_SUCCESS != Status) && (EFI_ICMP_ERROR != Status)) {
     //
-    // @bug Only process the normal packets and the icmp error packets, if RxData is NULL
-    // @bug with Status == EFI_SUCCESS or EFI_ICMP_ERROR, just resume the receive although
-    // @bug this should be a bug of the low layer (IP).
+    // Only process the normal packets and the icmp error packets.
     //
+    if (RxData != NULL) {
+      goto CleanUp;
+    } else {
+      goto Resume;
+    }
+  }
+
+  //
+  // if RxData is NULL with Status == EFI_SUCCESS or EFI_ICMP_ERROR, this should be a code issue in the low layer (IP).
+  //
+  ASSERT (RxData != NULL);
+  if (RxData == NULL) {
     goto Resume;
   }
 
   if (NULL == IpIo->PktRcvdNotify) {
     goto CleanUp;
-- 
1.9.5.msysgit.1



  reply	other threads:[~2018-01-10  3:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-10  3:16 [Patch 0/2] Fixed some issues in DxeIpIoLib Wang Fan
2018-01-10  3:16 ` Wang Fan [this message]
2018-01-15  5:46   ` [Patch 1/2] MdeModulePkg: Freed the received packet buffer if it is not expected Fu, Siyuan
2018-01-16  0:44   ` Wu, Jiaxin
2018-01-10  3:16 ` [Patch 2/2] MdeModulePkg: Did some code enhancement for DxeIpIpLib Wang Fan
2018-01-10  4:51   ` Ni, Ruiyu
2018-01-10  4:58     ` Wang, Fan
2018-01-15  5:48   ` Fu, Siyuan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1515554188-2560-2-git-send-email-fan.wang@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox