From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Ilya V. Matveychikov" Subject: [PATCH] pdump: fix possible mbuf leak Date: Fri, 10 Nov 2017 16:55:16 +0300 Message-ID: <20171110135516.23996-1-matvejchikov@gmail.com> References: Cc: "Ilya V. Matveychikov" , reshma.pattan@intel.com To: dev@dpdk.org Return-path: Received: from mail-wr0-f194.google.com (mail-wr0-f194.google.com [209.85.128.194]) by dpdk.org (Postfix) with ESMTP id A1EAA1B1F3 for ; Fri, 10 Nov 2017 14:55:21 +0100 (CET) Received: by mail-wr0-f194.google.com with SMTP id j23so8668020wra.9 for ; Fri, 10 Nov 2017 05:55:21 -0800 (PST) In-Reply-To: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "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: 278f945402c5 ("pdump: add new library for packet capture") Cc: reshma.pattan@intel.com Signed-off-by: Ilya V. Matveychikov --- 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