From: Christian Eggers <ceggers@arri.de>
To: <linux-bluetooth@vger.kernel.org>,
Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Subject: Re: [PATCH v3] Bluetooth: L2CAP: Fix regressions caused by reusing ident
Date: Thu, 19 Mar 2026 15:26:57 +0100 [thread overview]
Message-ID: <2796916.vuYhMxLoTh@n9w6sw14> (raw)
In-Reply-To: <20260318180922.307838-1-luiz.dentz@gmail.com>
On Wednesday, 18 March 2026, 19:09:22 CET, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> This attempt to fix regressions caused by reusing ident which apparently
> is not handled well on certain stacks causing the stack to not respond to
> requests, so instead of simple returning the first unallocated id this
> stores the last used tx_ident and then attempt to use the next until all
> available ids are exausted and then cycle starting over to 1.
>
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=221120
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=221177
> Fixes: 6c3ea155e5ee ("Bluetooth: L2CAP: Fix not tracking outstanding TX ident")
> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> ---
> include/net/bluetooth/l2cap.h | 1 +
> net/bluetooth/l2cap_core.c | 23 ++++++++++++++++++++---
> 2 files changed, 21 insertions(+), 3 deletions(-)
>
> diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
> index 010f1a8fd15f..5172afee5494 100644
> --- a/include/net/bluetooth/l2cap.h
> +++ b/include/net/bluetooth/l2cap.h
> @@ -658,6 +658,7 @@ struct l2cap_conn {
> struct sk_buff *rx_skb;
> __u32 rx_len;
> struct ida tx_ida;
> + __u8 tx_ident;
>
> struct sk_buff_head pending_rx;
> struct work_struct pending_rx_work;
> diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
> index ead51dc0f3f1..a818a58362d5 100644
> --- a/net/bluetooth/l2cap_core.c
> +++ b/net/bluetooth/l2cap_core.c
> @@ -926,16 +926,33 @@ int l2cap_chan_check_security(struct l2cap_chan *chan, bool initiator)
>
> static int l2cap_get_ident(struct l2cap_conn *conn)
> {
> + u8 max;
> + int ident;
> +
> /* LE link does not support tools like l2ping so use the full range */
> if (conn->hcon->type == LE_LINK)
> - return ida_alloc_range(&conn->tx_ida, 1, 255, GFP_ATOMIC);
> -
> + max = 255;
> /* Get next available identificator.
> * 1 - 128 are used by kernel.
> * 129 - 199 are reserved.
> * 200 - 254 are used by utilities like l2ping, etc.
> */
> - return ida_alloc_range(&conn->tx_ida, 1, 128, GFP_ATOMIC);
> + else
> + max = 128;
> +
> + /* Allocate ident using min as last used + 1 (cyclic) */
> + ident = ida_alloc_range(&conn->tx_ida, conn->tx_ident + 1, max,
> + GFP_ATOMIC);
> + /* Force min 1 to start over */
> + if (ident <= 0)
> + ident = ida_alloc_range(&conn->tx_ida, 1, max, GFP_ATOMIC);
> +
> + if (ident > 0)
> + conn->tx_ident = ident;
> + else
> + BT_ERR("Uanble to allocate ident: %d", ident);
> +
> + return conn->tx_ident;
> }
>
> static void l2cap_send_acl(struct l2cap_conn *conn, struct sk_buff *skb,
>
PTS test L2CAP/COS/CED/BI-29-C is happy with this.
Tested-by: Christian Eggers <ceggers@arri.de>
prev parent reply other threads:[~2026-03-19 14:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-18 18:09 [PATCH v3] Bluetooth: L2CAP: Fix regressions caused by reusing ident Luiz Augusto von Dentz
2026-03-18 19:15 ` [v3] " bluez.test.bot
2026-03-18 21:56 ` [PATCH v3] " Luiz Augusto von Dentz
2026-03-19 14:26 ` Christian Eggers [this message]
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=2796916.vuYhMxLoTh@n9w6sw14 \
--to=ceggers@arri.de \
--cc=linux-bluetooth@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
/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