Skip to contentSkip to conversation

Bluetooth: mgmt: Fix wrong param be used

PATCH In review [email protected] 3 participants 3 messages Feb 29, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bluetooth: mgmt: Fix wrong param be used

From: Clancy Shang <[email protected]>

if the BlueZ library calls the API interface "adapter_set_device_flags", which sends the "MGMT_OP_SET_DEVICE_FLAGS" opcode to the kernel, but does not receive the callback message "MGMT_EV_DEVICE_FLAGS_CHANGED" from the kernel. it fixs this bug.

---
 net/bluetooth/mgmt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/mgmt.c +1 -1
index 9dd815b6603f..c74abdf3618f 100644
@@ -5177,7 +5177,7 @@ static int set_device_flags(struct sock *sk, struct hci_dev *hdev, void *data,
 
 done:
 	if (status == MGMT_STATUS_SUCCESS)
-		device_flags_changed(sk, hdev, &cp->addr.bdaddr, cp->addr.type,
+		device_flags_changed(NULL, hdev, &cp->addr.bdaddr, cp->addr.type,
 				     supported_flags, current_flags);
 
 	return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_SET_DEVICE_FLAGS, status,
Signature · 1 line
2.25.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=831013

---Test result---

Test Summary:

CheckPatch                    PASS      0.48 seconds
GitLint                       PASS      0.21 seconds
SubjectPrefix                 PASS      0.06 seconds
BuildKernel                   PASS      28.00 seconds
CheckAllWarning               PASS      30.85 seconds
CheckSparse                   PASS      36.39 seconds
CheckSmatch                   PASS      99.08 seconds
BuildKernel32                 PASS      27.03 seconds
TestRunnerSetup               PASS      502.24 seconds
TestRunner_l2cap-tester       PASS      19.46 seconds
TestRunner_iso-tester         PASS      32.42 seconds
TestRunner_bnep-tester        PASS      4.74 seconds
TestRunner_mgmt-tester        PASS      109.42 seconds
TestRunner_rfcomm-tester      PASS      8.42 seconds
TestRunner_sco-tester         PASS      14.95 seconds
TestRunner_ioctl-tester       PASS      7.88 seconds
TestRunner_mesh-tester        PASS      5.90 seconds
TestRunner_smp-tester         PASS      6.91 seconds
TestRunner_userchan-tester    PASS      5.01 seconds
IncrementalBuild              PASS      26.91 seconds

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to [email protected]

Hi,

Quoted 7 lines · On Thu, Feb 29, 2024 at 3:41 AM <[email protected]> wrote:

From: Clancy Shang <[email protected]>

if the BlueZ library calls the API interface "adapter_set_device_flags", which sends the "MGMT_OP_SET_DEVICE_FLAGS" opcode to the kernel, but does not receive the callback message "MGMT_EV_DEVICE_FLAGS_CHANGED" from the kernel. it fixs this bug.

Please stop sending this change, the client who sent MGMT_OP_SET_DEVICE_FLAGS is not supposed to get MGMT_EV_DEVICE_FLAGS_CHANGED back:

https://github.com/bluez/bluez/blob/master/doc/mgmt-api.txt#L4975

If there is a problem with that then perhaps it is in userspace not setting the flag on command complete.

Quoted 21 lines
---
 net/bluetooth/mgmt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/mgmt.c +1 -2
index 9dd815b6603f..c74abdf3618f 100644
@@ -5177,7 +5177,7 @@ static int set_device_flags(struct sock *sk, struct hci_dev *hdev, void *data,
 
 done:
        if (status == MGMT_STATUS_SUCCESS)
-               device_flags_changed(sk, hdev, &cp->addr.bdaddr, cp->addr.type,
+               device_flags_changed(NULL, hdev, &cp->addr.bdaddr, cp->addr.type,
                                     supported_flags, current_flags);
 
        return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_SET_DEVICE_FLAGS, status,
--

2.25.1

Signature · 1 line
Luiz Augusto von Dentz