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 73234A0584; Wed, 19 Oct 2022 14:34:51 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 17DD7427F3; Wed, 19 Oct 2022 14:34:51 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id A8BDE410D1 for ; Wed, 19 Oct 2022 14:34:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666182889; x=1697718889; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Um8U77rly2FlTpZDoHotqA8azJMNNalqFdyyJ86AIF8=; b=VY85DrUGqajB+U21CcUdDFtYHjWk8ognefgIh7ha5c52Gf3uiDompQAh mz0yAm8dR7H+BUc6zF4dbNW8rFISLhqF1rG+2Ty9F7nH7mJzGelsSGeOE pX6Q49EPNqam6aV5sZmdD6iEGGbT9GpwuF63yNL+rxd+rFrYl2Rng9L9j 38AMXvSZh2LBfywwt/1HoT2oRFsaTsvvs35D+ZU6+8oS6UoUvu4bwik5A /OY7fyevswWjl5zKF2k/4DXpRTyEObvAobL1kvkVaToE4NUZTr1CzNinf lozGl6RQQovz6OQuKi3ChjbBZyIH91KiQhRPZl8ezE8lUMQpjK62mZjuG g==; X-IronPort-AV: E=McAfee;i="6500,9779,10504"; a="307503919" X-IronPort-AV: E=Sophos;i="5.95,196,1661842800"; d="scan'208";a="307503919" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2022 05:34:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10504"; a="662443339" X-IronPort-AV: E=Sophos;i="5.95,196,1661842800"; d="scan'208";a="662443339" Received: from silpixa00401122.ir.intel.com ([10.243.22.75]) by orsmga001.jf.intel.com with ESMTP; 19 Oct 2022 05:34:47 -0700 From: Kevin Laatz To: dev@dpdk.org Cc: Kevin Laatz , =?UTF-8?q?Morten=20Br=C3=B8rup?= , Bruce Richardson Subject: [PATCH v2] bus: fix memleak during pci device cleanup Date: Wed, 19 Oct 2022 13:37:43 +0100 Message-Id: <20221019123743.1282969-1-kevin.laatz@intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221019104923.1240394-1-kevin.laatz@intel.com> References: <20221019104923.1240394-1-kevin.laatz@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 During PCI bus device cleanup some interrupt handle pointers and the bus_info pointer are not being free'd, leading to memory leaks. This patch fixes the memory leaks by ensuring they are free'd during device cleanup on exit. Fixes: 1cab1a40ea9b ("bus: cleanup devices on shutdown") Signed-off-by: Kevin Laatz --- v2: remove redundant NULL checks --- drivers/bus/pci/pci_common.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c index 7f598667fe..71cd3f59ad 100644 --- a/drivers/bus/pci/pci_common.c +++ b/drivers/bus/pci/pci_common.c @@ -456,6 +456,16 @@ pci_cleanup(void) } dev->driver = NULL; dev->device.driver = NULL; + + /* free interrupt handles */ + rte_intr_instance_free(dev->intr_handle); + dev->intr_handle = NULL; + rte_intr_instance_free(dev->vfio_req_intr_handle); + dev->vfio_req_intr_handle = NULL; + + free(dev->bus_info); + dev->bus_info = NULL; + free(dev); } -- 2.31.1