Re: [PATCH] Bluetooth: hci_event: Ignore Authentication Complete for non-ACL links

From: Luiz Augusto von Dentz

Date: Fri Dec 04 2026 - 10:47:59 EST


Hi Jeremy,

On Mon, Nov 30, 2026 at 5:19 PM Jeremy Dean Clifton <deaner92@xxxxxxxxx> wrote:
>
> Authentication Complete is only defined for BR/EDR (ACL) links, but
> hci_auth_complete_evt() looks the connection up by handle and does not
> check its type. If a controller sends the event with the handle of an
> LE link, the ACL completion code runs on the LE link.
>
> For an ACL link still in BT_CONFIG, that code drops the reference
> hci_conn_complete_evt() took when setup started. An LE link in
> BT_CONFIG never took that reference; the one that keeps it alive
> during setup belongs to the remote features request started by
> hci_le_read_remote_features() and is dropped by
> le_read_features_complete(). The event therefore drops a reference the
> LE link does not have, and refcnt stays one below the number of
> holders. If it reaches zero early, disc_work is queued, and once the
> last holder drops its reference, whether le_read_features_complete()
> or another user such as an L2CAP channel added by __l2cap_chan_add(),
> refcnt goes to -1 and hci_conn_timeout() warns:
>
> WARNING: net/bluetooth/hci_conn.c:631 at hci_conn_timeout+0x16a/0x230
> Workqueue: hci0 hci_conn_timeout
>
> Before commit a106e50be74b ("Bluetooth: HCI: Add support for LL
> Extended Feature Set"), the LE reference was dropped by the LE Read
> Remote Features command status and completion handlers, and only while
> the link was still in BT_CONFIG, which this event had already cleared,
> so the extra drop did not make refcnt negative. That commit moved the
> drop to le_read_features_complete(), which drops it unconditionally.
>
> A controller that follows the specification never sends this event
> for an LE handle, but the kernel should not corrupt its own state when
> one does. Ignore the event for any link type other than ACL before it
> changes the connection's state or references. ACL handling is
> unchanged.
>
> Tested on arm64 under QEMU with the syzbot C reproducer on
> bluetooth-next, with a temporary WARN in hci_conn_drop() when refcnt
> goes negative. Without this patch it fired within the first second
> (337 times, all on an LE link with handle 0 in BT_CONFIG); with it, it
> did not fire in 300 seconds, and the ignored events were logged. The
> reproducer sends the event every few milliseconds, and each
> hci_conn_hold() cancels disc_work, so the hci_conn_timeout() warning
> itself was not seen locally.
>
> Fixes: a106e50be74b ("Bluetooth: HCI: Add support for LL Extended Feature Set")
> Reported-by: syzbot+fc4b5b2477d4ca272907@xxxxxxxxxxxxxxxxxxxxxxxxx
> Closes: https://syzkaller.appspot.com/bug?extid=fc4b5b2477d4ca272907
> Assisted-by: Claude:claude-opus-5-5
> Signed-off-by: Jeremy Dean Clifton <deaner92@xxxxxxxxx>
> ---
> net/bluetooth/hci_event.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index a9b6a6ccaa03..55aa714c4d39 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -3684,6 +3684,17 @@ static void hci_auth_complete_evt(struct hci_dev *hdev, void *data,
> if (!conn)
> goto unlock;
>
> + /* Authentication Complete is only defined for BR/EDR links. An LE
> + * link in BT_CONFIG has not taken the reference that the BT_CONFIG
> + * branch below drops, so letting a misbehaving controller report it
> + * for an LE handle makes conn->refcnt go negative.
> + */
> + if (conn->type != ACL_LINK) {
> + bt_dev_err_ratelimited(hdev, "Ignoring Authentication Complete for non-ACL handle 0x%4.4x",
> + __le16_to_cpu(ev->handle));

Bluetooth code shall still be within 80 columns.

> + goto unlock;
> + }
> +
> if (!ev->status) {
> clear_bit(HCI_CONN_AUTH_FAILURE, conn->flags);
> set_bit(HCI_CONN_AUTH, conn->flags);
> --
> 2.43.0

Netdev sashiko flagged that there are a couple more places where the
same logic shall be applied:

https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130221722.530577-1-deaner92%40yahoo.com


--
Luiz Augusto von Dentz