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 E5F9EA0C4D; Thu, 2 Sep 2021 08:51:05 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C5DCB40141; Thu, 2 Sep 2021 08:51:05 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 483834003C for ; Thu, 2 Sep 2021 08:51:04 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10094"; a="217135853" X-IronPort-AV: E=Sophos;i="5.84,371,1620716400"; d="scan'208";a="217135853" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Sep 2021 23:50:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,371,1620716400"; d="scan'208";a="428309046" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orsmga006.jf.intel.com with ESMTP; 01 Sep 2021 23:50:53 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Wed, 1 Sep 2021 23:50:53 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Wed, 1 Sep 2021 23:50:52 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Wed, 1 Sep 2021 23:50:52 -0700 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (104.47.56.49) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.10; Wed, 1 Sep 2021 23:50:52 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YwokgtlxVj+KXc0Vl6SQp9se/+PqvMBl17MvNZgO3N6E4qe30JcgZwSB5Qzo4R39SLGd0DaIAB4vcR6Q4X9wQlIyIJt6TEFWI9S6Nqg3f0MbyKQ6Rd7rhvGL3NKCe2Rle59kigHm1I7WhTEqDPwbbQbH7RrvecKelbdPzbe1eYIiTeqtkoIzWAVcQAlWpT7sXL8LBRGjA/0zYM/g5T9y34jG00MbBXeK4MoQJDeeAhovA00iXfIQnaat4irRpLnW8Oem+oZ1z/kpdmhMxDcDpyTS+PzkfLN2MIEA5GbCz0RPZnodYkLZkm+7/SwDIgTMD25m2fv9XwKd83iY5U7s+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9JFPOYmdkC81yiRgDbfEait3wq98pSt297OgtU2P4lw=; b=a1+M1rv6bQlkb2V9UHShDla4ddUAwASxQLAHfDBcZuvvVNIVNHjHgE9C+TJqIju08HD3dA7EYtOeHrB5gvxFiB7SuA/Qy2PMD27nSYArXWYKIJCvhAIVbCAXgTXgef9AECELwOuDgK092CxcGowKeKq8s9hFsmJq9SdJKTCnpxpLHW/y6IAFq0nJNnNYa8ICq2l54j8voFHzI9KKVOWcFUpP+uoj9pD3karvfPTiK8mUpcsOea85uqlsnDnB9w/45wYoP5vGUU/N5A0nITiC0qNcrJWcCC8WzsTcqe+oXouPK745YwyTChXy5kYx5yzbgjjPPkzy2EXQyHCHKHWCEw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9JFPOYmdkC81yiRgDbfEait3wq98pSt297OgtU2P4lw=; b=KQJdSTIhGTEnfxGwEQjM3/3903duwHe9jhXs+8BcIEC139I+2DMgXj51lZQ0pAL7SE8io6xiWRbgehMRpTHn7HDGsCEYJu02MI6w8Ubt3mvZSWUJo79jnaxMrImNCZmSKAmVPnUS/VCEhIdxHkYYhq0UIxHxhr0Uj9CMVWRyLkQ= Received: from DM6PR11MB3771.namprd11.prod.outlook.com (2603:10b6:5:13f::15) by DM5PR11MB2042.namprd11.prod.outlook.com (2603:10b6:3:12::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.24; Thu, 2 Sep 2021 06:50:45 +0000 Received: from DM6PR11MB3771.namprd11.prod.outlook.com ([fe80::59d2:dc16:5884:8259]) by DM6PR11MB3771.namprd11.prod.outlook.com ([fe80::59d2:dc16:5884:8259%5]) with mapi id 15.20.4457.026; Thu, 2 Sep 2021 06:50:45 +0000 From: "Yang, YvonneX" To: "Ma, WenwuX" , "dev@dpdk.org" CC: "maxime.coquelin@redhat.com" , "Xia, Chenbo" , "Jiang, Cheng1" , "Hu, Jiayu" , "Ma, WenwuX" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2] examples/vhost: fix memory leak on forwarding packets Thread-Index: AQHXmuhpvptaC2rjqk2Ai01/UYTa6auQV8lg Date: Thu, 2 Sep 2021 06:50:44 +0000 Message-ID: References: <20210817171320.647414-1-wenwux.ma@intel.com> <20210827140037.3822-1-wenwux.ma@intel.com> In-Reply-To: <20210827140037.3822-1-wenwux.ma@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 24aaf88f-20f2-483c-706e-08d96dddfd5a x-ms-traffictypediagnostic: DM5PR11MB2042: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: pC4SrmH0d3b4Em1XDRupCJzoLNjPBHX1V11YtGFezs1W2QKwPHCqSRPgt7ucbCN8vdq0Nks1dCCAvdIJmFrWWAMd0odcdHuwCru/q726kTvw6Gz77MzNduhfU2KU79jwaRjMOigwne+igzVaBEaDansWTMoRbUhqEe9UvKfE97WKL27rP7AgMRFoI1Q9Tw8mlt08dgQt2hIpg1UqmBs6Fo4nm8N2+jHSRYUBgH5XkVXm7rk+j+d+KUV4OJcEk6k3jiL3v4p8JBQ9F/AXE2z1stn0rueap5RnIAVYM7RJO0Z2r8n8vnx442wRKwkr/cnQBqcXq0MISR6jNFUhB1FId+lBt24ml/QTB83KIQ7J8CkcFiwvp2K+UKxzyeQscIeOvPrzKVdS0xnfIn6ssNHPaiRcgiROyLDeb4vhEtZQnNtoW5Coxa61D1AUA8POPlDjAbEIdoCcxqLK/+jIYqQNiW4M/1Gr9jyBoWEx18jxOEI2t8xNcUOjKfQ8FUfXOS+12he+0MRPepq37cb3+b5tRK3dxMdhavIoSF2mfSo9pxvsO7MJs9gYhE6AodZzLc94Y3dNVkCwNXMqw52NAt7OLhAtPQLK1GA0k9dI2X8FEkXqwduQU+XVdzKGPVX/t+NcmZYVy5nqRD/003bfKY0z14SBS3F3WLcQ0EYTZ0lDNoD96/7AKoRQZ2/Zwq4BIvlaQ+fN8BJdsp6Jjxsf7xqe0g== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB3771.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(39860400002)(136003)(366004)(346002)(396003)(52536014)(83380400001)(8676002)(66476007)(66556008)(64756008)(66446008)(66946007)(9686003)(7696005)(55016002)(4326008)(5660300002)(2906002)(54906003)(122000001)(38100700002)(26005)(110136005)(38070700005)(478600001)(316002)(186003)(76116006)(86362001)(53546011)(6506007)(8936002)(71200400001)(33656002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Mk2J2uZfKFA/kIlZQLjGAvl5K0VZP/DeiLj7OyCoEAuW4S82Xy+DdSmM29cX?= =?us-ascii?Q?b2Tyqj8MAqJsqLs1tNmitjldY+dinQppk2sHBGR0Q/LWGCd63QQtPv0yQ7d3?= =?us-ascii?Q?XjCBDAYp591uKIB5r73TmSjPoCT5tmtZOCgno+G0FtLaq84mJdLWffdwm4Mv?= =?us-ascii?Q?6I2PSOX4Zzko/8fQi4jDlU7gfMEnfBZGieXWQ4L70plpqO8j8/T5kJP9c9Ha?= =?us-ascii?Q?3h1NqfmiD5TWRbvyIjm9u9TGBG7GvG98pO0ZwkGwe4IXaiKWtUl8qk0tqPlC?= =?us-ascii?Q?xEVmClMbZoHTNfEmX0vnCPq5TKL95OyUa67/k85H9O+NxeAQiCaSQ/C6n5LG?= =?us-ascii?Q?fEJN/t4o7F8k4Tj5fI2ZscJD+8OsmME7/7hI6wf0aMSqajE9MSRx4Y60nlBT?= =?us-ascii?Q?3ECyu1ZVFt7OAu5TwmPvp2xVRRmc+g9mirqrlMPktbxrQiZ8sf1ccX7cJr2I?= =?us-ascii?Q?jlsK+t5FBOF/GjRpPT4phkCr+dr51HYnGXwUx78kZJVwI739cnAxt9lc2Qg/?= =?us-ascii?Q?wo/D+Oq4rV+hQU/ruLuMs9ffXLS9ds7us/ked3AIhGIJqajoCWKpMNcN4u2s?= =?us-ascii?Q?7cWbceuwuL/h+APCpLaa99KrkJUuSC1PSLnC7SqxI1JQB6g9iZ990YjAOyPA?= =?us-ascii?Q?YWBnDdBrbyd7TbAmVHeWCD5Pn3rw8tNWKEpBqkdk2yLjkOcsLfAv3Z1qv8TN?= =?us-ascii?Q?4T2YNg99oGsKs8XnVzVULyD/+DhNX8ArZ1pAbxjXf5qnWJxkCoQ4MGD+ffz6?= =?us-ascii?Q?G8DT0Kbi3e7KwLQb9vPS+MR1W+ufXqJITULyfClAlv9rcKJzXc4wOF/fWUCw?= =?us-ascii?Q?Sk0mfC4o7C1ybGiTU4zYc+l/wbHr+yfzFKoQS5I6c0IFfwY4Z5/Sp1HBJTd+?= =?us-ascii?Q?xHQg7FnNPu86v5muxeNDRQCWEmLuKvEV0zI9Ej62MD+W/tK1F62srtbETOT/?= =?us-ascii?Q?91LY2IST8MFNKEEph3/+ngHacIofmvjv0zkzyB0gHLb6JLcQXKTAL/CpMrld?= =?us-ascii?Q?Ce6E442zd+hUel9ULaR/3x+Wwt43npm9vgXvM1lNNPrFGS2yZiL3C+aYIRPo?= =?us-ascii?Q?Hr2mzLqAdZabvXLnsg2yYX+9+1gbHs+UNKmWFpuZMwOjem44RRmWj4VVxoms?= =?us-ascii?Q?VrTLyijCfrdz9Bp4yjdb/7bT0+b9v01RYXtLhCCd/jLQsDRU0QRilcQRbgQA?= =?us-ascii?Q?pThjCq7W27t7IWf9hHbhDlwQIAEGNsfUMEhZPIaVCDaeGNIX9SyHNIA7FTP3?= =?us-ascii?Q?Px8KryNDJKKWXCtYUSgbrYRvSThqnKHfLzq2bZ35bRuOapAr8KyNMLt+Bxb3?= =?us-ascii?Q?RG0=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB3771.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 24aaf88f-20f2-483c-706e-08d96dddfd5a X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Sep 2021 06:50:45.3239 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: jfAbqcH9CPR8nU9cS3cpLRBtHZntCO4kVqzLwwBn35ybyu+QAaesnQUl3SjnkmMeGsel8pDN/SEK30nsOX8VWw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB2042 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v2] 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" > -----Original Message----- > From: dev On Behalf Of Wenwu Ma > Sent: Friday, August 27, 2021 10:01 PM > To: dev@dpdk.org > Cc: maxime.coquelin@redhat.com; Xia, Chenbo ; > Jiang, Cheng1 ; Hu, Jiayu ; > Ma, WenwuX ; stable@dpdk.org > Subject: [dpdk-dev] [PATCH v2] examples/vhost: fix memory leak on > forwarding packets >=20 > In function virtio_tx_local(), when the device receiving the packet is th= e > 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 leak. >=20 > Fixes: 4796ad63ba1f ("examples/vhost: import userspace vhost application"= ) > Cc: stable@dpdk.org >=20 > v2: > - Delete '.' in the title. >=20 > Signed-off-by: Wenwu Ma > --- > examples/vhost/main.c | 2 ++ > 1 file changed, 2 insertions(+) >=20 > 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; >=20 > 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); >=20 > 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 Tested-by: Yvonne Yang