DPDK patches and discussions
 help / color / mirror / Atom feed
From: Mauricio Vasquez B <mauricio.vasquezbernal@studenti.polito.it>
To: sergio.gonzalez.monroy@intel.com
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v2] mem: fix freeing of memzone used by ivshmem
Date: Fri, 15 Apr 2016 10:29:49 +0200	[thread overview]
Message-ID: <1460708989-1406-1-git-send-email-mauricio.vasquezbernal@studenti.polito.it> (raw)
In-Reply-To: <1460641719-15231-1-git-send-email-mauricio.vasquezbernal@studenti.polito.it>

although previous implementation returned an error when trying to release a
memzone assigned to an ivshmem device, it stills freed it.

Fixes: cd10c42eb5bc ("mem: fix ivshmem freeing")

Signed-off-by: Mauricio Vasquez B <mauricio.vasquezbernal@studenti.polito.it>
---
v2: 
solved compilation problem when ivshmem is disabled
 lib/librte_eal/common/eal_common_memzone.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/librte_eal/common/eal_common_memzone.c b/lib/librte_eal/common/eal_common_memzone.c
index 711c845..a8f804c 100644
--- a/lib/librte_eal/common/eal_common_memzone.c
+++ b/lib/librte_eal/common/eal_common_memzone.c
@@ -321,15 +321,19 @@ rte_memzone_free(const struct rte_memzone *mz)
 	idx = ((uintptr_t)mz - (uintptr_t)mcfg->memzone);
 	idx = idx / sizeof(struct rte_memzone);
 
-	addr = mcfg->memzone[idx].addr;
 #ifdef RTE_LIBRTE_IVSHMEM
 	/*
 	 * If ioremap_addr is set, it's an IVSHMEM memzone and we cannot
 	 * free it.
 	 */
-	if (mcfg->memzone[idx].ioremap_addr != 0)
-		ret = -EINVAL;
+	if (mcfg->memzone[idx].ioremap_addr != 0) {
+		rte_rwlock_write_unlock(&mcfg->mlock);
+		return -EINVAL;
+	}
 #endif
+
+	addr = mcfg->memzone[idx].addr;
+
 	if (addr == NULL)
 		ret = -EINVAL;
 	else if (mcfg->memzone_cnt == 0) {
-- 
1.9.1

  parent reply	other threads:[~2016-04-15  8:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-14 13:48 [dpdk-dev] [PATCH] " Mauricio Vasquez B
2016-04-14 14:48 ` Sergio Gonzalez Monroy
2016-04-15  8:23   ` Mauricio Vásquez
2016-04-15  8:29 ` Mauricio Vasquez B [this message]
2016-04-21 11:21   ` [dpdk-dev] [PATCH v2] " Sergio Gonzalez Monroy
2016-04-29 14:34     ` 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=1460708989-1406-1-git-send-email-mauricio.vasquezbernal@studenti.polito.it \
    --to=mauricio.vasquezbernal@studenti.polito.it \
    --cc=dev@dpdk.org \
    --cc=sergio.gonzalez.monroy@intel.com \
    /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).