From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 349031B26E for ; Thu, 9 Nov 2017 19:41:16 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Nov 2017 10:41:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,370,1505804400"; d="scan'208";a="214824" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.241.224.59]) ([10.241.224.59]) by FMSMGA003.fm.intel.com with ESMTP; 09 Nov 2017 10:41:15 -0800 To: Ilya Matveychikov , dev@dpdk.org References: From: Ferruh Yigit Message-ID: <140d63af-200b-a502-c7d4-14d071faf991@intel.com> Date: Thu, 9 Nov 2017 10:41:15 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] pdump: fix possible mbuf leak X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Nov 2017 18:41:17 -0000 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 > --- > 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 >