Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: ISO: check end fragment length before appending
@ 2026-07-08 12:12 Guangshuo Li
  2026-07-08 15:09 ` bluez.test.bot
  2026-07-10 19:44 ` [PATCH] " Luiz Augusto von Dentz
  0 siblings, 2 replies; 3+ messages in thread
From: Guangshuo Li @ 2026-07-08 12:12 UTC (permalink / raw)
  To: Marcel Holtmann, Luiz Augusto von Dentz, linux-bluetooth,
	linux-kernel
  Cc: Guangshuo Li

ISO fragment reassembly keeps conn->rx_len as the remaining space in
conn->rx_skb.

The ISO_CONT path checks both that a reassembly is in progress and that
the incoming fragment does not exceed the remaining length before
appending it to conn->rx_skb. The ISO_END path only checks that a
reassembly is in progress.

A malformed ISO_END fragment can therefore be larger than the remaining
space in conn->rx_skb. In that case skb_put() advances past the end of
the reassembly buffer before the fragment is copied.

Reject oversized ISO_END fragments the same way ISO_CONT does, and drop
the partially reassembled frame.

Fixes: ccf74f2390d6 ("Bluetooth: Add BTPROTO_ISO socket type")
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
 net/bluetooth/iso.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/net/bluetooth/iso.c b/net/bluetooth/iso.c
index 793a481d7066..f5ca8db3c206 100644
--- a/net/bluetooth/iso.c
+++ b/net/bluetooth/iso.c
@@ -2639,6 +2639,15 @@ int iso_recv(struct hci_dev *hdev, u16 handle, struct sk_buff *skb, u16 flags)
 			goto drop;
 		}
 
+		if (skb->len > conn->rx_len) {
+			BT_ERR("End fragment is too long (len %d, expected %d)",
+			       skb->len, conn->rx_len);
+			kfree_skb(conn->rx_skb);
+			conn->rx_skb = NULL;
+			conn->rx_len = 0;
+			goto drop;
+		}
+
 		skb_copy_from_linear_data(skb, skb_put(conn->rx_skb, skb->len),
 					  skb->len);
 		conn->rx_len -= skb->len;
-- 
2.43.0


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

end of thread, other threads:[~2026-07-10 19:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-08 12:12 [PATCH] Bluetooth: ISO: check end fragment length before appending Guangshuo Li
2026-07-08 15:09 ` bluez.test.bot
2026-07-10 19:44 ` [PATCH] " Luiz Augusto von Dentz

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