MdeModulePkg: Freed the received packet buffer if it is not expected.

* 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>
This commit is contained in:
Wang Fan 2018-01-10 11:01:02 +08:00 committed by Jiaxin Wu
parent c74805f1e7
commit 0a1bd0a35d
1 changed files with 14 additions and 4 deletions

View File

@ -1039,12 +1039,22 @@ IpIoListenHandlerDpc (
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 // Only process the normal packets and the icmp error packets.
// @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).
// //
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; goto Resume;
} }