linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [kernel PATCH v1 0/1] Fix refresh cached connection info
@ 2022-06-10 19:19 Zhengping Jiang
  2022-06-10 19:19 ` [kernel PATCH v1 1/1] Bluetooth: mgmt: " Zhengping Jiang
  0 siblings, 1 reply; 4+ messages in thread
From: Zhengping Jiang @ 2022-06-10 19:19 UTC (permalink / raw)
  To: linux-bluetooth, marcel
  Cc: chromeos-bluetooth-upstreaming, Zhengping Jiang, Brian Gix,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Johan Hedberg,
	Luiz Augusto von Dentz, Paolo Abeni, linux-kernel, netdev


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(-)

-- 
2.36.1.476.g0c4daa206d-goog


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [kernel PATCH v1 1/1] Bluetooth: mgmt: Fix refresh cached connection info
  2022-06-10 19:19 [kernel PATCH v1 0/1] Fix refresh cached connection info Zhengping Jiang
@ 2022-06-10 19:19 ` Zhengping Jiang
  0 siblings, 0 replies; 4+ messages in thread
From: Zhengping Jiang @ 2022-06-10 19:19 UTC (permalink / raw)
  To: linux-bluetooth, marcel
  Cc: chromeos-bluetooth-upstreaming, Zhengping Jiang, Brian Gix,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Johan Hedberg,
	Luiz Augusto von Dentz, Paolo Abeni, linux-kernel, netdev

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

Changes in v1:
- Set connection data before calling hci_cmd_sync_queue

 net/bluetooth/mgmt.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 74937a8346488..cfbea6fa04335 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -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 */
-- 
2.36.1.476.g0c4daa206d-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [kernel PATCH v1 0/1] Fix refresh cached connection info
  2022-06-13 21:43 [kernel PATCH v1 0/1] " Zhengping Jiang
@ 2022-06-21 19:30 ` patchwork-bot+bluetooth
  0 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2022-06-21 19:30 UTC (permalink / raw)
  To: Zhengping Jiang
  Cc: linux-bluetooth, marcel, chromeos-bluetooth-upstreaming,
	brian.gix, davem, edumazet, kuba, johan.hedberg, luiz.dentz,
	pabeni, linux-kernel, netdev

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [kernel PATCH v1 0/1] Fix refresh cached connection info
@ 2022-06-13 21:43 Zhengping Jiang
  2022-06-21 19:30 ` patchwork-bot+bluetooth
  0 siblings, 1 reply; 4+ messages in thread
From: Zhengping Jiang @ 2022-06-13 21:43 UTC (permalink / raw)
  To: linux-bluetooth, marcel
  Cc: chromeos-bluetooth-upstreaming, Zhengping Jiang, Brian Gix,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Johan Hedberg,
	Luiz Augusto von Dentz, Paolo Abeni, linux-kernel, netdev


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(-)

-- 
2.36.1.476.g0c4daa206d-goog


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-06-21 19:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-10 19:19 [kernel PATCH v1 0/1] Fix refresh cached connection info Zhengping Jiang
2022-06-10 19:19 ` [kernel PATCH v1 1/1] Bluetooth: mgmt: " Zhengping Jiang
2022-06-13 21:43 [kernel PATCH v1 0/1] " Zhengping Jiang
2022-06-21 19:30 ` patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).