mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1] Bluetooth: L2CAP: Ignore connection responses with wrong ident
@ 2026-10-29  9:41 Jinwang Li
  2026-10-29 16:09 ` Luiz Augusto von Dentz
  2026-10-30 14:00 ` patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Jinwang Li @ 2026-10-29  9:41 UTC (permalink / raw)
  To: Marcel Holtmann, Luiz Augusto von Dentz
  Cc: linux-bluetooth, linux-kernel, linux-arm-msm, cheng.jiang,
	quic_chezhou, wei.deng, shuai.zhang, mengshi.wu, jinwang.li,
	xiuzhuo.shang

L2CAP/COS/CED/BI-28-C requires the IUT to ignore a Connection Response
that carries an invalid Identifier.

l2cap_connect_create_rsp() only checks that a connection request is
outstanding, not that the response answers it. Add an ident check
against the pending request so that a mismatched response is dropped.

Signed-off-by: Jinwang Li <jinwang.li@oss.qualcomm.com>
---
 net/bluetooth/l2cap_core.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 83b622a42811..70ad30b091e4 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -4480,11 +4480,11 @@ static int l2cap_connect_create_rsp(struct l2cap_conn *conn,
 
 	lockdep_assert_held(&chan->conn->lock);
 
-	/* Only accept a response to a connection request we sent and that
-	 * is still outstanding. A channel waiting in BT_CONNECT for security
-	 * or the feature mask has not sent one yet.
+	/* Only accept a response matching a connection request we sent and
+	 * that is still outstanding. A channel waiting in BT_CONNECT for
+	 * security or the feature mask has not sent one yet.
 	 */
-	if (!l2cap_chan_connect_pending(chan))
+	if (!l2cap_chan_connect_pending(chan) || chan->ident != cmd->ident)
 		goto done;
 
 	switch (result) {
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] Bluetooth: L2CAP: Ignore connection responses with wrong ident
  2026-10-29  9:41 [PATCH v1] Bluetooth: L2CAP: Ignore connection responses with wrong ident Jinwang Li
@ 2026-10-29 16:09 ` Luiz Augusto von Dentz
  2026-10-30 14:00 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2026-10-29 16:09 UTC (permalink / raw)
  To: Jinwang Li
  Cc: Marcel Holtmann, linux-bluetooth, linux-kernel, linux-arm-msm,
	cheng.jiang, quic_chezhou, wei.deng, shuai.zhang, mengshi.wu,
	xiuzhuo.shang

 Hi Jinwang,

On Thu, Oct 29, 2026 at 5:41 AM Jinwang Li <jinwang.li@oss.qualcomm.com> wrote:
>
> L2CAP/COS/CED/BI-28-C requires the IUT to ignore a Connection Response
> that carries an invalid Identifier.
>
> l2cap_connect_create_rsp() only checks that a connection request is
> outstanding, not that the response answers it. Add an ident check
> against the pending request so that a mismatched response is dropped.
>

Needs a Fixes tag.

> Signed-off-by: Jinwang Li <jinwang.li@oss.qualcomm.com>
> ---
>  net/bluetooth/l2cap_core.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
> index 83b622a42811..70ad30b091e4 100644
> --- a/net/bluetooth/l2cap_core.c
> +++ b/net/bluetooth/l2cap_core.c
> @@ -4480,11 +4480,11 @@ static int l2cap_connect_create_rsp(struct l2cap_conn *conn,
>
>         lockdep_assert_held(&chan->conn->lock);
>
> -       /* Only accept a response to a connection request we sent and that
> -        * is still outstanding. A channel waiting in BT_CONNECT for security
> -        * or the feature mask has not sent one yet.
> +       /* Only accept a response matching a connection request we sent and
> +        * that is still outstanding. A channel waiting in BT_CONNECT for
> +        * security or the feature mask has not sent one yet.
>          */
> -       if (!l2cap_chan_connect_pending(chan))
> +       if (!l2cap_chan_connect_pending(chan) || chan->ident != cmd->ident)
>                 goto done;
>
>         switch (result) {
> --
> 2.34.1
>


-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] Bluetooth: L2CAP: Ignore connection responses with wrong ident
  2026-10-29  9:41 [PATCH v1] Bluetooth: L2CAP: Ignore connection responses with wrong ident Jinwang Li
  2026-10-29 16:09 ` Luiz Augusto von Dentz
@ 2026-10-30 14:00 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2026-10-30 14:00 UTC (permalink / raw)
  To: Jinwang Li
  Cc: marcel, luiz.dentz, linux-bluetooth, linux-kernel, linux-arm-msm,
	cheng.jiang, quic_chezhou, wei.deng, shuai.zhang, mengshi.wu,
	xiuzhuo.shang

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Thu, 29 Oct 2026 17:41:04 +0800 you wrote:
> L2CAP/COS/CED/BI-28-C requires the IUT to ignore a Connection Response
> that carries an invalid Identifier.
> 
> l2cap_connect_create_rsp() only checks that a connection request is
> outstanding, not that the response answers it. Add an ident check
> against the pending request so that a mismatched response is dropped.
> 
> [...]

Here is the summary with links:
  - [v1] Bluetooth: L2CAP: Ignore connection responses with wrong ident
    https://git.kernel.org/bluetooth/bluetooth-next/c/11701044c532

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:[~2026-10-30 14:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-29  9:41 [PATCH v1] Bluetooth: L2CAP: Ignore connection responses with wrong ident Jinwang Li
2026-10-29 16:09 ` Luiz Augusto von Dentz
2026-10-30 14:00 ` 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

all inboxes | Powered by JetHome®