[PATCH] Bluetooth: btintel_pcie: Clear bus master before freeing DMA buffers

From: Yuho Choi

Date: Sun Nov 29 2026 - 19:33:11 EST


btintel_pcie_remove() and the probe error path free the RX/TX buffers
and the DMA pool before calling pci_clear_master(). The result of
btintel_pcie_reset_bt() is ignored there, so a controller that failed
to reset can still write to the freed buffers. Clear bus master before
freeing them.

Fixes: c2b636b3f788 ("Bluetooth: btintel_pcie: Add support for PCIe transport")
Fixes: 8bb9a261e856 ("Bluetooth: btintel_pcie: Add initial YoYo debug support")
Signed-off-by: Yuho Choi <oss.patchbox@xxxxxxxxx>
---
I used an LLM to help write this patch and its changelog.

Compile-tested only: QEMU has no Intel Bluetooth PCIe controller, and
KASAN cannot see writes made by the device. Based on bluetooth-next,
where the probe error path frees the buffers since 8bb9a261e856.

drivers/bluetooth/btintel_pcie.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c
index 3b2c8bbb36e9..ceba0fbc5405 100644
--- a/drivers/bluetooth/btintel_pcie.c
+++ b/drivers/bluetooth/btintel_pcie.c
@@ -4972,14 +4972,14 @@ static int btintel_pcie_probe(struct pci_dev *pdev,
if (pcie_configured)
btintel_pcie_probe_cleanup(data);

+ pci_clear_master(pdev);
+
if (data->pcie_alloc_init)
btintel_pcie_free(data);

destroy_workqueue(data->dump_workqueue);
destroy_workqueue(data->workqueue);

- pci_clear_master(pdev);
-
pci_set_drvdata(pdev, NULL);

return err;
@@ -5043,10 +5043,10 @@ static void btintel_pcie_remove(struct pci_dev *pdev)
destroy_workqueue(data->dump_workqueue);
destroy_workqueue(data->workqueue);

- btintel_pcie_free(data);
-
pci_clear_master(pdev);

+ btintel_pcie_free(data);
+
pci_set_drvdata(pdev, NULL);
}


base-commit: f57f78086ab54f3b3122fbaeba2c842ba7bb6d00
--
2.56.1