DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Cc: <stable@dpdk.org>
Subject: [dpdk-dev] [PATCH] net/sfc: fix leak if EvQ DMA space allocation fails
Date: Wed, 29 Mar 2017 09:28:25 +0100	[thread overview]
Message-ID: <1490776105-28443-1-git-send-email-arybchenko@solarflare.com> (raw)

Fixes: 58294ee65afb ("net/sfc: support event queue")
Cc: stable@dpdk.org

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/sfc_ev.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/net/sfc/sfc_ev.c b/drivers/net/sfc/sfc_ev.c
index 24071b2..800b08e 100644
--- a/drivers/net/sfc/sfc_ev.c
+++ b/drivers/net/sfc/sfc_ev.c
@@ -800,10 +800,11 @@ sfc_ev_qinit(struct sfc_adapter *sa, unsigned int sw_index,
 	SFC_ASSERT(entries <= evq_info->max_entries);
 	evq_info->entries = entries;
 
+	rc = ENOMEM;
 	evq = rte_zmalloc_socket("sfc-evq", sizeof(*evq), RTE_CACHE_LINE_SIZE,
 				 socket_id);
 	if (evq == NULL)
-		return ENOMEM;
+		goto fail_evq_alloc;
 
 	evq->sa = sa;
 	evq->evq_index = sw_index;
@@ -812,13 +813,21 @@ sfc_ev_qinit(struct sfc_adapter *sa, unsigned int sw_index,
 	rc = sfc_dma_alloc(sa, "evq", sw_index, EFX_EVQ_SIZE(evq_info->entries),
 			   socket_id, &evq->mem);
 	if (rc != 0)
-		return rc;
+		goto fail_dma_alloc;
 
 	evq->init_state = SFC_EVQ_INITIALIZED;
 
 	evq_info->evq = evq;
 
 	return 0;
+
+fail_dma_alloc:
+	rte_free(evq);
+
+fail_evq_alloc:
+
+	sfc_log_init(sa, "failed %d", rc);
+	return rc;
 }
 
 void
-- 
2.9.3

             reply	other threads:[~2017-03-29  8:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-29  8:28 Andrew Rybchenko [this message]
2017-03-30 16:47 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit

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-all 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=1490776105-28443-1-git-send-email-arybchenko@solarflare.com \
    --to=arybchenko@solarflare.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    /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;
as well as URLs for NNTP newsgroup(s).