DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] pdump: fix possible mbuf leak
@ 2017-11-09 13:49 Ilya Matveychikov
  2017-11-09 18:41 ` Ferruh Yigit
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ilya Matveychikov @ 2017-11-09 13:49 UTC (permalink / raw)
  To: dev

If pdump_pktmbuf_copy_data() fails it's possible to have segment leak
as rte_pktmbuf_free() only handles m_dup chain but not the seg just
allocated and yet not chained.

Fixes: 278f9454 ("pdump: add new library for packet capture")
Signed-off-by: Ilya V. Matveychikov <matvejchikov@gmail.com>
---
 lib/librte_pdump/rte_pdump.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/librte_pdump/rte_pdump.c b/lib/librte_pdump/rte_pdump.c
index 729e79a..1ca709d 100644
--- a/lib/librte_pdump/rte_pdump.c
+++ b/lib/librte_pdump/rte_pdump.c
@@ -153,6 +153,7 @@ pdump_pktmbuf_copy(struct rte_mbuf *m, struct rte_mempool *mp)
 	do {
 		nseg++;
 		if (pdump_pktmbuf_copy_data(seg, m) < 0) {
+			if (seg != m_dup) rte_pktmbuf_free(seg);
 			rte_pktmbuf_free(m_dup);
 			return NULL;
 		}
--
2.7.4

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

* Re: [dpdk-dev] [PATCH] pdump: fix possible mbuf leak
  2017-11-09 13:49 [dpdk-dev] [PATCH] pdump: fix possible mbuf leak Ilya Matveychikov
@ 2017-11-09 18:41 ` Ferruh Yigit
  2017-11-10 13:54 ` [dpdk-dev] [PATCH 1/4] " Ilya V. Matveychikov
  2017-11-10 13:55 ` [dpdk-dev] [PATCH] " Ilya V. Matveychikov
  2 siblings, 0 replies; 5+ messages in thread
From: Ferruh Yigit @ 2017-11-09 18:41 UTC (permalink / raw)
  To: Ilya Matveychikov, dev

On 11/9/2017 5:49 AM, Ilya Matveychikov wrote:
> If pdump_pktmbuf_copy_data() fails it's possible to have segment leak
> as rte_pktmbuf_free() only handles m_dup chain but not the seg just
> allocated and yet not chained.
> 
> Fixes: 278f9454 ("pdump: add new library for packet capture")
> Signed-off-by: Ilya V. Matveychikov <matvejchikov@gmail.com>
> ---
>  lib/librte_pdump/rte_pdump.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/librte_pdump/rte_pdump.c b/lib/librte_pdump/rte_pdump.c
> index 729e79a..1ca709d 100644
> --- a/lib/librte_pdump/rte_pdump.c
> +++ b/lib/librte_pdump/rte_pdump.c
> @@ -153,6 +153,7 @@ pdump_pktmbuf_copy(struct rte_mbuf *m, struct rte_mempool *mp)
>  	do {
>  		nseg++;
>  		if (pdump_pktmbuf_copy_data(seg, m) < 0) {
> +			if (seg != m_dup) rte_pktmbuf_free(seg);

You can prefer rte_pktmbuf_free_seg()

Also can you please use two lines?

>  			rte_pktmbuf_free(m_dup);
>  			return NULL;
>  		}
> --
> 2.7.4
> 

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

* [dpdk-dev] [PATCH 1/4] pdump: fix possible mbuf leak
  2017-11-09 13:49 [dpdk-dev] [PATCH] pdump: fix possible mbuf leak Ilya Matveychikov
  2017-11-09 18:41 ` Ferruh Yigit
@ 2017-11-10 13:54 ` Ilya V. Matveychikov
  2017-11-10 13:55 ` [dpdk-dev] [PATCH] " Ilya V. Matveychikov
  2 siblings, 0 replies; 5+ messages in thread
From: Ilya V. Matveychikov @ 2017-11-10 13:54 UTC (permalink / raw)
  To: dev; +Cc: Ilya V . Matveychikov

If pdump_pktmbuf_copy_data() fails it's possible to have segment leak
as rte_pktmbuf_free() only handles m_dup chain but not the seg just
allocated and yet not chained.

Fixes: 278f9454 ("pdump: add new library for packet capture")
Signed-off-by: Ilya V. Matveychikov <matvejchikov@gmail.com>
---
 lib/librte_pdump/rte_pdump.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/librte_pdump/rte_pdump.c b/lib/librte_pdump/rte_pdump.c
index 729e79a..1ca709d 100644
--- a/lib/librte_pdump/rte_pdump.c
+++ b/lib/librte_pdump/rte_pdump.c
@@ -153,6 +153,7 @@ pdump_pktmbuf_copy(struct rte_mbuf *m, struct rte_mempool *mp)
 	do {
 		nseg++;
 		if (pdump_pktmbuf_copy_data(seg, m) < 0) {
+			if (seg != m_dup) rte_pktmbuf_free(seg);
 			rte_pktmbuf_free(m_dup);
 			return NULL;
 		}
-- 
2.7.4

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

* [dpdk-dev] [PATCH] pdump: fix possible mbuf leak
  2017-11-09 13:49 [dpdk-dev] [PATCH] pdump: fix possible mbuf leak Ilya Matveychikov
  2017-11-09 18:41 ` Ferruh Yigit
  2017-11-10 13:54 ` [dpdk-dev] [PATCH 1/4] " Ilya V. Matveychikov
@ 2017-11-10 13:55 ` Ilya V. Matveychikov
  2017-11-12  3:13   ` Thomas Monjalon
  2 siblings, 1 reply; 5+ messages in thread
From: Ilya V. Matveychikov @ 2017-11-10 13:55 UTC (permalink / raw)
  To: dev; +Cc: Ilya V. Matveychikov, reshma.pattan

If pdump_pktmbuf_copy_data() fails it's possible to have segment leak
as rte_pktmbuf_free() only handles m_dup chain but not the seg just
allocated and yet not chained.

Fixes: 278f945402c5 ("pdump: add new library for packet capture")
Cc: reshma.pattan@intel.com

Signed-off-by: Ilya V. Matveychikov <matvejchikov@gmail.com>
---
 lib/librte_pdump/rte_pdump.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/librte_pdump/rte_pdump.c b/lib/librte_pdump/rte_pdump.c
index e6182d35c..fec49b525 100644
--- a/lib/librte_pdump/rte_pdump.c
+++ b/lib/librte_pdump/rte_pdump.c
@@ -153,6 +153,8 @@ pdump_pktmbuf_copy(struct rte_mbuf *m, struct rte_mempool *mp)
 	do {
 		nseg++;
 		if (pdump_pktmbuf_copy_data(seg, m) < 0) {
+			if (seg != m_dup)
+				rte_pktmbuf_free_seg(seg);
 			rte_pktmbuf_free(m_dup);
 			return NULL;
 		}
-- 
2.14.2

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

* Re: [dpdk-dev] [PATCH] pdump: fix possible mbuf leak
  2017-11-10 13:55 ` [dpdk-dev] [PATCH] " Ilya V. Matveychikov
@ 2017-11-12  3:13   ` Thomas Monjalon
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2017-11-12  3:13 UTC (permalink / raw)
  To: Ilya V. Matveychikov; +Cc: dev, reshma.pattan

10/11/2017 14:55, Ilya V. Matveychikov:
> If pdump_pktmbuf_copy_data() fails it's possible to have segment leak
> as rte_pktmbuf_free() only handles m_dup chain but not the seg just
> allocated and yet not chained.
> 
> Fixes: 278f945402c5 ("pdump: add new library for packet capture")
> Cc: reshma.pattan@intel.com
> 
> Signed-off-by: Ilya V. Matveychikov <matvejchikov@gmail.com>

Applied, thanks

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

end of thread, other threads:[~2017-11-12  6:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-09 13:49 [dpdk-dev] [PATCH] pdump: fix possible mbuf leak Ilya Matveychikov
2017-11-09 18:41 ` Ferruh Yigit
2017-11-10 13:54 ` [dpdk-dev] [PATCH 1/4] " Ilya V. Matveychikov
2017-11-10 13:55 ` [dpdk-dev] [PATCH] " Ilya V. Matveychikov
2017-11-12  3:13   ` Thomas Monjalon

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