<p>While debugging another issue (my UEFI firmware continuously polling the iPXE<br>
option ROM on a Mellanox ConnectX-4 Lx) I noticed that iPXE quickly runs out of<br>
memory. Tracing the code led me to ib_refill_recv. We can see that<br>
ib_refill_recv allocated an iobuf and hands it over to a driver-specific<br>
post-receive hook. However, ib_refill_recv free's the iobuf only, when the hook<br>
returns an error and none of the implementations free the iobuf on success.</p>
<p>So it seems that ib_refill_recv should unconditionally free the iobuf before<br>
processing the error code from the hook (this patch fixed the leak for me at<br>
least).</p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/ipxe/ipxe/pull/87'>https://github.com/ipxe/ipxe/pull/87</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>[infiniband] fix a memory leak in ib_refill_recv</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/ipxe/ipxe/pull/87/files#diff-0">src/net/infiniband.c</a>
    (5)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/ipxe/ipxe/pull/87.patch'>https://github.com/ipxe/ipxe/pull/87.patch</a></li>
  <li><a href='https://github.com/ipxe/ipxe/pull/87.diff'>https://github.com/ipxe/ipxe/pull/87.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/ipxe/ipxe/pull/87">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AArTVCBb0_qMd025HvY6xCpRhZ-DUs0Wks5vA0lIgaJpZM4ZzfTq">mute the thread</a>.<img src="https://github.com/notifications/beacon/AArTVCxBJt8uNt7EmvopB4KAK0mQiUTWks5vA0lIgaJpZM4ZzfTq.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/ipxe/ipxe","title":"ipxe/ipxe","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/ipxe/ipxe"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"[infiniband] fix a memory leak in ib_refill_recv (#87)"}],"action":{"name":"View Pull Request","url":"https://github.com/ipxe/ipxe/pull/87"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/ipxe/ipxe/pull/87",
"url": "https://github.com/ipxe/ipxe/pull/87",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>