From: Ilya Matveychikov Subject: [PATCH] pdump: fix possible mbuf leak Date: Thu, 9 Nov 2017 17:49:24 +0400 Message-ID: Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable To: dev@dpdk.org Return-path: Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by dpdk.org (Postfix) with ESMTP id 445841B6A6 for ; Thu, 9 Nov 2017 14:49:27 +0100 (CET) Received: by mail-wm0-f67.google.com with SMTP id y80so17206716wmd.0 for ; Thu, 09 Nov 2017 05:49:27 -0800 (PST) Received: from [10.61.0.167] (bba193485.alshamil.net.ae. [217.165.96.191]) by smtp.gmail.com with ESMTPSA id i10sm6141132edl.34.2017.11.09.05.49.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Nov 2017 05:49:26 -0800 (PST) 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: 278f9454 ("pdump: add new library for packet capture") Signed-off-by: Ilya V. Matveychikov --- 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 !=3D m_dup) rte_pktmbuf_free(seg); rte_pktmbuf_free(m_dup); return NULL; } -- 2.7.4=