DPDK patches and discussions
 help / color / mirror / Atom feed
From: Konstantin Ananyev <konstantin.ananyev@intel.com>
To: dev@dpdk.org
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCHv2 1/4] e1000: do not release queue on alloc error
Date: Mon,  9 Jun 2014 18:26:14 +0100	[thread overview]
Message-ID: <1402334777-27379-2-git-send-email-konstantin.ananyev@intel.com> (raw)
In-Reply-To: <1402334777-27379-1-git-send-email-konstantin.ananyev@intel.com>

If igb_alloc_rx_queue_mbufs() would fail to allocate an mbuf for RX queue,
it calls igb_rx_queue_release(rxq).
That causes rxq to be silently freed, without updating
dev->data->rx_queues[].
So any further reference to it will trigger the SIGSEGV.
Same thing in em PMD too.

To fix: igb_alloc_rx_queue_mbufs() should just return an error to the
caller and let upper layer to deal with the probem.
That's what ixgbe PMD is doing right now.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
 lib/librte_pmd_e1000/em_rxtx.c  | 1 -
 lib/librte_pmd_e1000/igb_rxtx.c | 1 -
 2 files changed, 2 deletions(-)

diff --git a/lib/librte_pmd_e1000/em_rxtx.c b/lib/librte_pmd_e1000/em_rxtx.c
index 4f98a3f..5ed4def 100644
--- a/lib/librte_pmd_e1000/em_rxtx.c
+++ b/lib/librte_pmd_e1000/em_rxtx.c
@@ -1580,7 +1580,6 @@ em_alloc_rx_queue_mbufs(struct em_rx_queue *rxq)
 		if (mbuf == NULL) {
 			PMD_INIT_LOG(ERR, "RX mbuf alloc failed "
 				"queue_id=%hu\n", rxq->queue_id);
-			em_rx_queue_release(rxq);
 			return (-ENOMEM);
 		}
 
diff --git a/lib/librte_pmd_e1000/igb_rxtx.c b/lib/librte_pmd_e1000/igb_rxtx.c
index ae53428..e35649f 100644
--- a/lib/librte_pmd_e1000/igb_rxtx.c
+++ b/lib/librte_pmd_e1000/igb_rxtx.c
@@ -1818,7 +1818,6 @@ igb_alloc_rx_queue_mbufs(struct igb_rx_queue *rxq)
 		if (mbuf == NULL) {
 			PMD_INIT_LOG(ERR, "RX mbuf alloc failed "
 				"queue_id=%hu\n", rxq->queue_id);
-			igb_rx_queue_release(rxq);
 			return (-ENOMEM);
 		}
 		dma_addr =
-- 
1.8.3.1

  reply	other threads:[~2014-06-09 17:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-09 17:26 [dpdk-dev] [PATCHv2 0/4] fix for 2 consecutive rte_eth_dev_start() can cause a SIGSEGV Konstantin Ananyev
2014-06-09 17:26 ` Konstantin Ananyev [this message]
2014-06-09 17:26 ` [dpdk-dev] [PATCHv2 2/4] igb/ixgbe: reset queue pointers after releasing Konstantin Ananyev
2014-06-09 17:26 ` [dpdk-dev] [PATCHv2 3/4] ethdev: prevent from starting/stopping already started/stopped device Konstantin Ananyev
2014-06-09 17:26 ` [dpdk-dev] [PATCHv2 4/4] ethdev: fix compiler warning on PMD_DEBUG_TRACE formats Konstantin Ananyev
2014-06-11 10:06 ` [dpdk-dev] [PATCHv2 0/4] fix for 2 consecutive rte_eth_dev_start() can cause a SIGSEGV Thomas Monjalon

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=1402334777-27379-2-git-send-email-konstantin.ananyev@intel.com \
    --to=konstantin.ananyev@intel.com \
    --cc=dev@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).