DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/2] event/opdl: fix the resource leak issue
@ 2018-01-24 15:05 Liang Ma
  2018-01-24 15:05 ` [dpdk-dev] [PATCH 2/2] event/opdl: fix dereference before null check Liang Ma
  2018-01-31  9:43 ` [dpdk-dev] [PATCH 1/2] event/opdl: fix the resource leak issue Jerin Jacob
  0 siblings, 2 replies; 3+ messages in thread
From: Liang Ma @ 2018-01-24 15:05 UTC (permalink / raw)
  To: dev; +Cc: harry.van.haaren, bruce.richardson, peter.mccarthy, jerin.jacob

Fixes: d548ef513cd7 ("event/opdl: add unit tests")
Coverity issue: 257004

Signed-off-by: Liang Ma <liang.j.ma@intel.com>
---
 drivers/event/opdl/opdl_test.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/event/opdl/opdl_test.c b/drivers/event/opdl/opdl_test.c
index 44a5cc5..4894c08 100644
--- a/drivers/event/opdl/opdl_test.c
+++ b/drivers/event/opdl/opdl_test.c
@@ -1002,11 +1002,13 @@ opdl_selftest(void)
 		/* turn on stats by default */
 		if (rte_vdev_init(eventdev_name, "do_validation=1") < 0) {
 			PMD_DRV_LOG(ERR, "Error creating eventdev\n");
+			free(t);
 			return -1;
 		}
 		evdev = rte_event_dev_get_dev_id(eventdev_name);
 		if (evdev < 0) {
 			PMD_DRV_LOG(ERR, "Error finding newly created eventdev\n");
+			free(t);
 			return -1;
 		}
 	}
@@ -1022,6 +1024,7 @@ opdl_selftest(void)
 				rte_socket_id());
 		if (!eventdev_func_mempool) {
 			PMD_DRV_LOG(ERR, "ERROR creating mempool\n");
+			free(t);
 			return -1;
 		}
 	}
@@ -1044,9 +1047,9 @@ opdl_selftest(void)
 	ret = single_link_w_stats(t);
 
 	/*
-	 * Free test instance, leaving mempool initialized, and a pointer to it
-	 * in static eventdev_func_mempool, as it is re-used on re-runs
+	 * Free test instance, free  mempool
 	 */
+	rte_mempool_free(t->mbuf_pool);
 	free(t);
 
 	if (ret != 0)
-- 
2.7.5

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [dpdk-dev] [PATCH 2/2] event/opdl: fix dereference before null check
  2018-01-24 15:05 [dpdk-dev] [PATCH 1/2] event/opdl: fix the resource leak issue Liang Ma
@ 2018-01-24 15:05 ` Liang Ma
  2018-01-31  9:43 ` [dpdk-dev] [PATCH 1/2] event/opdl: fix the resource leak issue Jerin Jacob
  1 sibling, 0 replies; 3+ messages in thread
From: Liang Ma @ 2018-01-24 15:05 UTC (permalink / raw)
  To: dev; +Cc: harry.van.haaren, bruce.richardson, peter.mccarthy, jerin.jacob

Fixes: 4236ce9bf5bf ("event/opdl: add OPDL ring infrastructure library")
Coverity issue: 257022

Signed-off-by: Liang Ma <liang.j.ma@intel.com>
---
 drivers/event/opdl/opdl_ring.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/event/opdl/opdl_ring.c b/drivers/event/opdl/opdl_ring.c
index 7e16d4d..39dc41d 100644
--- a/drivers/event/opdl/opdl_ring.c
+++ b/drivers/event/opdl/opdl_ring.c
@@ -550,6 +550,10 @@ opdl_stage_claim_multithread(struct opdl_stage *s, void *entries,
 	uint32_t i = 0, offset;
 	uint8_t *entries_offset = (uint8_t *)entries;
 
+	if (seq == NULL) {
+		PMD_DRV_LOG(ERR, "Invalid seq PTR");
+		return 0;
+	}
 	offset = opdl_first_entry_id(*seq, s->nb_instance, s->instance_id);
 	num_entries = offset + (s->nb_instance * num_entries);
 
@@ -561,8 +565,8 @@ opdl_stage_claim_multithread(struct opdl_stage *s, void *entries,
 		entries_offset += t->slot_size;
 		i++;
 	}
-	if (seq != NULL)
-		*seq = old_head;
+
+	*seq = old_head;
 
 	return i;
 }
-- 
2.7.5

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] event/opdl: fix the resource leak issue
  2018-01-24 15:05 [dpdk-dev] [PATCH 1/2] event/opdl: fix the resource leak issue Liang Ma
  2018-01-24 15:05 ` [dpdk-dev] [PATCH 2/2] event/opdl: fix dereference before null check Liang Ma
@ 2018-01-31  9:43 ` Jerin Jacob
  1 sibling, 0 replies; 3+ messages in thread
From: Jerin Jacob @ 2018-01-31  9:43 UTC (permalink / raw)
  To: Liang Ma; +Cc: dev, harry.van.haaren, bruce.richardson, peter.mccarthy

-----Original Message-----
> Date: Wed, 24 Jan 2018 15:05:50 +0000
> From: Liang Ma <liang.j.ma@intel.com>
> To: dev@dpdk.org
> CC: harry.van.haaren@intel.com, bruce.richardson@intel.com,
>  peter.mccarthy@intel.com, jerin.jacob@caviumnetworks.com
> Subject: [PATCH 1/2] event/opdl: fix the resource leak issue
> X-Mailer: git-send-email 2.7.5
> 
> Fixes: d548ef513cd7 ("event/opdl: add unit tests")
> Coverity issue: 257004
> 
> Signed-off-by: Liang Ma <liang.j.ma@intel.com>

Applied this series to dpdk-next-eventdev/master. Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-01-31  9:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-24 15:05 [dpdk-dev] [PATCH 1/2] event/opdl: fix the resource leak issue Liang Ma
2018-01-24 15:05 ` [dpdk-dev] [PATCH 2/2] event/opdl: fix dereference before null check Liang Ma
2018-01-31  9:43 ` [dpdk-dev] [PATCH 1/2] event/opdl: fix the resource leak issue Jerin Jacob

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).