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 89022A0C47; Mon, 26 Jul 2021 10:43:05 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5654740F35; Mon, 26 Jul 2021 10:43:05 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 06F6640DDA for ; Mon, 26 Jul 2021 10:43:02 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10056"; a="211906498" X-IronPort-AV: E=Sophos;i="5.84,270,1620716400"; d="scan'208";a="211906498" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jul 2021 01:42:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,270,1620716400"; d="scan'208";a="463856967" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga008.jf.intel.com with ESMTP; 26 Jul 2021 01:42:59 -0700 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Mon, 26 Jul 2021 01:42:59 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx608.amr.corp.intel.com (10.22.229.21) 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, 26 Jul 2021 01:42:59 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.174) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.10; Mon, 26 Jul 2021 01:42:59 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Zv4GGC7Iy5Box1LY5o0S/5eNxqjOE+fO8UmXn6AycSUWNFmDZZFIiPd7/kzxnq5ogtZq5VTO0trRQuRuoDz2ulUyRBMESIQS51S2sjxjef6muq98qB6xJSE/9Cr8pALIVuN8uCq+vO7sY3REddlulULToiwH2e61HtUx+Qimo88yPuIdzeO04fBbrtW2Af+LBOg3gIYn3+N3ehJCnsu1Eo8Lon6Nh0beztkuaLCiQKRojP6gEuQzqSPWkB+ZM8GdySNkcr+54WJWygR9qPu5Nh1MWI8SkUEzBH/GaSLo6lRIsgeS/lWSJDDNZCzAgSTYu3oeDp+7g0bsJ5TaLS0KmQ== 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=Xd2JdNZRvDRofOFi1+AN08ygH2dRd1ZGOLzJjGOGntI=; b=oGC0ts5kVeQe982v3D0X3R8wBMzknmSLdQvzg/UPuXvQdiIPIe8NJoTIyW9u5tNaCHkYxPqJpSYSG08kAeninH9X0wI0jU5lfQVwy+/8MoHv/q4QKpYF7Od+1JrpA8WQEE0EthdGGFSaoqVal60hd47jAww8De7cTZC2soT4yNjl6MkkLXygySqzmmsblCii0x8ttsYnVKMVHqixz8zJcW0LenQMFjM1D0m6cdv0PnEsZgwvAGsTyKyo6+ofSxNVrr10sn/5M1s61369Q2cct7UUdbLyMnZpbxTNhMQE7XCU/XyanU/hYzp6xJNkwG/i7kjQwvU/kIanMlCV8zMzFA== 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=Xd2JdNZRvDRofOFi1+AN08ygH2dRd1ZGOLzJjGOGntI=; b=MGOCtFZ+ZnLyNTa7/S7CKKEt1aAwnEdIK9ieQxg9mwTla585KJyrPzrI/fmoboH9FOiIKFsu5O+/x/76IySohFhef3MVYtyctkFcaKLgBUxLs89WfIxlTjQYxyFi/SKPaoFZMh4diIg7M2lAt2xU75gjBOJ0dbkJyhQb/MDR7NM= Received: from MN2PR11MB4063.namprd11.prod.outlook.com (2603:10b6:208:13f::22) by MN2PR11MB4093.namprd11.prod.outlook.com (2603:10b6:208:13f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.29; Mon, 26 Jul 2021 08:42:57 +0000 Received: from MN2PR11MB4063.namprd11.prod.outlook.com ([fe80::d447:3a7a:aad7:4d32]) by MN2PR11MB4063.namprd11.prod.outlook.com ([fe80::d447:3a7a:aad7:4d32%7]) with mapi id 15.20.4352.031; Mon, 26 Jul 2021 08:42:57 +0000 From: "Xia, Chenbo" To: Gaoxiang Liu , Maxime Coquelin CC: "dev@dpdk.org" , "liugaoxiang@huawei.com" Thread-Topic: [PATCH] net/virtio: fix memory leak in dev close Thread-Index: AQHXgPlbvnEXFtBs8E6tS5JuAVbf76tU6cDw Date: Mon, 26 Jul 2021 08:42:57 +0000 Message-ID: References: <20210725020315.15010-1-clgx0086@163.com> In-Reply-To: <20210725020315.15010-1-clgx0086@163.com> Accept-Language: en-US, zh-CN Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 authentication-results: 163.com; dkim=none (message not signed) header.d=none;163.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 35940f24-1224-4f55-1915-08d950115e67 x-ms-traffictypediagnostic: MN2PR11MB4093: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:419; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: yE3OLcW/CkH10aTdC6TNKf16Efs2g7Ocv4jzRnJ/dduOSQ2mc3Nx0A1mRLgOnN6wz/eTeSzs4eMXjrZcvGEucTRfG7NRdx42O7GmEmT1LUaTvxDY0qu/mkA3MnxsbvTFIpHaiugWYMcqpxbBqy2ELQ5L7NiGffWJwcBFgM/nRBtPybxkZSSFuxNsRoPBtKKbT5Zc6KiJUhFwT8w1vqch2vXbygnIbhBC0LiY9xtmqqzUMFFtxB5txrk0t+QwRiMlfXmimZxPVIplXreptnwzul0+CMF9m4LxszV2ovTjrPizMjrKTjl8B6gUqS/2VS/RSfxqfZMChjkdxGXKVePcC7LlhR83cJ4118OMcq/wqO7h3MgG1WvdohCHstfmMO4jfwBpaxPq8Nj2uQrEfQ+URNuHLt9TAYd0xn3gwnecs7NcuUKAgC4qdIoynphhPlfR0wPMWVsqw30Tx426DQ6Mv7iG9gCPwRd8UC/T7/EuZ7KjuuMmc9qntcq8Ad2U66eYMGUW0FNb/FJdNfMZBmyVKTxEEU4lMjjrRn4pPJLeJNLovOa2zJs6WTpCn81Wuzw17dqniajpvRzOq9ifkUxsia6nA9xtdF+1Po6PVi+IPdQOWs+zf0wUmclOvtsX4fwW7461C3sQYEXgaS0SFYNasABR+d9LDmcfZ6uVcNsexwrnHm8AqL1e5EHcWf9fPFInakQGNKW42Y6APvBWMBhDZA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR11MB4063.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(346002)(396003)(366004)(136003)(376002)(186003)(8676002)(86362001)(478600001)(2906002)(122000001)(8936002)(26005)(33656002)(55016002)(76116006)(7696005)(83380400001)(110136005)(54906003)(5660300002)(52536014)(9686003)(66556008)(71200400001)(66946007)(38100700002)(66476007)(53546011)(4326008)(316002)(6506007)(66446008)(64756008)(38070700004); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?p+iS+A9J9hGMjRNZmtn1ZTfBp6ijglrBAehfTh9ipciBp6w2gOhPKBhj8wjO?= =?us-ascii?Q?b9A7NcdnnicAtmjE56xicRawNR5r/SJ7YPisguC/QCBB/5ht5AnhZvDFmk4L?= =?us-ascii?Q?xVQ5AKFVXS2DfcComDQhl2idkdryLnSNV80jiLjWYS8PeECDzq6foJHxZ5ug?= =?us-ascii?Q?ee/eZ4uK3RdIKahbjCNuDINSvMiundUx7vu3Q2cEgvRPzT6c6K4LvA3FZ3m9?= =?us-ascii?Q?mBPkB2v4UBI8yjWeRTq3I3hd8nurXuC7rPIxFRiMjJ5w3O5lPFZ3VmtBgpt0?= =?us-ascii?Q?daOv68ZPNwO1sa2MjY1xm9+CbjXrGGQtY46Mhu3Bse2Ogx109C8CpWNGXL4C?= =?us-ascii?Q?hLEDv8HhI6ex3h419pOKmOv8b6PimZE+hIL968CiZ5ZsoCNWRgojAwKCXzwK?= =?us-ascii?Q?7W90rO0ZXhZvs9aWxEB2PqvdMTUNakAon/rELLg6jqn/5nhG6zPM4IuWrNxL?= =?us-ascii?Q?1bya8BkzH6VE0h0h9306R87vxn1ejGnCIeWUI8J7k6a63FTpjKwbJebKOpLB?= =?us-ascii?Q?rgDf+MAMax2wyF2gm/9HDxzUJydQT8zyjOp1CSgXel3z7YNR7y1kbIL/m07J?= =?us-ascii?Q?+BzMWoNclZEa4Twyo31AVJz6ug4fY/HX4xGls9EmyOfe0RDnw6QWvg6JNSEK?= =?us-ascii?Q?cyuGyYhqCBgHiSpdvin10hX7QHa3/zvNd9rWvHYhXlp1jXCrtE43H6K1v392?= =?us-ascii?Q?RkNattMSUPqrCcQz1IAE+jq+aCCwx5hH7iKy4LOiwLVZHFMRemfIPHOA1iPE?= =?us-ascii?Q?QgYbXAxRTdzQixRrOd8DqvVxShT48lO6YTJVT8B/p83DLq01yyC6S+W51QFP?= =?us-ascii?Q?5NzJZSrpnlCw5ZfAty9qFI8f6A8iEXX5u/alCeWnOSzmGcBeLBd+vxePsXxL?= =?us-ascii?Q?Wqmb1uG/4iAA96q6NZWl4cINIuJ4JD+MLq91eUrPQtfHRQuoacaexfL8Kdfn?= =?us-ascii?Q?zlNv+TVFsnPAcnlETktgzybAIM7kgQsfrwoUk7wrCDC5WB4UxqsqTzLlZJ50?= =?us-ascii?Q?BT8oTLg5m1FOPmavDZqHkqWz+6K0vcxRvZmyAwAxmBhqnieiSxHZeMVhA8dp?= =?us-ascii?Q?gczXWc6h8zK6jFcaH2Xv+GM6dWB5qdITxucjQa/yaqGvABWxSnNFgyg9pAu0?= =?us-ascii?Q?NHjjpby5y2RMk9n5HCh57jJppTbpXjr3egS5NzC0EpFxD6NBnF4Ey4YbgL5H?= =?us-ascii?Q?n7AidhQ6atoVlHu1i0fhB+EhavrG7Scu5GLBRO/fKgFZogJNz755gR5klyGc?= =?us-ascii?Q?lTtKkdisovYlYjGynj0hYClYEp2IQtWUNLFfe+oKjnFHniepK3T4as7Elko4?= =?us-ascii?Q?2ILJfjxr9We4/J7bXetokmWs?= x-ms-exchange-transport-forked: True 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: MN2PR11MB4063.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 35940f24-1224-4f55-1915-08d950115e67 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Jul 2021 08:42:57.7157 (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: +R7Pue+Vcd0gXSJAywrF0Ojfu7sG0rPn4c8n7w6D3Vyr4qDoS+eAucU8FWlXkDPYd6pMn94nUeKqxY58WlN0yQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4093 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH] net/virtio: fix memory leak in dev close 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" Hi Gaoxiang, > -----Original Message----- > From: Gaoxiang Liu > Sent: Sunday, July 25, 2021 10:03 AM > To: Maxime Coquelin ; Xia, Chenbo > > Cc: dev@dpdk.org; liugaoxiang@huawei.com; Gaoxiang Liu > Subject: [PATCH] net/virtio: fix memory leak in dev close I suggest the title: fix memory leak of interrupt handle >=20 > Free the "intr_handle" memory in virtio_user_dev_uninit() to > avoid memory leak. > when virtio user dev closes, the "intr_handle" memory is not freeed > that is alloced in virtio_user_fill_intr_handle(). I suggest to replace 'intr_handle memory' with 'memory of interrupt handle' freeed -> freed alloced -> allocated >=20 > Fixes: 7f468b2ebfad ("net/virtio: release port upon close") Please add cc stable tag under fixes line: Cc: stable@dpdk.org And I think the fix commit id is not correct. Fix commit id should be the first commit that introduces the bug. I think it's: 3d4fb6fd2505 ("net/virtio-user: support Rx interrupt") Please help me double confirm. >=20 > Signed-off-by: Gaoxiang Liu I suggest to send patch using this email too. The patch content looks good to me. Thanks, Chenbo > --- > drivers/net/virtio/virtio_user/virtio_user_dev.c | 7 +++++++ > 1 file changed, 7 insertions(+) >=20 > diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c > b/drivers/net/virtio/virtio_user/virtio_user_dev.c > index 1cd1e95f4..16c58710d 100644 > --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c > +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c > @@ -654,6 +654,13 @@ virtio_user_dev_init(struct virtio_user_dev *dev, > char *path, int queues, > void > virtio_user_dev_uninit(struct virtio_user_dev *dev) > { > + struct rte_eth_dev *eth_dev =3D &rte_eth_devices[dev->hw.port_id]; > + > + if (eth_dev->intr_handle) { > + free(eth_dev->intr_handle); > + eth_dev->intr_handle =3D NULL; > + } > + > virtio_user_stop_device(dev); >=20 > rte_mem_event_callback_unregister(VIRTIO_USER_MEM_EVENT_CLB_NAME, > dev); > -- > 2.32.0