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 4A5DAA0548; Tue, 17 Aug 2021 07:26:35 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E8FDA40143; Tue, 17 Aug 2021 07:26:34 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 6646E40142; Tue, 17 Aug 2021 07:26:33 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10078"; a="215723665" X-IronPort-AV: E=Sophos;i="5.84,328,1620716400"; d="scan'208";a="215723665" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Aug 2021 22:26:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,328,1620716400"; d="scan'208";a="520300012" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by FMSMGA003.fm.intel.com with ESMTP; 16 Aug 2021 22:26:32 -0700 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) 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.10; Mon, 16 Aug 2021 22:26:31 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10 via Frontend Transport; Mon, 16 Aug 2021 22:26:31 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.106) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.10; Mon, 16 Aug 2021 22:26:30 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QbhKtcKJeCCfdJxjZ7HQOQdR+O9+ryfw6r28VZc5S6fn8Q0xOt34oGZzEQALpPqATR1FAML28ztBrn4ssIZsrAQdraJfmEvvxOO4xV2DkjVzCiKT2grOhF98M2RTdUBDohHDqEaXLlFpBVbd5BEibT7FaSuVyd0mnIhoE5fp4rr0oOShvYlPcy4Zwj0fW8aj5vcVWpPswtIxOUoMafyplFYcgjTy7hN2G9GuKu2hgT5OmsOGiA/IiYpXdmkV9gd9mHsEQPsSqzTFnLIfddUUK5zn0FwK0c52+1LVJ61gUKHdubKKDdR+jtKByvWW5AlmMDkstaWDXpBY9biSTIIiGw== 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=IJKToT7c1bxSwZQDz/VvzRTPJD81p+/HyPb8MYDMfXE=; b=Wb7y1K9K9gRTyM3SS36/TEf51HBzRe3WQqigEaL5pPhJKTglVoi2ihSzpLCAr+E9Hh4EQp/hOdLNYBrw7hwoDKHWacH20MohFRbysU3xBHL+3fIh3qE1JH7+Iy53Qf2lyK78Q3K83RPRtmY26sFyqYFb5SwCgkDs4mJeIrfT3jmZN6xOAtmz1drmTpY8Dl5i0bjBEzUXb6CFvEfH0mbwPcTs88RvPg7gmdWwo2GiXHygYNBqCjtv5VVbCM6e98gjaBr++tXok/RqTr4DloeTn654sSYfr0FL6nCD075h9xso4WYxbLDY4dQBwbHV4kj1UUFn3hrj/PMw4Gvb6B4sZA== 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=IJKToT7c1bxSwZQDz/VvzRTPJD81p+/HyPb8MYDMfXE=; b=hjpD4JArOINxU3ORKzhAP/UaPDH7hiEncDN5o4U+0NN/fwXm2kxxvf+kaTasp5l9qeDujWPNs0tjwg4sh/bDdD6JcQc/Suqe242TivvbnqhOogFlxYEqBioU5hLUXa+k7g9N1emPVe+oKRdO3uDpTBnXUJmgwG6CpwjjjvgvFy4= Received: from SJ0PR11MB5006.namprd11.prod.outlook.com (2603:10b6:a03:2db::22) by BYAPR11MB3190.namprd11.prod.outlook.com (2603:10b6:a03:7b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.21; Tue, 17 Aug 2021 05:26:26 +0000 Received: from SJ0PR11MB5006.namprd11.prod.outlook.com ([fe80::974:1627:72a8:b512]) by SJ0PR11MB5006.namprd11.prod.outlook.com ([fe80::974:1627:72a8:b512%4]) with mapi id 15.20.4415.024; Tue, 17 Aug 2021 05:26:26 +0000 From: "Jiang, Cheng1" To: "Ma, WenwuX" , "dev@dpdk.org" CC: "maxime.coquelin@redhat.com" , "Xia, Chenbo" , "Hu, Jiayu" , "stable@dpdk.org" Thread-Topic: [PATCH] examples/vhost: fix memory leak on forwarding packets. Thread-Index: AQHXkyekDOdxBwtieE2P9hcIwMq3Pqt3KYqQ Date: Tue, 17 Aug 2021 05:26:26 +0000 Message-ID: References: <20210817171320.647414-1-wenwux.ma@intel.com> In-Reply-To: <20210817171320.647414-1-wenwux.ma@intel.com> Accept-Language: zh-CN, 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: 7cf6ad92-4647-439b-0006-08d9613f8f27 x-ms-traffictypediagnostic: BYAPR11MB3190: 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:4941; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 8I/bLWwbwyzLc8TXkvFoPDnGgkS9DvNch37ScklQIyF3nxQrG09SwAyK3WOyk6TVxZ3PcKuIga3E1YPXrYueLGinxMUmDlWHjIpUPG2T8X0tVmlRSzmBFsjKjG+kbtq+6uhwkeTe+sBml9w4r3nwhwuwjJf7LFaqsCjACcLnl9a0PPFUq7AUAa+RVrDKJIUdLC7VWppVAm9LP6nSOvkRxU8gKoOZ3udUcnOxjP1dInx5pQRfyT4Wo7PMTDaksWZf/P2HMMFzL/rnGLWrIaemwHPp6y4LBCgUWih9rMm+kIjLAwhfcQDCiVPZxOLdg4HM1VSswJm+vG+LEkbN5LD/VJeyHf4RtXvYJg2jUweBkYrO7vWNgxgQ/HK4vrXzxPMj0S45GrayrYqQUXExg7Rn3A+2iQ8rutkjLul/4kwIyqbdyEXEX+sa4NqZj+BWYkAX5sXnHcnBk7NrtB+gOVJxc3T85oU+vSrVS6hVK3kNPJ0Rjq0F0/eyZl/rsZYGxgBMlnXr0IQggVfn4njAkTBvxQXYRNdFzZO6sL1m05IYFxw12jzDvaQx1D1pqQOBKGzJAMBAHMj52uXL7TRtpH0v6gIxZGD5IXdBdFWU/dgfUYghjM3BDZrTXlDUs77Gp4OYUe/9XajCDjMT4s/qlyl1trPGRZex+1M2RvaYAJ/NDbVyQb7UiF6O8wJ0r2dMw+luADnIl3xPt1qqjInP1dHtVQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR11MB5006.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(136003)(346002)(366004)(39860400002)(376002)(7696005)(71200400001)(76116006)(55016002)(66946007)(54906003)(9686003)(478600001)(86362001)(52536014)(66476007)(2906002)(66556008)(38100700002)(66446008)(64756008)(122000001)(4326008)(8936002)(33656002)(316002)(8676002)(83380400001)(186003)(6506007)(53546011)(110136005)(5660300002)(38070700005)(26005); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?JdMkY0LJbOWprL9ySR4IUByVvmrQ+lp9am2BEb4HU0T1JUYhTVCEyL8WJ1Yc?= =?us-ascii?Q?Y7xLgJ+HbMmeTOTaHmmWN1Bvtj6dMrZwtriglCYhV+HUaz8w8B9ihCXbiKKH?= =?us-ascii?Q?e7oU6tF141gJxhbf++PIbBeHsLKLQBXUgn9KRNcoTaFcjVw6SndIkBkID8nj?= =?us-ascii?Q?ehxgBrPR4EmF17s6rDVhQmqfIQw8c8kirOH9LmXX9nbbJbescdJ+yqDahcRO?= =?us-ascii?Q?yFQiUar467GWFRGf4V+daHz4EUM0kBIj31+VIH044jceO4gqIYIHNBNndIQx?= =?us-ascii?Q?XJngdApU+/sDOjtIRpgkjje3TUKle9lnN07C13wOOjTkzCPqImrtctaFPg5G?= =?us-ascii?Q?kXfhpp5pa+S6KQyf8LgiancLK1NhJpXASy9/us4eX9oWmA8YERl8hxv+I1JX?= =?us-ascii?Q?8HEEAfOWWjUrM+mn0LO5+PEWQsBB9tvM/gDeMM/myCd7hvec4P00eFkhi0Gy?= =?us-ascii?Q?CWjO9IySJTv1cfjs3JlUrgu2PDjAw++E7KFMroY/J6/KZxehX23WzpHgQKNp?= =?us-ascii?Q?jKnT5/dI1jticjhhdvC52vEsDsaGs/Q6s3lh9QVtQpnUxpMMAzW2EQWZqcKr?= =?us-ascii?Q?DiV7wvOErPBOKhBpuFdgsDhTqJ+qjuc0gFS1lKBbO6LU0YAbuBfuHY6BHqK1?= =?us-ascii?Q?VKPqKSptiwZ6fjO0EIDDBkDaZiZbsNVGi0kbd1Qbx2pQqOagAfIfdlUNsjxU?= =?us-ascii?Q?cscEFKWZz9k1uL+sC14xGWh90y4hTkYbOah5orZZsA5PxjO9v5OCvqj3aDIe?= =?us-ascii?Q?lWt++WR2m5vNjHJ72cY3PdALwb83Kspm/6dYGHDvpI292fea86w/nwItjcsU?= =?us-ascii?Q?sqcDCFpBsBASUs+kbBN+CKLcABvl8sKqxkCZ36IK4ZFY2bMvxzS6XqUoY4n8?= =?us-ascii?Q?zCLPAmP/2KAsxZyaAbEsL5Tlk3tNzrEyVd6QGiH8D2FSJIsX2F5tYuP3a/U1?= =?us-ascii?Q?Zsz7SZ05BGVByzxjD2kbZk5bVUKU52hBsHzHsrvO3AFhZjRUf/7oh6xiyd1Q?= =?us-ascii?Q?H/dd7pct0E0jMWz2NeCf0uRUp9rcHLelnwikIPMGMohCCMfP6ZbYYykiZT8E?= =?us-ascii?Q?BfJos191jIeQhdAirIAa4BFP5XhVkY6CkNRFMd0qTGUi23OONlhgM7OSCQj3?= =?us-ascii?Q?H4WBuG2Gm+DgIEgozSKAgXcvJG3dY0UEcyhRFUygFGh+YRDm8PyzM94WYBjK?= =?us-ascii?Q?0G8w/uheKRuR+7BzWd9kpuCxZYrpzSVwkxK2nWx4A13uR0wl785U0zl+bb9G?= =?us-ascii?Q?86Rk52i5oY/JGzj+HRstIlL1NOG3vNUXQjFWFYzWlCBSkUDJ7wv1CX46kCuK?= =?us-ascii?Q?K7g=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: SJ0PR11MB5006.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7cf6ad92-4647-439b-0006-08d9613f8f27 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Aug 2021 05:26:26.1301 (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: Du585iA11/hRaGauwweP/zXp2EwlI2j0FyhMKMjMRY4WO8ZDmZ5LpPSH8yjv2QmZYpNIkWR+AHuXmnDDiYwpgQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3190 X-OriginatorOrg: intel.com 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" Acked-by: Cheng Jiang > -----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. >=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 > 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