Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: btintel_pcie: Clear bus master before freeing DMA buffers
@ 2026-11-30  0:32 Yuho Choi
  0 siblings, 0 replies; only message in thread
From: Yuho Choi @ 2026-11-30  0:32 UTC (permalink / raw)
  To: Marcel Holtmann, Luiz Augusto von Dentz
  Cc: Kiran K, Ajaykv, Tedd Ho-Jeong An, linux-bluetooth, linux-kernel,
	Yuho Choi

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@gmail.com>
---
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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-30  0:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30  0:32 [PATCH] Bluetooth: btintel_pcie: Clear bus master before freeing DMA buffers Yuho Choi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox