public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: David Carlier <devnexen@gmail.com>
To: Marcel Holtmann <marcel@holtmann.org>,
	Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: linux-bluetooth@vger.kernel.org, David Carlier <devnexen@gmail.com>
Subject: [PATCH] Bluetooth: hci_conn: validate connection before BIG creation
Date: Wed,  8 Apr 2026 16:56:38 +0100	[thread overview]
Message-ID: <20260408155638.95927-1-devnexen@gmail.com> (raw)

Add missing hci_conn_valid() check in create_big_sync() to prevent
a potential use-after-free. The connection object passed via
hci_cmd_sync_queue() could be freed before the async callback
executes, leading to a dereference of stale memory.

All other async callbacks using the same pattern already validate
the connection (e.g. hci_le_big_create_sync, hci_acl_create_conn_sync,
hci_le_create_conn_sync, abort_conn_sync).

Signed-off-by: David Carlier <devnexen@gmail.com>
---
 net/bluetooth/hci_conn.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 11d3ad8d2551..be522fae0058 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -2130,6 +2130,9 @@ static int create_big_sync(struct hci_dev *hdev, void *data)
 	u32 flags = 0;
 	int err;
 
+	if (!hci_conn_valid(hdev, conn))
+		return -ECANCELED;
+
 	if (qos->bcast.out.phys == BIT(1))
 		flags |= MGMT_ADV_FLAG_SEC_2M;
 
-- 
2.53.0


             reply	other threads:[~2026-04-08 15:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-08 15:56 David Carlier [this message]
2026-04-08 17:17 ` Bluetooth: hci_conn: validate connection before BIG creation bluez.test.bot
2026-04-09 15:19 ` [PATCH] " Luiz Augusto von Dentz
2026-04-09 18:47   ` David CARLIER
2026-04-09 20:21 ` bluez.test.bot

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=20260408155638.95927-1-devnexen@gmail.com \
    --to=devnexen@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=marcel@holtmann.org \
    /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