From mboxrd@z Thu Jan 1 00:00:00 1970 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=c2qGKZpmZGPu0uAUg+9yfmrmfeSYV9sFBrByzJczepU=; b=OLmt68wraSa7dVi+AOMysJPkofZFfoueXyFHpfZW9kYVbvCGL+bVhxYbWUU7ub/zvV TfogxMS10NBnL6BYA++vJUFGlKeq3FsMIutugjywytyYWHbGq0Yes7DjIDZ0kIUhNWAs gFBhX7HQRLDgcArK620u4QpoGZDXHWHFtX8dOIwYzrMsFavqjKV8Suqpc3zFrhs3C+wq XUna6ZmNUk0tH/PjM0ktkKMHQ8u/EXC/a++WqCHGdpizFYziNEajhP0jL7EbHVz6jb9Z E9RoF6KaSSuG3iMK6hQtncAtAVFIcJ1C5dAXqQn0LMsxhg2g95SQqSwPwNuO4cGfKwFX +HqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=c2qGKZpmZGPu0uAUg+9yfmrmfeSYV9sFBrByzJczepU=; b=gDT5me4wNGVS6sc+Y5VFwva6cmFnGx8pQBGRXST1Iv7kXI5dKPs776mwNBGdvSb/Be Wsh1Qw8jDjTckNfs2ve/9aHBFgsgIzPeYi80ee3mDWAbfM3dibKKjww7U8MeLQknfI5W VMAyNvxMrAL2XJUizEB6NCIDksk72OPlKT7G1te/sxeo0v/VyyFdtCqp0C+lAm6HTvyo 3vZE7rR6YnYiQQ4N5ximGa7RK0fmIi27lb5f5sXAuX8nA0uaf9WcbSjEyG8OKtJ7GG61 OGBvJghxG44rGwsIY3jpJx5zNE4zkuZTS0SkI1ZKWSS10OGAz4F9yugYXr6ChJJLFmwC 9X0g== X-Gm-Message-State: AJaThX7VxNCKxnd0xx/YGT2xRwaAql/Ze0MupNAWYA7sgmRGRQU4n9+R gsF3+DkMXfXLXHHKGcybdmVXwLIM X-Google-Smtp-Source: AGs4zMYP5dP+j0crt6CClDH/2UNuJfKLeDq0HztmEYxPcwqS6319uSDEUbxyZZe0QoRVxIWaXORYvA== X-Received: by 10.223.200.132 with SMTP id k4mr366913wrh.215.1510322121210; Fri, 10 Nov 2017 05:55:21 -0800 (PST) Received: from xone.net.sahm.ae ([94.205.75.192]) by smtp.gmail.com with ESMTPSA id m198sm3843663wmg.20.2017.11.10.05.55.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Nov 2017 05:55:20 -0800 (PST) From: "Ilya V. Matveychikov" To: dev@dpdk.org Cc: "Ilya V. Matveychikov" , reshma.pattan@intel.com Date: Fri, 10 Nov 2017 16:55:16 +0300 Message-Id: <20171110135516.23996-1-matvejchikov@gmail.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: References: Subject: [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: Fri, 10 Nov 2017 13:55:21 -0000 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