From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3CCD6A0548; Tue, 17 Aug 2021 09:12:13 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B561641188; Tue, 17 Aug 2021 09:12:11 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 61C4D4115A; Tue, 17 Aug 2021 09:12:07 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10078"; a="212891723" X-IronPort-AV: E=Sophos;i="5.84,328,1620716400"; d="scan'208";a="212891723" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Aug 2021 00:12:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,328,1620716400"; d="scan'208";a="530906181" Received: from fmsmsx605.amr.corp.intel.com ([10.18.126.85]) by fmsmga002.fm.intel.com with ESMTP; 17 Aug 2021 00:12:06 -0700 Received: from shsmsx603.ccr.corp.intel.com (10.109.6.143) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Tue, 17 Aug 2021 00:12:05 -0700 Received: from shsmsx603.ccr.corp.intel.com (10.109.6.143) by SHSMSX603.ccr.corp.intel.com (10.109.6.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Tue, 17 Aug 2021 15:12:03 +0800 Received: from shsmsx603.ccr.corp.intel.com ([10.109.6.143]) by SHSMSX603.ccr.corp.intel.com ([10.109.6.143]) with mapi id 15.01.2242.010; Tue, 17 Aug 2021 15:12:03 +0800 From: "Hu, Jiayu" To: "Jiang, Cheng1" , "Ma, WenwuX" , "dev@dpdk.org" CC: "maxime.coquelin@redhat.com" , "Xia, Chenbo" , "stable@dpdk.org" Thread-Topic: [PATCH] examples/vhost: fix memory leak on forwarding packets. Thread-Index: AQHXkyecIM8eCk/IK02FNndrJcNsQqt2pG0AgACjY+A= Date: Tue, 17 Aug 2021 07:12:03 +0000 Message-ID: <14f1d4ee4bce46458e6b67f207c65d76@intel.com> References: <20210817171320.647414-1-wenwux.ma@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.5.1.3 dlp-product: dlpe-windows x-originating-ip: [10.239.127.36] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] examples/vhost: fix memory leak on forwarding packets. X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Reviewed-by: Jiayu Hu > -----Original Message----- > From: Jiang, Cheng1 > Sent: Tuesday, August 17, 2021 1:26 PM > To: Ma, WenwuX ; dev@dpdk.org > Cc: maxime.coquelin@redhat.com; Xia, Chenbo ; Hu, > Jiayu ; stable@dpdk.org > Subject: RE: [PATCH] examples/vhost: fix memory leak on forwarding packet= s. >=20 > Acked-by: Cheng Jiang >=20 >=20 >=20 >=20 > > -----Original Message----- > > From: Ma, WenwuX > > Sent: Wednesday, August 18, 2021 1:13 AM > > To: dev@dpdk.org > > Cc: maxime.coquelin@redhat.com; Xia, Chenbo ; > > Jiang, Cheng1 ; Hu, Jiayu > > ; Ma, WenwuX ; > > stable@dpdk.org > > Subject: [PATCH] examples/vhost: fix memory leak on forwarding packets. > > > > In function virtio_tx_local(), when the device receiving the packet is > > the same as the device to which the packet is forwarded, or the device > > is removed, we return but not free the packet, it will cause a memory l= eak. > > > > Fixes: 4796ad63ba1f ("examples/vhost: import userspace vhost > > application") > > Cc: stable@dpdk.org > > > > Signed-off-by: Wenwu Ma > > --- > > examples/vhost/main.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/examples/vhost/main.c b/examples/vhost/main.c index > > bc3d71c898..07fd90ec64 100644 > > --- a/examples/vhost/main.c > > +++ b/examples/vhost/main.c > > @@ -965,6 +965,7 @@ virtio_tx_local(struct vhost_dev *vdev, struct > > rte_mbuf *m) > > return -1; > > > > if (vdev->vid =3D=3D dst_vdev->vid) { > > + rte_pktmbuf_free(m); > > RTE_LOG_DP(DEBUG, VHOST_DATA, > > "(%d) TX: src and dst MAC is same. Dropping > packet.\n", > > vdev->vid); > > @@ -975,6 +976,7 @@ virtio_tx_local(struct vhost_dev *vdev, struct > > rte_mbuf *m) > > "(%d) TX: MAC address is local\n", dst_vdev->vid); > > > > if (unlikely(dst_vdev->remove)) { > > + rte_pktmbuf_free(m); > > RTE_LOG_DP(DEBUG, VHOST_DATA, > > "(%d) device is marked for removal\n", dst_vdev- > > >vid); > > return 0; > > -- > > 2.25.1 >=20