* [PATCH] Bluetooth: Free potentially unfreed SCO connection
@ 2023-02-03 9:30 Archie Pusaka
2023-02-03 9:57 ` bluez.test.bot
2023-02-03 20:30 ` [PATCH] " patchwork-bot+bluetooth
0 siblings, 2 replies; 3+ messages in thread
From: Archie Pusaka @ 2023-02-03 9:30 UTC (permalink / raw)
To: linux-bluetooth, Luiz Augusto von Dentz, Marcel Holtmann
Cc: CrosBT Upstreaming, Archie Pusaka, Ying Hsu, David S. Miller,
Eric Dumazet, Jakub Kicinski, Johan Hedberg, Paolo Abeni,
linux-kernel, netdev
From: Archie Pusaka <apusaka@chromium.org>
It is possible to initiate a SCO connection while deleting the
corresponding ACL connection, e.g. in below scenario:
(1) < hci setup sync connect command
(2) > hci disconn complete event (for the acl connection)
(3) > hci command complete event (for(1), failure)
When it happens, hci_cs_setup_sync_conn won't be able to obtain the
reference to the SCO connection, so it will be stuck and potentially
hinder subsequent connections to the same device.
This patch prevents that by also deleting the SCO connection if it is
still not established when the corresponding ACL connection is deleted.
Signed-off-by: Archie Pusaka <apusaka@chromium.org>
Reviewed-by: Ying Hsu <yinghsu@chromium.org>
---
net/bluetooth/hci_conn.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 61a34801e61e..838f51c272a6 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -1061,8 +1061,15 @@ int hci_conn_del(struct hci_conn *conn)
if (conn->type == ACL_LINK) {
struct hci_conn *sco = conn->link;
- if (sco)
+ if (sco) {
sco->link = NULL;
+ /* Due to race, SCO connection might be not established
+ * yet at this point. Delete it now, otherwise it is
+ * possible for it to be stuck and can't be deleted.
+ */
+ if (sco->handle == HCI_CONN_HANDLE_UNSET)
+ hci_conn_del(sco);
+ }
/* Unacked frames */
hdev->acl_cnt += conn->sent;
--
2.39.1.519.gcb327c4b5f-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: Bluetooth: Free potentially unfreed SCO connection
2023-02-03 9:30 [PATCH] Bluetooth: Free potentially unfreed SCO connection Archie Pusaka
@ 2023-02-03 9:57 ` bluez.test.bot
2023-02-03 20:30 ` [PATCH] " patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2023-02-03 9:57 UTC (permalink / raw)
To: linux-bluetooth, apusaka
[-- Attachment #1: Type: text/plain, Size: 1421 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=718492
---Test result---
Test Summary:
CheckPatch PASS 1.04 seconds
GitLint PASS 0.34 seconds
SubjectPrefix PASS 0.11 seconds
BuildKernel PASS 32.67 seconds
CheckAllWarning PASS 35.09 seconds
CheckSparse PASS 40.33 seconds
CheckSmatch PASS 108.31 seconds
BuildKernel32 PASS 31.15 seconds
TestRunnerSetup PASS 446.14 seconds
TestRunner_l2cap-tester PASS 16.98 seconds
TestRunner_iso-tester PASS 17.80 seconds
TestRunner_bnep-tester PASS 5.76 seconds
TestRunner_mgmt-tester PASS 114.33 seconds
TestRunner_rfcomm-tester PASS 9.19 seconds
TestRunner_sco-tester PASS 8.51 seconds
TestRunner_ioctl-tester PASS 10.02 seconds
TestRunner_mesh-tester PASS 7.42 seconds
TestRunner_smp-tester PASS 8.30 seconds
TestRunner_userchan-tester PASS 6.05 seconds
IncrementalBuild PASS 28.98 seconds
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Bluetooth: Free potentially unfreed SCO connection
2023-02-03 9:30 [PATCH] Bluetooth: Free potentially unfreed SCO connection Archie Pusaka
2023-02-03 9:57 ` bluez.test.bot
@ 2023-02-03 20:30 ` patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2023-02-03 20:30 UTC (permalink / raw)
To: Archie Pusaka
Cc: linux-bluetooth, luiz.dentz, marcel,
chromeos-bluetooth-upstreaming, apusaka, yinghsu, davem, edumazet,
kuba, johan.hedberg, 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 Fri, 3 Feb 2023 17:30:55 +0800 you wrote:
> From: Archie Pusaka <apusaka@chromium.org>
>
> It is possible to initiate a SCO connection while deleting the
> corresponding ACL connection, e.g. in below scenario:
>
> (1) < hci setup sync connect command
> (2) > hci disconn complete event (for the acl connection)
> (3) > hci command complete event (for(1), failure)
>
> [...]
Here is the summary with links:
- Bluetooth: Free potentially unfreed SCO connection
https://git.kernel.org/bluetooth/bluetooth-next/c/c2c762af5650
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:[~2023-02-03 20:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-03 9:30 [PATCH] Bluetooth: Free potentially unfreed SCO connection Archie Pusaka
2023-02-03 9:57 ` bluez.test.bot
2023-02-03 20:30 ` [PATCH] " 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).