public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] adapter: Cancel the service authorization when remote is disconnected
@ 2024-09-22  3:04 Cheng Jiang
  2024-09-22  4:43 ` [v3] " bluez.test.bot
  2024-09-23 14:50 ` [PATCH v3] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Cheng Jiang @ 2024-09-22  3:04 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: quic_jiaymao

If the remote device drops the connection before DUT confirm the
service authorization, the DUT still must wait for service
authorization timeout before processing future request.

Cancel the service authorization request when connection is dropped.
---
 src/adapter.c | 44 ++++++++++++++++++++++++--------------------
 src/adapter.h |  2 ++
 src/device.c  |  3 +++
 3 files changed, 29 insertions(+), 20 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index 6fbfcdf2e..2bb94cf16 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1420,8 +1420,6 @@ static void adapter_remove_device(struct btd_adapter *adapter,
 void btd_adapter_remove_device(struct btd_adapter *adapter,
 				struct btd_device *dev)
 {
-	GList *l;
-
 	adapter->connect_list = g_slist_remove(adapter->connect_list, dev);
 
 	adapter_remove_device(adapter, dev);
@@ -1435,22 +1433,7 @@ void btd_adapter_remove_device(struct btd_adapter *adapter,
 	if (adapter->connect_le == dev)
 		adapter->connect_le = NULL;
 
-	l = adapter->auths->head;
-	while (l != NULL) {
-		struct service_auth *auth = l->data;
-		GList *next = g_list_next(l);
-
-		if (auth->device != dev) {
-			l = next;
-			continue;
-		}
-
-		g_queue_delete_link(adapter->auths, l);
-		l = next;
-
-		service_auth_cancel(auth);
-	}
-
+	btd_adapter_cancel_service_auth(adapter, dev);
 	device_remove(dev, TRUE);
 }
 
@@ -7538,8 +7521,7 @@ static void adapter_remove_connection(struct btd_adapter *adapter,
 
 	device_remove_connection(device, bdaddr_type, &remove_device);
 
-	if (device_is_authenticating(device))
-		device_cancel_authentication(device, TRUE);
+	device_cancel_authentication(device, TRUE);
 
 	/* If another bearer is still connected */
 	if (btd_device_bearer_is_connected(device))
@@ -10905,3 +10887,25 @@ bool btd_adapter_has_exp_feature(struct btd_adapter *adapter, uint32_t feature)
 
 	return false;
 }
+
+void btd_adapter_cancel_service_auth(struct btd_adapter *adapter,
+			struct btd_device *device)
+{
+	GList *l;
+
+	l = adapter->auths->head;
+	while (l != NULL) {
+		struct service_auth *auth = l->data;
+		GList *next = g_list_next(l);
+
+		if (auth->device != device) {
+			l = next;
+			continue;
+		}
+
+		g_queue_delete_link(adapter->auths, l);
+		l = next;
+
+		service_auth_cancel(auth);
+	}
+}
diff --git a/src/adapter.h b/src/adapter.h
index e3695b21b..8dfbe762e 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -298,3 +298,5 @@ void btd_adapter_store_conn_param(struct btd_adapter *adapter,
 				const bdaddr_t *peer, uint8_t bdaddr_type,
 				uint16_t min_interval, uint16_t max_interval,
 				uint16_t latency, uint16_t timeout);
+void btd_adapter_cancel_service_auth(struct btd_adapter *adapter,
+				struct btd_device *device);
diff --git a/src/device.c b/src/device.c
index 8cba804ce..f8f61e643 100644
--- a/src/device.c
+++ b/src/device.c
@@ -7038,6 +7038,9 @@ void device_cancel_authentication(struct btd_device *device, gboolean aborted)
 	struct authentication_req *auth = device->authr;
 	char addr[18];
 
+	if (device->adapter)
+		btd_adapter_cancel_service_auth(device->adapter, device);
+
 	if (!auth)
 		return;
 
-- 
2.25.1


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

* RE: [v3] adapter: Cancel the service authorization when remote is disconnected
  2024-09-22  3:04 [PATCH v3] adapter: Cancel the service authorization when remote is disconnected Cheng Jiang
@ 2024-09-22  4:43 ` bluez.test.bot
  2024-09-23 14:50 ` [PATCH v3] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2024-09-22  4:43 UTC (permalink / raw)
  To: linux-bluetooth, quic_chejiang

[-- Attachment #1: Type: text/plain, Size: 949 bytes --]

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

---Test result---

Test Summary:
CheckPatch                    PASS      0.33 seconds
GitLint                       PASS      0.21 seconds
BuildEll                      PASS      24.17 seconds
BluezMake                     PASS      1509.41 seconds
MakeCheck                     PASS      13.26 seconds
MakeDistcheck                 PASS      176.21 seconds
CheckValgrind                 PASS      248.79 seconds
CheckSmatch                   PASS      349.19 seconds
bluezmakeextell               PASS      117.72 seconds
IncrementalBuild              PASS      1390.41 seconds
ScanBuild                     PASS      1014.84 seconds



---
Regards,
Linux Bluetooth


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

* Re: [PATCH v3] adapter: Cancel the service authorization when remote is disconnected
  2024-09-22  3:04 [PATCH v3] adapter: Cancel the service authorization when remote is disconnected Cheng Jiang
  2024-09-22  4:43 ` [v3] " bluez.test.bot
@ 2024-09-23 14:50 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2024-09-23 14:50 UTC (permalink / raw)
  To: Cheng Jiang; +Cc: linux-bluetooth, quic_jiaymao

Hello:

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

On Sun, 22 Sep 2024 11:04:17 +0800 you wrote:
> If the remote device drops the connection before DUT confirm the
> service authorization, the DUT still must wait for service
> authorization timeout before processing future request.
> 
> Cancel the service authorization request when connection is dropped.
> ---
>  src/adapter.c | 44 ++++++++++++++++++++++++--------------------
>  src/adapter.h |  2 ++
>  src/device.c  |  3 +++
>  3 files changed, 29 insertions(+), 20 deletions(-)

Here is the summary with links:
  - [v3] adapter: Cancel the service authorization when remote is disconnected
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=5b6ffe0381e8

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] 3+ messages in thread

end of thread, other threads:[~2024-09-23 14:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-22  3:04 [PATCH v3] adapter: Cancel the service authorization when remote is disconnected Cheng Jiang
2024-09-22  4:43 ` [v3] " bluez.test.bot
2024-09-23 14:50 ` [PATCH v3] " 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