patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Yuanhan Liu <yliu@fridaylinux.org>
To: Tiwei Bie <tiwei.bie@intel.com>
Cc: Bruce Richardson <bruce.richardson@intel.com>,
	dpdk stable <stable@dpdk.org>
Subject: [dpdk-stable] patch 'contigmem: free allocated memory on error' has been queued to LTS release 16.11.3
Date: Fri, 14 Jul 2017 18:33:49 +0800	[thread overview]
Message-ID: <1500028450-25989-25-git-send-email-yliu@fridaylinux.org> (raw)
In-Reply-To: <1500028450-25989-1-git-send-email-yliu@fridaylinux.org>

Hi,

FYI, your patch has been queued to LTS release 16.11.3

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 07/19/17. So please
shout if anyone has objections.

Thanks.

	--yliu

---
>From 3e35cc5b148610735f7c0039afd4076b0c173f58 Mon Sep 17 00:00:00 2001
From: Tiwei Bie <tiwei.bie@intel.com>
Date: Sun, 4 Jun 2017 13:53:23 +0800
Subject: [PATCH] contigmem: free allocated memory on error

[ upstream commit 5f51eca22489cc85aea23210d2e61e1f56870b7c ]

Fixes: 764bf26873b9 ("add FreeBSD support")

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 lib/librte_eal/bsdapp/contigmem/contigmem.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/lib/librte_eal/bsdapp/contigmem/contigmem.c b/lib/librte_eal/bsdapp/contigmem/contigmem.c
index da971de..03e3e8d 100644
--- a/lib/librte_eal/bsdapp/contigmem/contigmem.c
+++ b/lib/librte_eal/bsdapp/contigmem/contigmem.c
@@ -123,19 +123,21 @@ static int
 contigmem_load()
 {
 	char index_string[8], description[32];
-	int  i;
+	int  i, error = 0;
 
 	if (contigmem_num_buffers > RTE_CONTIGMEM_MAX_NUM_BUFS) {
 		printf("%d buffers requested is greater than %d allowed\n",
 				contigmem_num_buffers, RTE_CONTIGMEM_MAX_NUM_BUFS);
-		return EINVAL;
+		error = EINVAL;
+		goto error;
 	}
 
 	if (contigmem_buffer_size < PAGE_SIZE ||
 			(contigmem_buffer_size & (contigmem_buffer_size - 1)) != 0) {
 		printf("buffer size 0x%lx is not greater than PAGE_SIZE and "
 				"power of two\n", contigmem_buffer_size);
-		return EINVAL;
+		error = EINVAL;
+		goto error;
 	}
 
 	for (i = 0; i < contigmem_num_buffers; i++) {
@@ -145,7 +147,8 @@ contigmem_load()
 
 		if (contigmem_buffers[i] == NULL) {
 			printf("contigmalloc failed for buffer %d\n", i);
-			return ENOMEM;
+			error = ENOMEM;
+			goto error;
 		}
 
 		printf("%2u: virt=%p phys=%p\n", i, contigmem_buffers[i],
@@ -165,6 +168,14 @@ contigmem_load()
 			GID_WHEEL, 0600, "contigmem");
 
 	return 0;
+
+error:
+	for (i = 0; i < contigmem_num_buffers; i++)
+		if (contigmem_buffers[i] != NULL)
+			contigfree(contigmem_buffers[i], contigmem_buffer_size,
+					M_CONTIGMEM);
+
+	return error;
 }
 
 static int
-- 
2.7.4

  parent reply	other threads:[~2017-07-14 10:36 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-14 10:33 [dpdk-stable] patch 'net/i40e: add return value checks' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/i40e/base: fix Tx error stats on VF' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/mlx5: fix completion buffer size' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/igb: fix add/delete of flex filters' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/cxgbe: fix port statistics' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/mlx5: fix exception handling' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/mlx5: fix redundant free of Tx buffer' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/igb: fix checksum valid flags' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/i40e: exclude internal packet's byte count' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/i40e: fix VF statistics' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/bnxt: fix reporting of link status' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'kni: fix build with gcc 7.1' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/enic: " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/mlx5: " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'vhost: fix guest pages memory leak' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/virtio: zero the whole memory zone' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'lpm: fix index of tbl8' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'ip_frag: free mbufs on reassembly table destroy' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'mem: fix malloc element resize with padding' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'examples/l2fwd-crypto: fix option parsing' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'examples/l2fwd-crypto: fix application help' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'cryptodev: fix device stop function' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'test/crypto: fix overflow' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'mbuf: fix debug checks for headroom and tailroom' " Yuanhan Liu
2017-07-14 10:33 ` Yuanhan Liu [this message]
2017-07-14 10:33 ` [dpdk-stable] patch 'contigmem: do not zero pages during each mmap' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'eal: fix config file path when checking process' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/igb: fix flex filter length' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/fm10k: initialize link status in device start' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/bonding: fix when NTT flag updated' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/vmxnet3: fix receive queue memory leak' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/i40e: fix division by 0' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/bnxt: fix get link config' " Yuanhan Liu
2017-07-14 10:33 ` [dpdk-stable] patch 'net/bnxt: fix autoneg on 10GBase-T links' " Yuanhan Liu
2017-07-14 10:34 ` [dpdk-stable] patch 'net/bnxt: fix set link config' " Yuanhan Liu
2017-07-14 10:34 ` [dpdk-stable] patch 'net/mlx4: fix mbuf poisoning in debug code' " Yuanhan Liu
2017-07-14 10:34 ` [dpdk-stable] patch 'test/bonding: fix mode 4 names' " Yuanhan Liu
2017-07-14 10:34 ` [dpdk-stable] patch 'vhost: fix checking of device features' " Yuanhan Liu
2017-07-14 10:34 ` [dpdk-stable] patch 'net/virtio-user: fix crash when detaching device' " Yuanhan Liu

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=1500028450-25989-25-git-send-email-yliu@fridaylinux.org \
    --to=yliu@fridaylinux.org \
    --cc=bruce.richardson@intel.com \
    --cc=stable@dpdk.org \
    --cc=tiwei.bie@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).