Skip to contentSkip to conversation

Bluetooth: hci_sync: Fix queuing commands when HCI_UNREGISTER is set

PATCH In review Luiz Augusto von Dentz 3 participants 3 messages Jan 27, 2022

Subsystems (2)
lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 Bluetooth: hci_sync: Fix queuing commands when HCI_UNREGISTER is set

From: Luiz Augusto von Dentz <[email protected]>

hci_cmd_sync_queue shall return an error if HCI_UNREGISTER flag has been set as that means hci_unregister_dev has been called so it will likely cause a uaf after the timeout as the hdev will be freed.

---
 net/bluetooth/hci_sync.c | 3 +++
 1 file changed, 3 insertions(+)
net/bluetooth/hci_sync.c +3 -0
index 87c46b04b9ff..af16b1018c35 100644
@@ -382,6 +382,9 @@ int hci_cmd_sync_queue(struct hci_dev *hdev, hci_cmd_sync_work_func_t func,
 {
 	struct hci_cmd_sync_work_entry *entry;
 
+	if (hci_dev_test_flag(hdev, HCI_UNREGISTER))
+		return -ENODEV;
+
 	entry = kmalloc(sizeof(*entry), GFP_KERNEL);
 	if (!entry)
 		return -ENOMEM;
Signature · 1 line
2.34.1
#1 lore raw

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=608888

---Test result---

Test Summary:

CheckPatch                    PASS      0.76 seconds
GitLint                       PASS      0.40 seconds
SubjectPrefix                 PASS      0.22 seconds
BuildKernel                   PASS      38.03 seconds
BuildKernel32                 PASS      34.01 seconds
Incremental Build with patchesPASS      45.70 seconds
TestRunner: Setup             PASS      587.10 seconds
TestRunner: l2cap-tester      PASS      15.08 seconds
TestRunner: bnep-tester       PASS      6.72 seconds
TestRunner: mgmt-tester       PASS      122.54 seconds
TestRunner: rfcomm-tester     PASS      8.72 seconds
TestRunner: sco-tester        PASS      9.04 seconds
TestRunner: smp-tester        PASS      8.86 seconds
TestRunner: userchan-tester   PASS      7.34 seconds

---
Regards,
Linux Bluetooth

maintainer
#2 lore raw
In reply to Luiz Augusto von Dentz

Hi Luiz,

Quoted 8 lines

hci_cmd_sync_queue shall return an error if HCI_UNREGISTER flag has been set as that means hci_unregister_dev has been called so it will likely cause a uaf after the timeout as the hdev will be freed.

---
net/bluetooth/hci_sync.c | 3 +++

1 file changed, 3 insertions(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel