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

* RE: Bluetooth: ISO: check end fragment length before appending
  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
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2026-07-08 15:09 UTC (permalink / raw)
  To: linux-bluetooth, lgs201920130244

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

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1123839

---Test result---

Test Summary:
CheckPatch                    PASS      0.55 seconds
VerifyFixes                   PASS      0.07 seconds
VerifySignedoff               PASS      0.07 seconds
GitLint                       PASS      0.21 seconds
SubjectPrefix                 PASS      0.06 seconds
BuildKernel                   PASS      27.37 seconds
CheckAllWarning               PASS      30.15 seconds
CheckSparse                   PASS      28.36 seconds
BuildKernel32                 PASS      26.34 seconds
CheckKernelLLVM               SKIP      0.00 seconds
TestRunnerSetup               PASS      497.81 seconds
TestRunner_iso-tester         PASS      82.17 seconds
IncrementalBuild              PASS      26.83 seconds

Details
##############################
Test: CheckKernelLLVM - SKIP
Desc: Build kernel with LLVM + context analysis
Output:
Clang not found


https://github.com/bluez/bluetooth-next/pull/411

---
Regards,
Linux Bluetooth


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

* Re: [PATCH] Bluetooth: ISO: check end fragment length before appending
  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 ` Luiz Augusto von Dentz
  1 sibling, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2026-07-10 19:44 UTC (permalink / raw)
  To: Guangshuo Li; +Cc: Marcel Holtmann, linux-bluetooth, linux-kernel

Hi Guangshuo,

On Wed, Jul 8, 2026 at 8:12 AM Guangshuo Li <lgs201920130244@gmail.com> wrote:
>
> 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

Looks like this is already being handled according to sashiko:

https://sashiko.dev/#/patchset/20260708121205.756886-1-lgs201920130244%40gmail.com

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[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