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 AF748A04FD; Sun, 3 Jul 2022 14:22:21 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8086A4284D; Sun, 3 Jul 2022 14:22:15 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id A8A6741132; Sun, 3 Jul 2022 14:22:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656850932; x=1688386932; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=oeaWO04MyJegroPDunsWKxL51hVWJ3PaVSOmiWqCj7A=; b=aaLiTzKugFEMShI5VIZHtu8+o2Omf2w6wD9jpBb7v+TJ4U7nWr6Y9iHR uEo90woXEzRRK/0CNZnKgbRPbFl0M+kza2v++FcP1yHfhaNI9a+h8g6uw b2je55QdAaC3nz18Eys1HKvFkIugidz7VvYjyNnNVClhVuEoFxdY4/uFV mH45O0T3l1v61NICSap2dKAUp9Zki5lKWFIfCAQVN/zq8rd9J6NxVDwhx kur16ajWR4nuL/QE4JM9plZqWmnfOHclq8pUIpdA+waMTVXO5WA4ngmfT is2oO/HO952OLTkv1Xxz0XsRjxHDxuM3GU4cR8ztxuYc+bq8OBV75X71B A==; X-IronPort-AV: E=McAfee;i="6400,9594,10396"; a="262737109" X-IronPort-AV: E=Sophos;i="5.92,241,1650956400"; d="scan'208";a="262737109" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jul 2022 05:22:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,241,1650956400"; d="scan'208";a="618931240" Received: from silpixa00401122.ir.intel.com ([10.237.213.29]) by orsmga008.jf.intel.com with ESMTP; 03 Jul 2022 05:22:10 -0700 From: Kevin Laatz To: dev@dpdk.org Cc: bruce.richardson@intel.com, Kevin Laatz , stable@dpdk.org Subject: [PATCH v2 2/3] dma/idxd: fix memory leak due to free on incorrect pointer Date: Sun, 3 Jul 2022 13:22:42 +0100 Message-Id: <20220703122243.929642-3-kevin.laatz@intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220703122243.929642-1-kevin.laatz@intel.com> References: <20220408141504.1319913-1-kevin.laatz@intel.com> <20220703122243.929642-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 device close, any allocated memory needs to be free'd. Currently, one of the free's is being called on an incorrect idxd_dmadev struct member, namely 'batch_idx_ring', causing a memleak from the pointer that should have been free'd. This patch fixes this memleak by calling free on the correct pointer. Fixes: 9449330a8458 ("dma/idxd: create dmadev instances on PCI probe") Cc: stable@dpdk.org Cc: bruce.richardson@intel.com Signed-off-by: Kevin Laatz --- drivers/dma/idxd/idxd_pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/idxd/idxd_pci.c b/drivers/dma/idxd/idxd_pci.c index 918981f2ea..9349c56b3f 100644 --- a/drivers/dma/idxd/idxd_pci.c +++ b/drivers/dma/idxd/idxd_pci.c @@ -130,7 +130,7 @@ idxd_pci_dev_close(struct rte_dma_dev *dev) /* free device memory */ IDXD_PMD_DEBUG("Freeing device driver memory"); - rte_free(idxd->batch_idx_ring); + rte_free(idxd->batch_comp_ring); rte_free(idxd->desc_ring); /* if this is the last WQ on the device, disable the device and free -- 2.31.1