[dpdk-dev] pdump: fix possible mbuf leak
Checks
Commit Message
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(+)
Comments
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
@@ -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;
}