Skip to contentSkip to conversation

Fix refresh cached connection info

PATCH Applied Zhengping Jiang 3 participants 4 messages Jun 13, 2022 – Jun 21, 2022

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

cover Fix refresh cached connection info

Get connection info will return error when using synchronous hci_sync call to refresh the cached information when the data times out. This is because the cmd->user_data was not set before the call, so it will fail checking connection is still connected.

Changes in v1:
- Set connection data before calling hci_cmd_sync_queue

Zhengping Jiang (1):
Bluetooth: mgmt: Fix refresh cached connection info

 net/bluetooth/mgmt.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
Signature · 1 line
2.36.1.476.g0c4daa206d-goog
#1 lore raw

PATCH 1/1 Bluetooth: mgmt: Fix refresh cached connection info

Set the connection data before calling get_conn_info_sync, so it can be verified the connection is still connected, before refreshing cached values.

Fixes 47db6b42991e6 ("Bluetooth: hci_sync: Convert MGMT_OP_GET_CONN_INFO")

---

Changes in v1:
- Set connection data before calling hci_cmd_sync_queue

 net/bluetooth/mgmt.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
net/bluetooth/mgmt.c +5 -5
index 74937a8346488..cfbea6fa04335 100644
@@ -6828,11 +6828,14 @@ static int get_conn_info(struct sock *sk, struct hci_dev *hdev, void *data,
 
 		cmd = mgmt_pending_new(sk, MGMT_OP_GET_CONN_INFO, hdev, data,
 				       len);
-		if (!cmd)
+		if (!cmd) {
 			err = -ENOMEM;
-		else
+		} else {
+			hci_conn_hold(conn);
+			cmd->user_data = hci_conn_get(conn);
 			err = hci_cmd_sync_queue(hdev, get_conn_info_sync,
 						 cmd, get_conn_info_complete);
+		}
 
 		if (err < 0) {
 			mgmt_cmd_complete(sk, hdev->id, MGMT_OP_GET_CONN_INFO,
@@ -6844,9 +6847,6 @@ static int get_conn_info(struct sock *sk, struct hci_dev *hdev, void *data,
 			goto unlock;
 		}
 
-		hci_conn_hold(conn);
-		cmd->user_data = hci_conn_get(conn);
-
 		conn->conn_info_timestamp = jiffies;
 	} else {
 		/* Cache is valid, just reply with values cached in hci_conn */
Signature · 1 line
2.36.1.476.g0c4daa206d-goog
#2 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=649987

---Test result---

Test Summary:

CheckPatch                    PASS      0.86 seconds
GitLint                       PASS      0.46 seconds
SubjectPrefix                 PASS      0.30 seconds
BuildKernel                   PASS      38.53 seconds
BuildKernel32                 PASS      34.31 seconds
Incremental Build with patchesPASS      45.95 seconds
TestRunner: Setup             PASS      572.80 seconds
TestRunner: l2cap-tester      PASS      19.34 seconds
TestRunner: bnep-tester       PASS      6.96 seconds
TestRunner: mgmt-tester       PASS      116.57 seconds
TestRunner: rfcomm-tester     PASS      10.94 seconds
TestRunner: sco-tester        PASS      10.47 seconds
TestRunner: smp-tester        PASS      10.43 seconds
TestRunner: userchan-tester   PASS      7.09 seconds

---
Regards,
Linux Bluetooth

#3 lore raw
In reply to Zhengping Jiang
This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 9 lines · On Mon, 13 Jun 2022 14:43:26 -0700 you wrote:

Get connection info will return error when using synchronous hci_sync call to refresh the cached information when the data times out. This is because the cmd->user_data was not set before the call, so it will fail checking connection is still connected.

Changes in v1:
- Set connection data before calling hci_cmd_sync_queue

[...]

Here is the summary with links:
- [kernel,v1,1/1] Bluetooth: mgmt: Fix refresh cached connection info

    https://git.kernel.org/bluetooth/bluetooth-next/c/d9cc9d78ca85

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html