Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH 6.6] Bluetooth: hci_core: lookup hci_conn on RX path
@ 2026-11-18 12:35 Yu Junzhe
  2026-11-18 18:23 ` [6.6] " bluez.test.bot
       [not found] ` <20261119035758.45-1-junzheyu1@gmail.com>
  0 siblings, 2 replies; 8+ messages in thread
From: Yu Junzhe @ 2026-11-18 12:35 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz
  Cc: Yu Junzhe, linux-bluetooth, linux-kernel, stable,
	Greg Kroah-Hartman, Sasha Levin

Bluetooth: hci_core: lookup hci_conn on RX path

Backport of 79a2d4678ba9 ("Bluetooth: hci_core: lookup hci_conn on RX
path") for linux-6.6.y. Adapted to this tree: 6.6 still pulls ACL, SCO,
and ISO headers with skb_pull(), and sco_conn / iso_conn have no kref,
so the SCO and ISO paths take hci_conn_get() under hci_dev_lock and
hci_conn_put() on every exit. The L2CAP change matches upstream: look
the handle up under hci_dev_lock, call hci_conn_enter_active_mode()
there, and take l2cap_conn_hold_unless_zero() before dropping the lock.

hci_acldata_packet() looks the connection up, drops hci_dev_lock, and
calls l2cap_recv_acldata() on the raw pointer. The first access there
is hci_dev_lock(hcon->hdev). The hash lookup takes no reference, and
bt_link_release() frees the object with kfree() from hci_cmd_sync_work.
SCO and ISO have the same shape.

CVE-2025-68304. Only 6.6.162 was checked.

Tested on Linux 6.6.162 KASAN with /dev/vhci. A userspace racer does an
outgoing high-security L2CAP connect, floods ACL data while the
connection is still hashed, then completes HCI_Disconnect with status
0x1f so hci_conn_del() runs on hci_cmd_sync_work. The unpatched
campaign kernel (6.6.162 #3) printed:

  BUG: KASAN: slab-use-after-free in l2cap_recv_acldata+0xcc8/0xe60

Read of size 8 by kworker/u17:0 on hci_rx_work. Allocated in
__hci_conn_add from hci_connect_acl / l2cap_sock_connect, freed in
bt_link_release from hci_cmd_sync_work, last related work
hci_cs_auth_requested. The same program on the patched kernel
(6.6.162 #1) finished 99 connect/auth/disconnect rounds and 1589888
ACL frames with no KASAN report.

Cc: stable@vger.kernel.org # 6.6.162
Signed-off-by: Yu Junzhe <junzheyu1@gmail.com>
---
 include/net/bluetooth/hci_core.h | 19 +++++++----
 net/bluetooth/hci_core.c         | 69 ++++++++++++++--------------------------
 net/bluetooth/iso.c              | 29 ++++++++++++++---
 net/bluetooth/l2cap_core.c       | 23 +++++++++++---
 net/bluetooth/sco.c              | 36 +++++++++++++++------
 5 files changed, 105 insertions(+), 71 deletions(-)

diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 62804d98d..7a2729f86 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -837,11 +837,12 @@ extern struct mutex hci_cb_list_lock;
 /* ----- HCI interface to upper protocols ----- */
 int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr);
 int l2cap_disconn_ind(struct hci_conn *hcon);
-void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags);
+int l2cap_recv_acldata(struct hci_dev *hdev, u16 handle, struct sk_buff *skb,
+		       u16 flags);
 
 #if IS_ENABLED(CONFIG_BT_BREDR)
 int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags);
-void sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb);
+int sco_recv_scodata(struct hci_dev *hdev, u16 handle, struct sk_buff *skb);
 #else
 static inline int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr,
 				  __u8 *flags)
@@ -849,23 +850,29 @@ static inline int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr,
 	return 0;
 }
 
-static inline void sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb)
+static inline int sco_recv_scodata(struct hci_dev *hdev, u16 handle,
+				   struct sk_buff *skb)
 {
+	kfree_skb(skb);
+	return -ENOENT;
 }
 #endif
 
 #if IS_ENABLED(CONFIG_BT_LE)
 int iso_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags);
-void iso_recv(struct hci_conn *hcon, struct sk_buff *skb, u16 flags);
+int iso_recv(struct hci_dev *hdev, u16 handle, struct sk_buff *skb, u16 flags);
 #else
 static inline int iso_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr,
 				  __u8 *flags)
 {
 	return 0;
 }
-static inline void iso_recv(struct hci_conn *hcon, struct sk_buff *skb,
-			    u16 flags)
+
+static inline int iso_recv(struct hci_dev *hdev, u16 handle,
+			   struct sk_buff *skb, u16 flags)
 {
+	kfree_skb(skb);
+	return -ENOENT;
 }
 #endif
 
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 84d9a445e..defa61803 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -3798,13 +3798,14 @@ static void hci_tx_work(struct work_struct *work)
 static void hci_acldata_packet(struct hci_dev *hdev, struct sk_buff *skb)
 {
 	struct hci_acl_hdr *hdr;
-	struct hci_conn *conn;
 	__u16 handle, flags;
+	int err;
 
 	hdr = skb_pull_data(skb, sizeof(*hdr));
 	if (!hdr) {
 		bt_dev_err(hdev, "ACL packet too small");
-		goto drop;
+		kfree_skb(skb);
+		return;
 	}
 
 	handle = __le16_to_cpu(hdr->handle);
@@ -3816,31 +3817,21 @@ static void hci_acldata_packet(struct hci_dev *hdev, struct sk_buff *skb)
 
 	hdev->stat.acl_rx++;
 
-	hci_dev_lock(hdev);
-	conn = hci_conn_hash_lookup_handle(hdev, handle);
-	hci_dev_unlock(hdev);
-
-	if (conn) {
-		hci_conn_enter_active_mode(conn, BT_POWER_FORCE_ACTIVE_OFF);
-
-		/* Send to upper protocol */
-		l2cap_recv_acldata(conn, skb, flags);
-		return;
-	} else {
+	err = l2cap_recv_acldata(hdev, handle, skb, flags);
+	if (err == -ENOENT)
 		bt_dev_err(hdev, "ACL packet for unknown connection handle %d",
 			   handle);
-	}
-
-drop:
-	kfree_skb(skb);
+	else if (err)
+		bt_dev_dbg(hdev, "ACL packet recv for handle %d failed: %d",
+			   handle, err);
 }
 
 /* SCO data packet */
 static void hci_scodata_packet(struct hci_dev *hdev, struct sk_buff *skb)
 {
 	struct hci_sco_hdr *hdr = (void *) skb->data;
-	struct hci_conn *conn;
 	__u16 handle, flags;
+	int err;
 
 	skb_pull(skb, HCI_SCO_HDR_SIZE);
 
@@ -3853,33 +3844,28 @@ static void hci_scodata_packet(struct hci_dev *hdev, struct sk_buff *skb)
 
 	hdev->stat.sco_rx++;
 
-	hci_dev_lock(hdev);
-	conn = hci_conn_hash_lookup_handle(hdev, handle);
-	hci_dev_unlock(hdev);
+	hci_skb_pkt_status(skb) = flags & 0x03;
 
-	if (conn) {
-		/* Send to upper protocol */
-		hci_skb_pkt_status(skb) = flags & 0x03;
-		sco_recv_scodata(conn, skb);
-		return;
-	} else {
+	err = sco_recv_scodata(hdev, handle, skb);
+	if (err == -ENOENT)
 		bt_dev_err_ratelimited(hdev, "SCO packet for unknown connection handle %d",
 				       handle);
-	}
-
-	kfree_skb(skb);
+	else if (err)
+		bt_dev_dbg(hdev, "SCO packet recv for handle %d failed: %d",
+			   handle, err);
 }
 
 static void hci_isodata_packet(struct hci_dev *hdev, struct sk_buff *skb)
 {
 	struct hci_iso_hdr *hdr;
-	struct hci_conn *conn;
 	__u16 handle, flags;
+	int err;
 
 	hdr = skb_pull_data(skb, sizeof(*hdr));
 	if (!hdr) {
 		bt_dev_err(hdev, "ISO packet too small");
-		goto drop;
+		kfree_skb(skb);
+		return;
 	}
 
 	handle = __le16_to_cpu(hdr->handle);
@@ -3889,22 +3875,13 @@ static void hci_isodata_packet(struct hci_dev *hdev, struct sk_buff *skb)
 	bt_dev_dbg(hdev, "len %d handle 0x%4.4x flags 0x%4.4x", skb->len,
 		   handle, flags);
 
-	hci_dev_lock(hdev);
-	conn = hci_conn_hash_lookup_handle(hdev, handle);
-	hci_dev_unlock(hdev);
-
-	if (!conn) {
+	err = iso_recv(hdev, handle, skb, flags);
+	if (err == -ENOENT)
 		bt_dev_err(hdev, "ISO packet for unknown connection handle %d",
 			   handle);
-		goto drop;
-	}
-
-	/* Send to upper protocol */
-	iso_recv(conn, skb, flags);
-	return;
-
-drop:
-	kfree_skb(skb);
+	else if (err)
+		bt_dev_dbg(hdev, "ISO packet recv for handle %d failed: %d",
+			   handle, err);
 }
 
 static bool hci_req_is_complete(struct hci_dev *hdev)
diff --git a/net/bluetooth/iso.c b/net/bluetooth/iso.c
index 217ba98b0..cbb315922 100644
--- a/net/bluetooth/iso.c
+++ b/net/bluetooth/iso.c
@@ -2059,13 +2059,29 @@ static void iso_disconn_cfm(struct hci_conn *hcon, __u8 reason)
 	iso_conn_del(hcon, bt_to_errno(reason));
 }
 
-void iso_recv(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)
+int iso_recv(struct hci_dev *hdev, u16 handle, struct sk_buff *skb, u16 flags)
 {
-	struct iso_conn *conn = hcon->iso_data;
+	struct hci_conn *hcon;
+	struct iso_conn *conn;
 	__u16 pb, ts, len;
 
-	if (!conn)
-		goto drop;
+	/* 6.6 has no iso_conn kref. Hold the hci_conn across the recv. */
+	hci_dev_lock(hdev);
+	hcon = hci_conn_hash_lookup_handle(hdev, handle);
+	if (!hcon) {
+		hci_dev_unlock(hdev);
+		kfree_skb(skb);
+		return -ENOENT;
+	}
+	hci_conn_get(hcon);
+	conn = hcon->iso_data;
+	hci_dev_unlock(hdev);
+
+	if (!conn) {
+		hci_conn_put(hcon);
+		kfree_skb(skb);
+		return -EINVAL;
+	}
 
 	pb     = hci_iso_flags_pb(flags);
 	ts     = hci_iso_flags_ts(flags);
@@ -2115,7 +2131,8 @@ void iso_recv(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)
 			/* Complete frame received */
 			hci_skb_pkt_status(skb) = flags & 0x03;
 			iso_recv_frame(conn, skb);
-			return;
+			hci_conn_put(hcon);
+			return 0;
 		}
 
 		if (pb == ISO_SINGLE) {
@@ -2191,6 +2208,8 @@ void iso_recv(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)
 
 drop:
 	kfree_skb(skb);
+	hci_conn_put(hcon);
+	return 0;
 }
 
 static struct hci_cb iso_cb = {
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 94fddc456..5b5a9e763 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -7752,13 +7752,24 @@ struct l2cap_conn *l2cap_conn_hold_unless_zero(struct l2cap_conn *c)
 }
 EXPORT_SYMBOL(l2cap_conn_hold_unless_zero);
 
-void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)
+int l2cap_recv_acldata(struct hci_dev *hdev, u16 handle,
+		       struct sk_buff *skb, u16 flags)
 {
+	struct hci_conn *hcon;
 	struct l2cap_conn *conn;
 	int len;
 
-	/* Lock hdev to access l2cap_data to avoid race with l2cap_conn_del */
-	hci_dev_lock(hcon->hdev);
+	/* Lock hdev for hci_conn, and race on l2cap_data vs. l2cap_conn_del */
+	hci_dev_lock(hdev);
+
+	hcon = hci_conn_hash_lookup_handle(hdev, handle);
+	if (!hcon) {
+		hci_dev_unlock(hdev);
+		kfree_skb(skb);
+		return -ENOENT;
+	}
+
+	hci_conn_enter_active_mode(hcon, BT_POWER_FORCE_ACTIVE_OFF);
 
 	conn = hcon->l2cap_data;
 
@@ -7766,12 +7777,13 @@ void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)
 		conn = l2cap_conn_add(hcon);
 
 	conn = l2cap_conn_hold_unless_zero(conn);
+	hcon = NULL;
 
-	hci_dev_unlock(hcon->hdev);
+	hci_dev_unlock(hdev);
 
 	if (!conn) {
 		kfree_skb(skb);
-		return;
+		return -EINVAL;
 	}
 
 	BT_DBG("conn %p len %u flags 0x%x", conn, skb->len, flags);
@@ -7885,6 +7897,7 @@ void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)
 unlock:
 	mutex_unlock(&conn->lock);
 	l2cap_conn_put(conn);
+	return 0;
 }
 
 static struct hci_cb l2cap_cb = {
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index 75609dbd5..98fd0c89b 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -1432,22 +1432,40 @@ static void sco_disconn_cfm(struct hci_conn *hcon, __u8 reason)
 	sco_conn_del(hcon, bt_to_errno(reason));
 }
 
-void sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb)
+int sco_recv_scodata(struct hci_dev *hdev, u16 handle, struct sk_buff *skb)
 {
-	struct sco_conn *conn = hcon->sco_data;
+	struct hci_conn *hcon;
+	struct sco_conn *conn;
 
-	if (!conn)
-		goto drop;
+	/* 6.6 has no sco_conn kref. Hold the hci_conn so the lookup cannot
+	 * be freed before sco_data is read. The lookup stays under hci_dev_lock.
+	 */
+	hci_dev_lock(hdev);
+	hcon = hci_conn_hash_lookup_handle(hdev, handle);
+	if (!hcon) {
+		hci_dev_unlock(hdev);
+		kfree_skb(skb);
+		return -ENOENT;
+	}
+	hci_conn_get(hcon);
+	conn = hcon->sco_data;
+	hci_dev_unlock(hdev);
+
+	if (!conn) {
+		hci_conn_put(hcon);
+		kfree_skb(skb);
+		return -EINVAL;
+	}
 
 	BT_DBG("conn %p len %u", conn, skb->len);
 
-	if (skb->len) {
+	if (skb->len)
 		sco_recv_frame(conn, skb);
-		return;
-	}
+	else
+		kfree_skb(skb);
 
-drop:
-	kfree_skb(skb);
+	hci_conn_put(hcon);
+	return 0;
 }
 
 static struct hci_cb sco_cb = {
-- 
2.53.0

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

* RE: [6.6] Bluetooth: hci_core: lookup hci_conn on RX path
  2026-11-18 12:35 [PATCH 6.6] Bluetooth: hci_core: lookup hci_conn on RX path Yu Junzhe
@ 2026-11-18 18:23 ` bluez.test.bot
       [not found] ` <20261119035758.45-1-junzheyu1@gmail.com>
  1 sibling, 0 replies; 8+ messages in thread
From: bluez.test.bot @ 2026-11-18 18:23 UTC (permalink / raw)
  To: linux-bluetooth, junzheyu1

[-- Attachment #1: Type: text/plain, Size: 1266 bytes --]

This is an automated email and please do not reply to this email.

Dear Submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.

----- Output -----

error: patch failed: include/net/bluetooth/hci_core.h:837
error: include/net/bluetooth/hci_core.h: patch does not apply
error: patch failed: net/bluetooth/hci_core.c:3798
error: net/bluetooth/hci_core.c: patch does not apply
error: patch failed: net/bluetooth/iso.c:2059
error: net/bluetooth/iso.c: patch does not apply
error: patch failed: net/bluetooth/l2cap_core.c:7752
error: net/bluetooth/l2cap_core.c: patch does not apply
error: patch failed: net/bluetooth/sco.c:1432
error: net/bluetooth/sco.c: patch does not apply
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"

Please resolve the issue and submit the patches again.


---
Regards,
Linux Bluetooth


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

* [PATCH 0/3] Bluetooth: hci_core: lookup hci_conn on the RX path
       [not found]   ` <2026-11-19-1-daily-reply-0012@kernel.org>
@ 2026-11-26  7:55     ` Yu Junzhe
  2026-11-26  7:55       ` [PATCH 6.12.y 1/3] Bluetooth: hci_core: lookup hci_conn on the ACL and ISO RX paths Yu Junzhe
                         ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Yu Junzhe @ 2026-11-26  7:55 UTC (permalink / raw)
  To: stable
  Cc: Yu Junzhe, Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	linux-bluetooth, Greg Kroah-Hartman, Sasha Levin

Sasha, this replaces the 6.6-only v2.

79a2d4678ba9 ("Bluetooth: hci_core: lookup hci_conn on RX path on
protocol side") is in v6.18 and is already in bluetooth.git. These
diffs are for the stable trees that still lack it. They do not apply
to bluetooth.git HEAD, so the BlueZ CI apply check will fail. Please
review them for the stable branches.

6.12.y already has l2cap_conn_hold_unless_zero() and
iso_conn_hold_unless_zero(). 6.6.y and 6.1.y have the L2CAP helper
only. sco_conn has no kref on any of the three, so SCO is unchanged.
hci_conn_get() does not pin sco_conn.

Booted KASAN guests, same racer (patch-test/repro.c):

- 6.12.119 unpatched printed slab-use-after-free in l2cap_recv_acldata.
  6.12.119 with patch 1/3 finished 371 connect/auth/disconnect rounds
  and printed no KASAN report. The racer exercises ACL, not ISO.
- 6.6.162 with patch 2/3 finished 123 rounds and printed no KASAN
  report. That image is a build of this diff. The earlier #1 image
  still contained the v1 SCO and ISO edits.
- 6.1.193 with patch 3/3 booted and completed one connection with no
  KASAN report. The racer then lost sync with the virtual controller
  (unexpected command-complete length), so it did not repeat the
  6.12 and 6.6 stress.

Yu Junzhe (3):
  Bluetooth: hci_core: lookup hci_conn on the ACL and ISO RX paths
  Bluetooth: hci_core: lookup hci_conn on the ACL RX path
  Bluetooth: hci_core: lookup hci_conn on the ACL RX path

 6.12.y: 4 files changed, 66 insertions(+), 47 deletions(-)
 6.6.y:  3 files changed, 28 insertions(+), 23 deletions(-)
 6.1.y:  3 files changed, 32 insertions(+), 25 deletions(-)

-- 
2.53.0

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

* [PATCH 6.12.y 1/3] Bluetooth: hci_core: lookup hci_conn on the ACL and ISO RX paths
  2026-11-26  7:55     ` [PATCH 0/3] Bluetooth: hci_core: lookup hci_conn on the " Yu Junzhe
@ 2026-11-26  7:55       ` Yu Junzhe
  2026-11-26 12:19         ` Bluetooth: hci_core: lookup hci_conn on the RX path bluez.test.bot
  2026-11-26  7:55       ` [PATCH 6.6.y 2/3] Bluetooth: hci_core: lookup hci_conn on the ACL " Yu Junzhe
                         ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Yu Junzhe @ 2026-11-26  7:55 UTC (permalink / raw)
  To: stable
  Cc: Yu Junzhe, Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	linux-bluetooth, Greg Kroah-Hartman, Sasha Levin

commit 79a2d4678ba90bdba577dc3af88cc900d6dcd5ee upstream.

Move the hci_conn lookup into l2cap_recv_acldata() and iso_recv() and
hold the protocol object before dropping hci_dev_lock. 6.12.y already
has l2cap_conn_hold_unless_zero() and iso_conn_hold_unless_zero().
sco_conn has no kref on this tree, so the SCO path is unchanged.

Cc: stable@vger.kernel.org # 6.12
Fixes: 5af1f84ed13a ("Bluetooth: hci_sync: Fix UAF on hci_abort_conn_sync")
Signed-off-by: Yu Junzhe <junzheyu1@gmail.com>

---
 include/net/bluetooth/hci_core.h | 11 +++++----
 net/bluetooth/hci_core.c         | 49 +++++++++++++---------------------------
 net/bluetooth/iso.c              | 30 ++++++++++++++++++++----
 net/bluetooth/l2cap_core.c       | 23 +++++++++++++++----
 4 files changed, 66 insertions(+), 47 deletions(-)

diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index f846865db..22ac4870a 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -843,7 +843,8 @@ extern struct mutex hci_cb_list_lock;
 /* ----- HCI interface to upper protocols ----- */
 int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr);
 int l2cap_disconn_ind(struct hci_conn *hcon);
-void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags);
+int l2cap_recv_acldata(struct hci_dev *hdev, u16 handle, struct sk_buff *skb,
+		       u16 flags);
 
 #if IS_ENABLED(CONFIG_BT_BREDR)
 int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags);
@@ -862,16 +863,18 @@ static inline void sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb)
 
 #if IS_ENABLED(CONFIG_BT_LE)
 int iso_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags);
-void iso_recv(struct hci_conn *hcon, struct sk_buff *skb, u16 flags);
+int iso_recv(struct hci_dev *hdev, u16 handle, struct sk_buff *skb, u16 flags);
 #else
 static inline int iso_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr,
 				  __u8 *flags)
 {
 	return 0;
 }
-static inline void iso_recv(struct hci_conn *hcon, struct sk_buff *skb,
-			    u16 flags)
+static inline int iso_recv(struct hci_dev *hdev, u16 handle,
+			   struct sk_buff *skb, u16 flags)
 {
+	kfree_skb(skb);
+	return -ENOENT;
 }
 #endif
 
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 3a713084f..fe2900960 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -3865,13 +3865,14 @@ static void hci_tx_work(struct work_struct *work)
 static void hci_acldata_packet(struct hci_dev *hdev, struct sk_buff *skb)
 {
 	struct hci_acl_hdr *hdr;
-	struct hci_conn *conn;
 	__u16 handle, flags;
+	int err;
 
 	hdr = skb_pull_data(skb, sizeof(*hdr));
 	if (!hdr) {
 		bt_dev_err(hdev, "ACL packet too small");
-		goto drop;
+		kfree_skb(skb);
+		return;
 	}
 
 	handle = __le16_to_cpu(hdr->handle);
@@ -3883,23 +3884,13 @@ static void hci_acldata_packet(struct hci_dev *hdev, struct sk_buff *skb)
 
 	hdev->stat.acl_rx++;
 
-	hci_dev_lock(hdev);
-	conn = hci_conn_hash_lookup_handle(hdev, handle);
-	hci_dev_unlock(hdev);
-
-	if (conn) {
-		hci_conn_enter_active_mode(conn, BT_POWER_FORCE_ACTIVE_OFF);
-
-		/* Send to upper protocol */
-		l2cap_recv_acldata(conn, skb, flags);
-		return;
-	} else {
+	err = l2cap_recv_acldata(hdev, handle, skb, flags);
+	if (err == -ENOENT)
 		bt_dev_err(hdev, "ACL packet for unknown connection handle %d",
 			   handle);
-	}
-
-drop:
-	kfree_skb(skb);
+	else if (err)
+		bt_dev_dbg(hdev, "ACL packet recv for handle %d failed: %d",
+			   handle, err);
 }
 
 /* SCO data packet */
@@ -3940,13 +3931,14 @@ static void hci_scodata_packet(struct hci_dev *hdev, struct sk_buff *skb)
 static void hci_isodata_packet(struct hci_dev *hdev, struct sk_buff *skb)
 {
 	struct hci_iso_hdr *hdr;
-	struct hci_conn *conn;
 	__u16 handle, flags;
+	int err;
 
 	hdr = skb_pull_data(skb, sizeof(*hdr));
 	if (!hdr) {
 		bt_dev_err(hdev, "ISO packet too small");
-		goto drop;
+		kfree_skb(skb);
+		return;
 	}
 
 	handle = __le16_to_cpu(hdr->handle);
@@ -3956,22 +3948,13 @@ static void hci_isodata_packet(struct hci_dev *hdev, struct sk_buff *skb)
 	bt_dev_dbg(hdev, "len %d handle 0x%4.4x flags 0x%4.4x", skb->len,
 		   handle, flags);
 
-	hci_dev_lock(hdev);
-	conn = hci_conn_hash_lookup_handle(hdev, handle);
-	hci_dev_unlock(hdev);
-
-	if (!conn) {
+	err = iso_recv(hdev, handle, skb, flags);
+	if (err == -ENOENT)
 		bt_dev_err(hdev, "ISO packet for unknown connection handle %d",
 			   handle);
-		goto drop;
-	}
-
-	/* Send to upper protocol */
-	iso_recv(conn, skb, flags);
-	return;
-
-drop:
-	kfree_skb(skb);
+	else if (err)
+		bt_dev_dbg(hdev, "ISO packet recv for handle %d failed: %d",
+			   handle, err);
 }
 
 static bool hci_req_is_complete(struct hci_dev *hdev)
diff --git a/net/bluetooth/iso.c b/net/bluetooth/iso.c
index 2733cc8b8..4e3584266 100644
--- a/net/bluetooth/iso.c
+++ b/net/bluetooth/iso.c
@@ -2424,13 +2424,30 @@ static void iso_disconn_cfm(struct hci_conn *hcon, __u8 reason)
 	iso_conn_del(hcon, bt_to_errno(reason));
 }
 
-void iso_recv(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)
+int iso_recv(struct hci_dev *hdev, u16 handle, struct sk_buff *skb, u16 flags)
 {
-	struct iso_conn *conn = hcon->iso_data;
+	struct hci_conn *hcon;
+	struct iso_conn *conn;
 	__u16 pb, ts, len;
 
-	if (!conn)
-		goto drop;
+	hci_dev_lock(hdev);
+
+	hcon = hci_conn_hash_lookup_handle(hdev, handle);
+	if (!hcon) {
+		hci_dev_unlock(hdev);
+		kfree_skb(skb);
+		return -ENOENT;
+	}
+
+	conn = iso_conn_hold_unless_zero(hcon->iso_data);
+	hcon = NULL;
+
+	hci_dev_unlock(hdev);
+
+	if (!conn) {
+		kfree_skb(skb);
+		return -EINVAL;
+	}
 
 	pb     = hci_iso_flags_pb(flags);
 	ts     = hci_iso_flags_ts(flags);
@@ -2480,7 +2497,7 @@ void iso_recv(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)
 			/* Complete frame received */
 			hci_skb_pkt_status(skb) = flags & 0x03;
 			iso_recv_frame(conn, skb);
-			return;
+			goto done;
 		}
 
 		if (pb == ISO_SINGLE) {
@@ -2556,6 +2573,9 @@ void iso_recv(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)
 
 drop:
 	kfree_skb(skb);
+done:
+	iso_conn_put(conn);
+	return 0;
 }
 
 static struct hci_cb iso_cb = {
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index bab8caf18..e7915e847 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -7895,13 +7895,24 @@ struct l2cap_conn *l2cap_conn_hold_unless_zero(struct l2cap_conn *c)
 }
 EXPORT_SYMBOL(l2cap_conn_hold_unless_zero);
 
-void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)
+int l2cap_recv_acldata(struct hci_dev *hdev, u16 handle,
+		       struct sk_buff *skb, u16 flags)
 {
+	struct hci_conn *hcon;
 	struct l2cap_conn *conn;
 	int len;
 
-	/* Lock hdev to access l2cap_data to avoid race with l2cap_conn_del */
-	hci_dev_lock(hcon->hdev);
+	/* Lock hdev for hci_conn, and race on l2cap_data vs. l2cap_conn_del */
+	hci_dev_lock(hdev);
+
+	hcon = hci_conn_hash_lookup_handle(hdev, handle);
+	if (!hcon) {
+		hci_dev_unlock(hdev);
+		kfree_skb(skb);
+		return -ENOENT;
+	}
+
+	hci_conn_enter_active_mode(hcon, BT_POWER_FORCE_ACTIVE_OFF);
 
 	conn = hcon->l2cap_data;
 
@@ -7909,12 +7920,13 @@ void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)
 		conn = l2cap_conn_add(hcon);
 
 	conn = l2cap_conn_hold_unless_zero(conn);
+	hcon = NULL;
 
-	hci_dev_unlock(hcon->hdev);
+	hci_dev_unlock(hdev);
 
 	if (!conn) {
 		kfree_skb(skb);
-		return;
+		return -EINVAL;
 	}
 
 	BT_DBG("conn %p len %u flags 0x%x", conn, skb->len, flags);
@@ -8028,6 +8040,7 @@ void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)
 unlock:
 	mutex_unlock(&conn->lock);
 	l2cap_conn_put(conn);
+	return 0;
 }
 
 static struct hci_cb l2cap_cb = {

-- 
2.53.0

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

* [PATCH 6.6.y 2/3] Bluetooth: hci_core: lookup hci_conn on the ACL RX path
  2026-11-26  7:55     ` [PATCH 0/3] Bluetooth: hci_core: lookup hci_conn on the " Yu Junzhe
  2026-11-26  7:55       ` [PATCH 6.12.y 1/3] Bluetooth: hci_core: lookup hci_conn on the ACL and ISO RX paths Yu Junzhe
@ 2026-11-26  7:55       ` Yu Junzhe
  2026-11-26  7:55       ` [PATCH 6.1.y 3/3] " Yu Junzhe
  2026-11-26 10:20       ` [PATCH 0/3] Bluetooth: hci_core: lookup hci_conn on the " Greg Kroah-Hartman
  3 siblings, 0 replies; 8+ messages in thread
From: Yu Junzhe @ 2026-11-26  7:55 UTC (permalink / raw)
  To: stable
  Cc: Yu Junzhe, Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	linux-bluetooth, Greg Kroah-Hartman, Sasha Levin

commit 79a2d4678ba90bdba577dc3af88cc900d6dcd5ee upstream.

Move the hci_conn lookup into l2cap_recv_acldata() and hold the
l2cap_conn before dropping hci_dev_lock. 6.6.y has
l2cap_conn_hold_unless_zero(). sco_conn and iso_conn have no kref, so
those paths are unchanged.

Cc: stable@vger.kernel.org # 6.6
Fixes: 5af1f84ed13a ("Bluetooth: hci_sync: Fix UAF on hci_abort_conn_sync")
Signed-off-by: Yu Junzhe <junzheyu1@gmail.com>

---
 include/net/bluetooth/hci_core.h |  3 ++-
 net/bluetooth/hci_core.c         | 25 ++++++++-----------------
 net/bluetooth/l2cap_core.c       | 23 ++++++++++++++++++-----
 3 files changed, 28 insertions(+), 23 deletions(-)

diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 62804d98d..e0deaa54b 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -837,7 +837,8 @@ extern struct mutex hci_cb_list_lock;
 /* ----- HCI interface to upper protocols ----- */
 int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr);
 int l2cap_disconn_ind(struct hci_conn *hcon);
-void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags);
+int l2cap_recv_acldata(struct hci_dev *hdev, u16 handle, struct sk_buff *skb,
+		       u16 flags);
 
 #if IS_ENABLED(CONFIG_BT_BREDR)
 int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags);
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 84d9a445e..a54d29bad 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -3798,13 +3798,14 @@ static void hci_tx_work(struct work_struct *work)
 static void hci_acldata_packet(struct hci_dev *hdev, struct sk_buff *skb)
 {
 	struct hci_acl_hdr *hdr;
-	struct hci_conn *conn;
 	__u16 handle, flags;
+	int err;
 
 	hdr = skb_pull_data(skb, sizeof(*hdr));
 	if (!hdr) {
 		bt_dev_err(hdev, "ACL packet too small");
-		goto drop;
+		kfree_skb(skb);
+		return;
 	}
 
 	handle = __le16_to_cpu(hdr->handle);
@@ -3816,23 +3817,13 @@ static void hci_acldata_packet(struct hci_dev *hdev, struct sk_buff *skb)
 
 	hdev->stat.acl_rx++;
 
-	hci_dev_lock(hdev);
-	conn = hci_conn_hash_lookup_handle(hdev, handle);
-	hci_dev_unlock(hdev);
-
-	if (conn) {
-		hci_conn_enter_active_mode(conn, BT_POWER_FORCE_ACTIVE_OFF);
-
-		/* Send to upper protocol */
-		l2cap_recv_acldata(conn, skb, flags);
-		return;
-	} else {
+	err = l2cap_recv_acldata(hdev, handle, skb, flags);
+	if (err == -ENOENT)
 		bt_dev_err(hdev, "ACL packet for unknown connection handle %d",
 			   handle);
-	}
-
-drop:
-	kfree_skb(skb);
+	else if (err)
+		bt_dev_dbg(hdev, "ACL packet recv for handle %d failed: %d",
+			   handle, err);
 }
 
 /* SCO data packet */
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 94fddc456..5b5a9e763 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -7752,13 +7752,24 @@ struct l2cap_conn *l2cap_conn_hold_unless_zero(struct l2cap_conn *c)
 }
 EXPORT_SYMBOL(l2cap_conn_hold_unless_zero);
 
-void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)
+int l2cap_recv_acldata(struct hci_dev *hdev, u16 handle,
+		       struct sk_buff *skb, u16 flags)
 {
+	struct hci_conn *hcon;
 	struct l2cap_conn *conn;
 	int len;
 
-	/* Lock hdev to access l2cap_data to avoid race with l2cap_conn_del */
-	hci_dev_lock(hcon->hdev);
+	/* Lock hdev for hci_conn, and race on l2cap_data vs. l2cap_conn_del */
+	hci_dev_lock(hdev);
+
+	hcon = hci_conn_hash_lookup_handle(hdev, handle);
+	if (!hcon) {
+		hci_dev_unlock(hdev);
+		kfree_skb(skb);
+		return -ENOENT;
+	}
+
+	hci_conn_enter_active_mode(hcon, BT_POWER_FORCE_ACTIVE_OFF);
 
 	conn = hcon->l2cap_data;
 
@@ -7766,12 +7777,13 @@ void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)
 		conn = l2cap_conn_add(hcon);
 
 	conn = l2cap_conn_hold_unless_zero(conn);
+	hcon = NULL;
 
-	hci_dev_unlock(hcon->hdev);
+	hci_dev_unlock(hdev);
 
 	if (!conn) {
 		kfree_skb(skb);
-		return;
+		return -EINVAL;
 	}
 
 	BT_DBG("conn %p len %u flags 0x%x", conn, skb->len, flags);
@@ -7885,6 +7897,7 @@ void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)
 unlock:
 	mutex_unlock(&conn->lock);
 	l2cap_conn_put(conn);
+	return 0;
 }
 
 static struct hci_cb l2cap_cb = {

-- 
2.53.0

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

* [PATCH 6.1.y 3/3] Bluetooth: hci_core: lookup hci_conn on the ACL RX path
  2026-11-26  7:55     ` [PATCH 0/3] Bluetooth: hci_core: lookup hci_conn on the " Yu Junzhe
  2026-11-26  7:55       ` [PATCH 6.12.y 1/3] Bluetooth: hci_core: lookup hci_conn on the ACL and ISO RX paths Yu Junzhe
  2026-11-26  7:55       ` [PATCH 6.6.y 2/3] Bluetooth: hci_core: lookup hci_conn on the ACL " Yu Junzhe
@ 2026-11-26  7:55       ` Yu Junzhe
  2026-11-26 10:20       ` [PATCH 0/3] Bluetooth: hci_core: lookup hci_conn on the " Greg Kroah-Hartman
  3 siblings, 0 replies; 8+ messages in thread
From: Yu Junzhe @ 2026-11-26  7:55 UTC (permalink / raw)
  To: stable
  Cc: Yu Junzhe, Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	linux-bluetooth, Greg Kroah-Hartman, Sasha Levin

commit 79a2d4678ba90bdba577dc3af88cc900d6dcd5ee upstream.

Move the hci_conn lookup into l2cap_recv_acldata() and hold the
l2cap_conn before dropping hci_dev_lock. 6.1.y has
l2cap_conn_hold_unless_zero(). sco_conn and iso_conn have no kref, so
those paths are unchanged.

Cc: stable@vger.kernel.org # 6.1
Fixes: 5af1f84ed13a ("Bluetooth: hci_sync: Fix UAF on hci_abort_conn_sync")
Signed-off-by: Yu Junzhe <junzheyu1@gmail.com>

---
 include/net/bluetooth/hci_core.h |  3 ++-
 net/bluetooth/hci_core.c         | 25 ++++++++-----------------
 net/bluetooth/l2cap_core.c       | 29 ++++++++++++++++++++++-------
 3 files changed, 32 insertions(+), 25 deletions(-)

diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index f47a88d39..1a483be00 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -824,7 +824,8 @@ extern struct mutex hci_cb_list_lock;
 /* ----- HCI interface to upper protocols ----- */
 int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr);
 int l2cap_disconn_ind(struct hci_conn *hcon);
-void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags);
+int l2cap_recv_acldata(struct hci_dev *hdev, u16 handle, struct sk_buff *skb,
+		       u16 flags);
 
 #if IS_ENABLED(CONFIG_BT_BREDR)
 int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags);
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 7ec3af3a4..580921ff4 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -3802,13 +3802,14 @@ static void hci_tx_work(struct work_struct *work)
 static void hci_acldata_packet(struct hci_dev *hdev, struct sk_buff *skb)
 {
 	struct hci_acl_hdr *hdr;
-	struct hci_conn *conn;
 	__u16 handle, flags;
+	int err;
 
 	hdr = skb_pull_data(skb, sizeof(*hdr));
 	if (!hdr) {
 		bt_dev_err(hdev, "ACL packet too small");
-		goto drop;
+		kfree_skb(skb);
+		return;
 	}
 
 	handle = __le16_to_cpu(hdr->handle);
@@ -3820,23 +3821,13 @@ static void hci_acldata_packet(struct hci_dev *hdev, struct sk_buff *skb)
 
 	hdev->stat.acl_rx++;
 
-	hci_dev_lock(hdev);
-	conn = hci_conn_hash_lookup_handle(hdev, handle);
-	hci_dev_unlock(hdev);
-
-	if (conn) {
-		hci_conn_enter_active_mode(conn, BT_POWER_FORCE_ACTIVE_OFF);
-
-		/* Send to upper protocol */
-		l2cap_recv_acldata(conn, skb, flags);
-		return;
-	} else {
+	err = l2cap_recv_acldata(hdev, handle, skb, flags);
+	if (err == -ENOENT)
 		bt_dev_err(hdev, "ACL packet for unknown connection handle %d",
 			   handle);
-	}
-
-drop:
-	kfree_skb(skb);
+	else if (err)
+		bt_dev_dbg(hdev, "ACL packet recv for handle %d failed: %d",
+			   handle, err);
 }
 
 /* SCO data packet */
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index d7bb11931..a8a3afabe 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -7908,13 +7908,24 @@ struct l2cap_conn *l2cap_conn_hold_unless_zero(struct l2cap_conn *c)
 }
 EXPORT_SYMBOL(l2cap_conn_hold_unless_zero);
 
-void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)
+int l2cap_recv_acldata(struct hci_dev *hdev, u16 handle,
+		       struct sk_buff *skb, u16 flags)
 {
+	struct hci_conn *hcon;
 	struct l2cap_conn *conn;
 	int len;
 
-	/* Lock hdev to access l2cap_data to avoid race with l2cap_conn_del */
-	hci_dev_lock(hcon->hdev);
+	/* Lock hdev for hci_conn, and race on l2cap_data vs. l2cap_conn_del */
+	hci_dev_lock(hdev);
+
+	hcon = hci_conn_hash_lookup_handle(hdev, handle);
+	if (!hcon) {
+		hci_dev_unlock(hdev);
+		kfree_skb(skb);
+		return -ENOENT;
+	}
+
+	hci_conn_enter_active_mode(hcon, BT_POWER_FORCE_ACTIVE_OFF);
 
 	conn = hcon->l2cap_data;
 
@@ -7922,11 +7933,14 @@ void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)
 		conn = l2cap_conn_add(hcon);
 
 	conn = l2cap_conn_hold_unless_zero(conn);
+	hcon = NULL;
 
-	hci_dev_unlock(hcon->hdev);
+	hci_dev_unlock(hdev);
 
-	if (!conn)
-		goto drop;
+	if (!conn) {
+		kfree_skb(skb);
+		return -EINVAL;
+	}
 
 	BT_DBG("conn %p len %u flags 0x%x", conn, skb->len, flags);
 
@@ -7954,7 +7968,7 @@ void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)
 		if (len == skb->len) {
 			/* Complete frame received */
 			l2cap_recv_frame(conn, skb);
-			return;
+			return 0;
 		}
 
 		BT_DBG("Start: total len %d, frag len %u", len, skb->len);
@@ -8020,6 +8034,7 @@ void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)
 
 drop:
 	kfree_skb(skb);
+	return 0;
 }
 
 static struct hci_cb l2cap_cb = {

-- 
2.53.0

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

* Re: [PATCH 0/3] Bluetooth: hci_core: lookup hci_conn on the RX path
  2026-11-26  7:55     ` [PATCH 0/3] Bluetooth: hci_core: lookup hci_conn on the " Yu Junzhe
                         ` (2 preceding siblings ...)
  2026-11-26  7:55       ` [PATCH 6.1.y 3/3] " Yu Junzhe
@ 2026-11-26 10:20       ` Greg Kroah-Hartman
  3 siblings, 0 replies; 8+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-26 10:20 UTC (permalink / raw)
  To: Yu Junzhe
  Cc: stable, Marcel Holtmann, Johan Hedberg, Luiz Augusto von Dentz,
	linux-bluetooth, Sasha Levin

On Thu, Nov 26, 2026 at 07:55:51AM +0000, Yu Junzhe wrote:
> Sasha, this replaces the 6.6-only v2.
> 
> 79a2d4678ba9 ("Bluetooth: hci_core: lookup hci_conn on RX path on
> protocol side") is in v6.18 and is already in bluetooth.git. These
> diffs are for the stable trees that still lack it. They do not apply
> to bluetooth.git HEAD, so the BlueZ CI apply check will fail. Please
> review them for the stable branches.
> 
> 6.12.y already has l2cap_conn_hold_unless_zero() and
> iso_conn_hold_unless_zero(). 6.6.y and 6.1.y have the L2CAP helper
> only. sco_conn has no kref on any of the three, so SCO is unchanged.
> hci_conn_get() does not pin sco_conn.
> 
> Booted KASAN guests, same racer (patch-test/repro.c):
> 
> - 6.12.119 unpatched printed slab-use-after-free in l2cap_recv_acldata.
>   6.12.119 with patch 1/3 finished 371 connect/auth/disconnect rounds
>   and printed no KASAN report. The racer exercises ACL, not ISO.
> - 6.6.162 with patch 2/3 finished 123 rounds and printed no KASAN
>   report. That image is a build of this diff. The earlier #1 image
>   still contained the v1 SCO and ISO edits.
> - 6.1.193 with patch 3/3 booted and completed one connection with no
>   KASAN report. The racer then lost sync with the virtual controller
>   (unexpected command-complete length), so it did not repeat the
>   6.12 and 6.6 stress.
> 
> Yu Junzhe (3):
>   Bluetooth: hci_core: lookup hci_conn on the ACL and ISO RX paths
>   Bluetooth: hci_core: lookup hci_conn on the ACL RX path
>   Bluetooth: hci_core: lookup hci_conn on the ACL RX path

Why are these different subjects?

Also, don't send a patch series for different branches.  Please redo
this, one patch per branch, and keep the changelog and subjects
identical to upstream.

thanks,

greg k-h

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

* RE: Bluetooth: hci_core: lookup hci_conn on the RX path
  2026-11-26  7:55       ` [PATCH 6.12.y 1/3] Bluetooth: hci_core: lookup hci_conn on the ACL and ISO RX paths Yu Junzhe
@ 2026-11-26 12:19         ` bluez.test.bot
  0 siblings, 0 replies; 8+ messages in thread
From: bluez.test.bot @ 2026-11-26 12:19 UTC (permalink / raw)
  To: linux-bluetooth, junzheyu1

[-- Attachment #1: Type: text/plain, Size: 1171 bytes --]

This is an automated email and please do not reply to this email.

Dear Submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.

----- Output -----

error: patch failed: include/net/bluetooth/hci_core.h:843
error: include/net/bluetooth/hci_core.h: patch does not apply
error: patch failed: net/bluetooth/hci_core.c:3865
error: net/bluetooth/hci_core.c: patch does not apply
error: patch failed: net/bluetooth/iso.c:2424
error: net/bluetooth/iso.c: patch does not apply
error: patch failed: net/bluetooth/l2cap_core.c:7895
error: net/bluetooth/l2cap_core.c: patch does not apply
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"

Please resolve the issue and submit the patches again.


---
Regards,
Linux Bluetooth


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

end of thread, other threads:[~2026-11-26 12:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-18 12:35 [PATCH 6.6] Bluetooth: hci_core: lookup hci_conn on RX path Yu Junzhe
2026-11-18 18:23 ` [6.6] " bluez.test.bot
     [not found] ` <20261119035758.45-1-junzheyu1@gmail.com>
     [not found]   ` <2026-11-19-1-daily-reply-0012@kernel.org>
2026-11-26  7:55     ` [PATCH 0/3] Bluetooth: hci_core: lookup hci_conn on the " Yu Junzhe
2026-11-26  7:55       ` [PATCH 6.12.y 1/3] Bluetooth: hci_core: lookup hci_conn on the ACL and ISO RX paths Yu Junzhe
2026-11-26 12:19         ` Bluetooth: hci_core: lookup hci_conn on the RX path bluez.test.bot
2026-11-26  7:55       ` [PATCH 6.6.y 2/3] Bluetooth: hci_core: lookup hci_conn on the ACL " Yu Junzhe
2026-11-26  7:55       ` [PATCH 6.1.y 3/3] " Yu Junzhe
2026-11-26 10:20       ` [PATCH 0/3] Bluetooth: hci_core: lookup hci_conn on the " Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox