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 2B94442DE1 for ; Thu, 6 Jul 2023 02:48:19 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 227F642D4A; Thu, 6 Jul 2023 02:48:19 +0200 (CEST) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id CF309400D5; Thu, 6 Jul 2023 02:48:16 +0200 (CEST) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4QxHtr0BlYz1HCsk; Thu, 6 Jul 2023 08:47:48 +0800 (CST) Received: from [10.67.100.224] (10.67.100.224) by dggpeml100024.china.huawei.com (7.185.36.115) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Thu, 6 Jul 2023 08:48:13 +0800 Subject: Re: [PATCH v1 1/2] bus/vdev: fix memory leak To: Wenjun Wu , , , CC: , References: <20230705092511.362484-1-wenjun1.wu@intel.com> <20230705092511.362484-2-wenjun1.wu@intel.com> From: fengchengwen Message-ID: <34c20eb2-efc9-2a42-72dc-a3abcc608019@huawei.com> Date: Thu, 6 Jul 2023 08:48:13 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <20230705092511.362484-2-wenjun1.wu@intel.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.100.224] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml100024.china.huawei.com (7.185.36.115) X-CFilter-Loop: Reflected X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org On 2023/7/5 17:25, Wenjun Wu wrote: > In hotplug usecase, devargs will be allocated in secondary process > in the function alloc_devargs. Since it will not be insert into the > devarg_list, it will have no chance to be freed. > > This patch adds additional memory free for device structure member devargs > in the secondary process in rte_vdev_uninit. > > Fixes: f5b2eff0847d ("bus/vdev: fix devargs after multi-process bus scan") > Cc: stable@dpdk.org > > Signed-off-by: Wenjun Wu > --- > drivers/bus/vdev/vdev.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c > index 7974b27295..3f4e6a1b55 100644 > --- a/drivers/bus/vdev/vdev.c > +++ b/drivers/bus/vdev/vdev.c > @@ -373,6 +373,11 @@ rte_vdev_uninit(const char *name) > > TAILQ_REMOVE(&vdev_device_list, dev, next); > rte_devargs_remove(dev->device.devargs); > + if (rte_eal_process_type() == RTE_PROC_SECONDARY && > + dev->device.devargs != NULL) { The prerequisite is that rte_vdev_init is invoked only in main process. Suggest more general impl: ret = rte_devargs_remove(dev->device.devargs); if (ret != 0) { rte_devargs_reset(dev->device.devargs); free(dev->device.devargs); } > + rte_devargs_reset(dev->device.devargs); > + free(dev->device.devargs); > + } > free(dev); > > unlock: >