From: Ludovico de Nittis <ludovico.denittis@collabora.com>
To: Paul Menzel <pmenzel@molgen.mpg.de>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 1/2] Bluetooth: hci_event: Treat UNKNOWN_CONN_ID on disconnect as success
Date: Tue, 12 Aug 2025 17:57:41 +0200 [thread overview]
Message-ID: <461a8ede-e22e-4843-97ed-79ccf2a3630e@collabora.com> (raw)
In-Reply-To: <13a10b21-63ae-4606-ad5d-e5d48870da22@molgen.mpg.de>
Hi Paul,
On 8/12/25 5:20 PM, Paul Menzel wrote:
> Dear Ludovico,
>
>
> Thank you for your patch.
>
> Am 12.08.25 um 16:10 schrieb Ludovico de Nittis:
>> When the host sends an HCI_OP_DISCONNECT command, the controller may
>> respond with the status HCI_ERROR_UNKNOWN_CONN_ID. E.g. this can happen
>> on resume from suspend, if the link was terminated by the remote device
>> before the event mask was correctly set.
>>
>> Currently, the hci_cs_disconnect function treats any non-zero status
>> as a command failure. This can be misleading because the connection is
>> indeed being terminated and the controller is confirming that is has no
>> knowledge of that connection handle. Meaning that the initial request of
>> disconnecting a device should be treated as done.
>>
>> With this change we allow the function to proceed, following the success
>> path, which correctly calls `mgmt_device_disconnected` and ensures a
>> consistent state.
>
> Although part of your issue referenced below, I’d love to see the
> reproducer in the commit message, should you resend.
Sure, in the v2 I added the btmon snippet in the commit message.
>> Link: https://github.com/bluez/bluez/issues/1226
>> Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
>> ---
>> net/bluetooth/hci_event.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
>> index fe7cdd67a..6c67dfa13 100644
>> --- a/net/bluetooth/hci_event.c
>> +++ b/net/bluetooth/hci_event.c
>> @@ -2703,7 +2703,7 @@ static void hci_cs_disconnect(struct hci_dev
>> *hdev, u8 status)
>> if (!conn)
>> goto unlock;
>> - if (status) {
>> + if (status && status != HCI_ERROR_UNKNOWN_CONN_ID) {
>> mgmt_disconnect_failed(hdev, &conn->dst, conn->type,
>> conn->dst_type, status);
>
> Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
>
>
> Kind regards,
>
> Paul
next prev parent reply other threads:[~2025-08-12 15:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-12 14:10 [PATCH 0/2] Bluetooth: hci_event: Fix connection state issues during suspend/resume Ludovico de Nittis
2025-08-12 14:10 ` [PATCH 1/2] Bluetooth: hci_event: Treat UNKNOWN_CONN_ID on disconnect as success Ludovico de Nittis
2025-08-12 14:36 ` Bluetooth: hci_event: Fix connection state issues during suspend/resume bluez.test.bot
2025-08-12 15:20 ` [PATCH 1/2] Bluetooth: hci_event: Treat UNKNOWN_CONN_ID on disconnect as success Paul Menzel
2025-08-12 15:57 ` Ludovico de Nittis [this message]
2025-08-12 14:10 ` [PATCH 2/2] Bluetooth: hci_event: Mark connection as closed during suspend disconnect Ludovico de Nittis
2025-08-12 14:41 ` Luiz Augusto von Dentz
2025-08-12 14:52 ` Ludovico de Nittis
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=461a8ede-e22e-4843-97ed-79ccf2a3630e@collabora.com \
--to=ludovico.denittis@collabora.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=pmenzel@molgen.mpg.de \
/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