* [PATCH v3] Bluetooth: btintel_pcie: Fix DMA memory leak on probe failure
@ 2026-07-15 6:46 Zhao Dongdong
2026-07-15 8:58 ` [v3] " bluez.test.bot
0 siblings, 1 reply; 2+ messages in thread
From: Zhao Dongdong @ 2026-07-15 6:46 UTC (permalink / raw)
To: marcel, luiz.dentz; +Cc: linux-bluetooth, linux-kernel, Zhao Dongdong
From: Zhao Dongdong <zhaodongdong@kylinos.cn>
In btintel_pcie_probe(), when btintel_pcie_alloc() succeeds but a
later step (btintel_pcie_enable_bt, btintel_pcie_start_rx, or
btintel_pcie_setup_hdev) fails, the DMA buffers and descriptors
allocated by btintel_pcie_alloc() are not freed. The exit_error
path only resets the device and destroys workqueues, causing a
DMA memory leak.
Fix this by calling btintel_pcie_free(data) after btintel_pcie_reset_bt()
to release all DMA buffers and the DMA pool. A NULL guard is added
in btintel_pcie_free() and data->dma_pool is cleared after any
partial allocation failure in btintel_pcie_alloc(), making the
unconditional free() call safe on all error paths.
Fixes: c2b636b3f788 ("Bluetooth: btintel_pcie: Add support for PCIe transport")
Signed-off-by: Zhao Dongdong <zhaodongdong@kylinos.cn>
---
v3: Pull latest repo and fix patches.
v2: https://lore.kernel.org/linux-bluetooth/tencent_9EDB39EF4A8A9D6EF645A7DC2F32B25CA209@qq.com/
v1: https://lore.kernel.org/linux-bluetooth/tencent_44ED865C14DA3D3823CA85AE1DF2CEBC1805@qq.com/
---
drivers/bluetooth/btintel_pcie.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c
index 013568197a39..6d578659a689 100644
--- a/drivers/bluetooth/btintel_pcie.c
+++ b/drivers/bluetooth/btintel_pcie.c
@@ -1982,6 +1982,9 @@ static int btintel_pcie_setup_rxq_bufs(struct btintel_pcie_data *data,
static void btintel_pcie_free(struct btintel_pcie_data *data)
{
+ if (!data->dma_pool)
+ return;
+
btintel_pcie_free_rxq_bufs(data, &data->rxq);
btintel_pcie_free_txq_bufs(data, &data->txq);
@@ -2042,6 +2045,7 @@ static int btintel_pcie_alloc(struct btintel_pcie_data *data)
&p_addr);
if (!v_addr) {
dma_pool_destroy(data->dma_pool);
+ data->dma_pool = NULL;
err = -ENOMEM;
goto exit_error;
}
@@ -2134,6 +2138,7 @@ static int btintel_pcie_alloc(struct btintel_pcie_data *data)
exit_error_pool:
dma_pool_free(data->dma_pool, data->dma_v_addr, data->dma_p_addr);
dma_pool_destroy(data->dma_pool);
+ data->dma_pool = NULL;
exit_error:
return err;
}
@@ -2989,6 +2994,7 @@ static int btintel_pcie_probe(struct pci_dev *pdev,
exit_error:
/* reset device before exit */
btintel_pcie_reset_bt(data);
+ btintel_pcie_free(data);
destroy_workqueue(data->dump_workqueue);
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [v3] Bluetooth: btintel_pcie: Fix DMA memory leak on probe failure
2026-07-15 6:46 [PATCH v3] Bluetooth: btintel_pcie: Fix DMA memory leak on probe failure Zhao Dongdong
@ 2026-07-15 8:58 ` bluez.test.bot
0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2026-07-15 8:58 UTC (permalink / raw)
To: linux-bluetooth, winter91
[-- Attachment #1: Type: text/plain, Size: 1181 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1127925
---Test result---
Test Summary:
CheckPatch PASS 0.56 seconds
VerifyFixes PASS 0.08 seconds
VerifySignedoff PASS 0.07 seconds
GitLint PASS 0.22 seconds
SubjectPrefix PASS 0.07 seconds
BuildKernel PASS 27.29 seconds
CheckAllWarning PASS 29.91 seconds
CheckSparse PASS 28.56 seconds
BuildKernel32 PASS 26.54 seconds
CheckKernelLLVM SKIP 0.00 seconds
TestRunnerSetup PASS 503.17 seconds
IncrementalBuild PASS 25.82 seconds
Details
##############################
Test: CheckKernelLLVM - SKIP
Desc: Build kernel with LLVM + context analysis
Output:
Clang not found
https://github.com/bluez/bluetooth-next/pull/441
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-15 8:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-15 6:46 [PATCH v3] Bluetooth: btintel_pcie: Fix DMA memory leak on probe failure Zhao Dongdong
2026-07-15 8:58 ` [v3] " bluez.test.bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox