Linux bluetooth development
 help / color / mirror / Atom feed
From: Yuho Choi <oss.patchbox@gmail.com>
To: Marcel Holtmann <marcel@holtmann.org>,
	Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: Kiran K <kiran.k@intel.com>, Ajaykv <ajay.k.v@intel.com>,
	Tedd Ho-Jeong An <tedd.an@intel.com>,
	linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org,
	Yuho Choi <oss.patchbox@gmail.com>
Subject: [PATCH] Bluetooth: btintel_pcie: Clear bus master before freeing DMA buffers
Date: Mon, 30 Nov 2026 00:32:52 +0000	[thread overview]
Message-ID: <20261130003300.1166041-2-oss.patchbox@gmail.com> (raw)

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


                 reply	other threads:[~2026-11-30  0:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261130003300.1166041-2-oss.patchbox@gmail.com \
    --to=oss.patchbox@gmail.com \
    --cc=ajay.k.v@intel.com \
    --cc=kiran.k@intel.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=marcel@holtmann.org \
    --cc=tedd.an@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox