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 2A6FAA050B for ; Fri, 8 Apr 2022 16:15:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 20612427F0; Fri, 8 Apr 2022 16:15:03 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 65CD04003F; Fri, 8 Apr 2022 16:15:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649427300; x=1680963300; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=v7rIibFWCp95otrtAI1lbOqedk/aGJhQcoWpfRV5R1Q=; b=R+9D7zMCxIg3El8duQOMy7GTfXZE3M9lYYUJOWCl/FuZyQxtCt6cIKlU vlb4eJ7Mj6WP3XPCaT5amDPrYUZ6MCfARWyr3imqzQfy5Zt01R8ydK3jS Eb8iW33EXrruaRem0KD+UUW9OfxlvcH4hAARYYwmihCKJ6j7sG3mAQQEf b8XbQJO5bv0jMEbKGX4SrWuKMcGIGaYfX2gI75AdQPKuLEdgNtPwrjR81 YQyWBG/GQpLT1toyqNNlYZil0X0X/4xaYVdTfuVUtEoKNl74zBlVokE/F t4zTEX+JIr//12jLMerc4IXpGYCOFD77n1BGpqhrhrYIVH/0Wkp0BEFsR w==; X-IronPort-AV: E=McAfee;i="6400,9594,10310"; a="324762470" X-IronPort-AV: E=Sophos;i="5.90,245,1643702400"; d="scan'208";a="324762470" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Apr 2022 07:14:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,245,1643702400"; d="scan'208";a="852083825" Received: from silpixa00401122.ir.intel.com ([10.55.128.10]) by fmsmga005.fm.intel.com with ESMTP; 08 Apr 2022 07:14:58 -0700 From: Kevin Laatz To: dev@dpdk.org Cc: Kevin Laatz , stable@dpdk.org, bruce.richardson@intel.com, Conor Walsh Subject: [PATCH 2/5] dma/idxd: fix memory leak due to free on incorrect pointer Date: Fri, 8 Apr 2022 15:15:01 +0100 Message-Id: <20220408141504.1319913-3-kevin.laatz@intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220408141504.1319913-1-kevin.laatz@intel.com> References: <20220408141504.1319913-1-kevin.laatz@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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 7036eb938d..fdb1f15750 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