From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5CE8C253F0E; Thu, 3 Apr 2025 19:02:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743706940; cv=none; b=G7GKKQpRKAWrD/9B13lVw3gXrNK4xTFjplI7TFIJBjWFsuvmXJQCHO+GxtWSnwia7HYYF89eO7ayVAAhAfyGpu6+1Di8MQ6gr7JTgoUxGsiLWc37134dn6gmgcPcW12cCHTktq5UH42oa90qVrBLt5i3+wW1HGoIpKIhCaxn7zQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743706940; c=relaxed/simple; bh=NEE8XyyBTIzK9+F1SjLTLthFKKuHvJLm8dwTdO5OlAI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=GISN/XqaZcoOdHyJpvw/4NmA4gnBQWtJEUxNmik3MK7RgugBGuFrnV2A08kDnW3mEj0/9epW4TT1IcRuz9bmtZwegG4M/EIvaAj81kuj/SDaMSm+Y3SqkEwT9MUw2wsLfInw/QN8g3O5NuQlAkxun9GcFFjPlh7MKvAP5HSsL3I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=K6ucFMMA; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="K6ucFMMA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50752C4CEEA; Thu, 3 Apr 2025 19:02:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743706940; bh=NEE8XyyBTIzK9+F1SjLTLthFKKuHvJLm8dwTdO5OlAI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K6ucFMMAeJ1LR05ByL8m3vyhAGo5m6VYmuG3G5g+MHi2Pm6cPaD0mPWZqntU+kZSW Mcw5fKP43TS1EZkJIYOAAw0WPQgdA+z9DMtQ3dCaxUmRnc4F32PxmM/IhrnByG8opr x9ueVZPQWD4lEcDQox7MAUJH3lf+bpJ3WzmXvOq+35DLZikXaCgc0MaMLAHV9wxoTt 7AIjteSrLu3JfXiXZ6QfAdfy3fcGxeDOlhFrLPODAuxcfM+owaTjC4aQTyId7Ol8x1 0MnxyPXmhkrga2tiRHEGs8Pb8Em5oDoXkj44SLfl260IuwjWYz8VodbzaMci6pRipv /9H6/zztyJThA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Miaoqing Pan , Aditya Kumar Singh , Jeff Johnson , Sasha Levin , jjohnson@kernel.org, ath12k@lists.infradead.org Subject: [PATCH AUTOSEL 6.14 04/54] wifi: ath12k: fix memory leak in ath12k_pci_remove() Date: Thu, 3 Apr 2025 15:01:19 -0400 Message-Id: <20250403190209.2675485-4-sashal@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250403190209.2675485-1-sashal@kernel.org> References: <20250403190209.2675485-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.14 Content-Transfer-Encoding: 8bit From: Miaoqing Pan [ Upstream commit 1b24394ed5c8a8d8f7b9e3aa9044c31495d46f2e ] Kmemleak reported this error: unreferenced object 0xffff1c165cec3060 (size 32): comm "insmod", pid 560, jiffies 4296964570 (age 235.596s) backtrace: [<000000005434db68>] __kmem_cache_alloc_node+0x1f4/0x2c0 [<000000001203b155>] kmalloc_trace+0x40/0x88 [<0000000028adc9c8>] _request_firmware+0xb8/0x608 [<00000000cad1aef7>] firmware_request_nowarn+0x50/0x80 [<000000005011a682>] local_pci_probe+0x48/0xd0 [<00000000077cd295>] pci_device_probe+0xb4/0x200 [<0000000087184c94>] really_probe+0x150/0x2c0 The firmware memory was allocated in ath12k_pci_probe(), but not freed in ath12k_pci_remove() in case ATH12K_FLAG_QMI_FAIL bit is set. So call ath12k_fw_unmap() to free the memory. Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.2.0-02280-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1 Signed-off-by: Miaoqing Pan Reviewed-by: Aditya Kumar Singh Link: https://patch.msgid.link/20250123080226.1116479-1-quic_miaoqing@quicinc.com Signed-off-by: Jeff Johnson Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath12k/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath12k/pci.c b/drivers/net/wireless/ath/ath12k/pci.c index 06cff3849ab8d..ee61afe564b92 100644 --- a/drivers/net/wireless/ath/ath12k/pci.c +++ b/drivers/net/wireless/ath/ath12k/pci.c @@ -1734,9 +1734,9 @@ static void ath12k_pci_remove(struct pci_dev *pdev) cancel_work_sync(&ab->reset_work); cancel_work_sync(&ab->dump_work); ath12k_core_deinit(ab); - ath12k_fw_unmap(ab); qmi_fail: + ath12k_fw_unmap(ab); ath12k_mhi_unregister(ab_pci); ath12k_pci_free_irq(ab); -- 2.39.5