From patchwork Wed Jul 5 09:25:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wenjun Wu X-Patchwork-Id: 129277 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EFDB542DCC; Wed, 5 Jul 2023 11:23:01 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EEF2340FAE; Wed, 5 Jul 2023 11:22:59 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id A274B40FAE; Wed, 5 Jul 2023 11:22:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1688548978; x=1720084978; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5oufmE4eyZnV6LisqjY+exu9skdq/K5qpe3iT7gArus=; b=PJl/XvN58X9rOcc3NWFjuUiN9vvfhY5UlJN1+hMSbeBwYPsexTSTPYB7 AIP8WE5XbDT9utW/AQAS8ewNY8UCYVEIJgvOO4DHtAhZlvOjl4isKPQHp PSnU/Ylwq8y+p3cayv1J4UoyeVQLIQVLxl4buie3EDcLCm6z8IuInwuL2 OxTw2rFx/Np38gZh2moKcVcMGYqvUY22gGencAFOBRk7ibJsBX1oFM8KV 5kvSSTXyzXHN+dZMl2j7sMVjONRHhNA0N26HU5TbkPYi5URO+62bnukWB 9Ox5beP4tFTQypYEhPTZWZztlsipg/v+pV63rQvtDex6vAR6IAFTBoU6z Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10761"; a="353122495" X-IronPort-AV: E=Sophos;i="6.01,182,1684825200"; d="scan'208";a="353122495" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jul 2023 02:22:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10761"; a="669340944" X-IronPort-AV: E=Sophos;i="6.01,182,1684825200"; d="scan'208";a="669340944" Received: from dpdk-wuwenjun-icelake-ii.sh.intel.com ([10.67.110.188]) by orsmga003.jf.intel.com with ESMTP; 05 Jul 2023 02:22:55 -0700 From: Wenjun Wu To: dev@dpdk.org, anatoly.burakov@intel.com, qi.z.zhang@intel.com Cc: simei.su@intel.com, Wenjun Wu , stable@dpdk.org Subject: [PATCH v1 1/2] bus/vdev: fix memory leak Date: Wed, 5 Jul 2023 17:25:10 +0800 Message-Id: <20230705092511.362484-2-wenjun1.wu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230705092511.362484-1-wenjun1.wu@intel.com> References: <20230705092511.362484-1-wenjun1.wu@intel.com> MIME-Version: 1.0 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 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) { + rte_devargs_reset(dev->device.devargs); + free(dev->device.devargs); + } free(dev); unlock: