Skip to content

Commit

Permalink
netkvm: fix memory leak in TX overfragmenting flow
Browse files Browse the repository at this point in the history
https://issues.redhat.com/browse/RHEL-24992
Memory leak of CNB::m_ExtraNBStorage happens if the
packet os overfragmented but we do not succeed to
allocate extra pages.

Signed-off-by: Yuri Benditovich <[email protected]>
  • Loading branch information
ybendito authored and YanVugenfirer committed Apr 11, 2024
1 parent 6eca3b8 commit 8b6f5ef
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions NetKVM/Common/ParaNdis_TX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,11 @@ CNB::~CNB()
{
NdisMFreeNetBufferSGList(m_Context->DmaHandle, m_SGL, m_NB);
}
if (m_ExtraNBStorage)
{
// for unknown case it was not freed before
ReturnPages();
}
}

void CNB::ReleaseResources()
Expand Down Expand Up @@ -1221,6 +1226,8 @@ NBMappingStatus CNB::AllocateAndFillCopySGL(ULONG ParsedHeadersLength)
RtlZeroMemory(m_ExtraNBStorage, sizeof(CExtendedNBStorage));
if (!m_ParentNBL->GetParentTXPath()->BorrowPages(m_ExtraNBStorage, Pages))
{
NdisFreeMemory(m_ExtraNBStorage, sizeof(CExtendedNBStorage), 0);
m_ExtraNBStorage = NULL;
return NBMappingStatus::NO_RESOURCE;
}

Expand Down

0 comments on commit 8b6f5ef

Please sign in to comment.