public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Christian Eggers <ceggers@arri.de>
To: <linux-bluetooth@vger.kernel.org>,
	Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Subject: Re: [PATCH v1] Bluetooth: L2CAP: Fix missing key size check for L2CAP_LE_CONN_REQ
Date: Mon, 23 Feb 2026 17:31:51 +0100	[thread overview]
Message-ID: <5035898.OV4Wx5bFTl@n9w6sw14> (raw)
In-Reply-To: <20260213183333.1830534-1-luiz.dentz@gmail.com>

Hi Luiz,

sorry for the delay, I was away last week.

After setting the minimum encryption size, I get a PASS for L2CAP/LE/CFC/BV-15-C:

echo -n 16 > /sys/kernel/debug/bluetooth/hci0/min_encrypt_key_size
l2test -r -P 0x00F4 -V le_public -E

Thank you very much!

On Friday, 13 February 2026, 19:33:33 CET, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> This adds a check for encryption key size upon receiving
> L2CAP_LE_CONN_REQ which is required by L2CAP/LE/CFC/BV-15-C which
> expects L2CAP_CR_LE_BAD_KEY_SIZE.
> 
> Link: https://lore.kernel.org/linux-bluetooth/5782243.rdbgypaU67@n9w6sw14/
> Fixes: 27e2d4c8d28b ("Bluetooth: Add basic LE L2CAP connect request receiving support")
> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> ---
>  net/bluetooth/l2cap_core.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
> index 9452c6179acb..f73506c35dc5 100644
> --- a/net/bluetooth/l2cap_core.c
> +++ b/net/bluetooth/l2cap_core.c
> @@ -4916,6 +4916,13 @@ static int l2cap_le_connect_req(struct l2cap_conn *conn,
>  		goto response_unlock;
>  	}
>  
> +	/* Check if Key Size is sufficient for the security level */
> +	if (!l2cap_check_enc_key_size(conn->hcon, pchan)) {
> +		result = L2CAP_CR_LE_BAD_KEY_SIZE;
> +		chan = NULL;
> +		goto response_unlock;
> +	}
> +
>  	/* Check for valid dynamic CID range */
>  	if (scid < L2CAP_CID_DYN_START || scid > L2CAP_CID_LE_DYN_END) {
>  		result = L2CAP_CR_LE_INVALID_SCID;
> 

Tested-by: Christian Eggers <ceggers@arri.de>




  parent reply	other threads:[~2026-02-23 16:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-13 18:33 [PATCH v1] Bluetooth: L2CAP: Fix missing key size check for L2CAP_LE_CONN_REQ Luiz Augusto von Dentz
2026-02-13 19:13 ` [v1] " bluez.test.bot
2026-02-17 14:40 ` [PATCH v1] " Luiz Augusto von Dentz
2026-02-23 16:31 ` Christian Eggers [this message]
2026-02-23 22:56 ` patchwork-bot+bluetooth

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=5035898.OV4Wx5bFTl@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