From: Hitalo Souza <enghitalo@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: marcel@holtmann.org, luiz.dentz@gmail.com,
linux-kernel@vger.kernel.org, Hitalo Souza <enghitalo@gmail.com>
Subject: [PATCH v2 5/6] Bluetooth: hci_event: Disconnect an ACL link that completes after its abort
Date: Thu, 8 Oct 2026 11:12:37 -0400 [thread overview]
Message-ID: <20261008151238.2138665-6-enghitalo@gmail.com> (raw)
In-Reply-To: <20261008151238.2138665-1-enghitalo@gmail.com>
Since commit a13f316e90fd ("Bluetooth: hci_conn: Consolidate code for
aborting connections"), aborting an ACL connection in BT_CONNECT sends
Create Connection Cancel and deletes the connection. For an incoming
connection that was accepted, e.g. one that MGMT_OP_DISCONNECT aborts
before it completes, the cancel fails at once as the device was never
paged, and the Connection Complete that follows finds no connection and
is ignored. The link then stays up in the controller with nothing to
disconnect it. The same happens with controllers older than 1.2, where
no cancel is sent at all.
Disconnect an ACL link that completes with no connection to take it,
unless an accept list entry makes it an auto-connection, which is
handled as before.
Fixes: a13f316e90fd ("Bluetooth: hci_conn: Consolidate code for aborting connections")
Assisted-by: LLM
Signed-off-by: Hitalo Souza <enghitalo@gmail.com>
---
net/bluetooth/hci_event.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 8f22a4528..b1c107457 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -3301,8 +3301,15 @@ static void hci_conn_complete_evt(struct hci_dev *hdev, void *data,
goto unlock;
}
} else {
- if (ev->link_type != SCO_LINK)
+ if (ev->link_type != SCO_LINK) {
+ /* No connection takes this link, e.g. an
+ * incoming one aborted after it was accepted
+ */
+ hci_disconnect_unused(hdev,
+ __le16_to_cpu(ev->handle),
+ HCI_ERROR_REMOTE_USER_TERM);
goto unlock;
+ }
conn = hci_conn_hash_lookup_ba(hdev, ESCO_LINK,
&ev->bdaddr);
--
2.55.0
next prev parent reply other threads:[~2026-10-08 15:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-08 15:12 [PATCH v2 0/6] Bluetooth: Fix SCO setup failures after an abandoned setup Hitalo Souza
2026-10-08 15:12 ` [PATCH v2 1/6] Bluetooth: hci_event: Don't fail a connected SCO link on setup errors Hitalo Souza
2026-10-08 15:12 ` [PATCH v2 2/6] Bluetooth: hci_conn: Don't set up a SCO link that is already up Hitalo Souza
2026-10-08 15:12 ` [PATCH v2 3/6] Bluetooth: hci_event: Disconnect links that complete while being aborted Hitalo Souza
2026-10-08 15:12 ` [PATCH v2 4/6] Bluetooth: Don't leave abandoned SCO links up in the controller Hitalo Souza
2026-10-08 15:12 ` Hitalo Souza [this message]
2026-10-08 15:12 ` [PATCH v2 6/6] Bluetooth: hci_event: Notify the driver only of SCO links that came up Hitalo Souza
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261008151238.2138665-6-enghitalo@gmail.com \
--to=enghitalo@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®