summaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorZhengping Jiang <jiangzp@google.com>2022-06-13 14:43:27 -0700
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2022-07-21 17:07:50 -0700
commitd7b2fdfb53ea09382941c0a4950dc9b00d51d1c7 (patch)
treef1674a8c51d88d78b453e6c641f93e06bb27fe5e /net/bluetooth
parent34a718bc86f908de8ef79affaff6a3de7b95759c (diff)
downloadlinux-d7b2fdfb53ea09382941c0a4950dc9b00d51d1c7.tar.gz
linux-d7b2fdfb53ea09382941c0a4950dc9b00d51d1c7.tar.bz2
linux-d7b2fdfb53ea09382941c0a4950dc9b00d51d1c7.zip
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") Signed-off-by: Zhengping Jiang <jiangzp@google.com> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/mgmt.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index ed8cd4a81ed3..f3e4e2c9ec7a 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -6821,11 +6821,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,
@@ -6837,9 +6840,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 */