* [PATCH] Bluetooth: RFCOMM: validate skb length in rfcomm_recv_frame
@ 2026-07-22 9:26 Jiale Yao
2026-07-22 10:02 ` bluez.test.bot
0 siblings, 1 reply; 2+ messages in thread
From: Jiale Yao @ 2026-07-22 9:26 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, Kees Cook,
Jakub Kicinski, Jiale Yao, Bastien Nocera, SeungJu Cheon,
Pengpeng Hou, Tim Bird, linux-bluetooth, linux-kernel
rfcomm_recv_frame() casts skb->data to struct rfcomm_hdr and dereferences
hdr->addr and hdr->ctrl without validating skb->len first. A truncated
frame with skb->len less than the minimum header size causes an
out-of-bounds read of uninitialized memory. Additionally, a zero-length
frame causes skb->len-- to underflow to UINT_MAX, making
skb_tail_pointer() read far past the buffer.
Commit 23882b828c3c ("Bluetooth: RFCOMM: validate skb length in MCC
handlers") fixed the same class of missing-length-check bugs in the MCC
sub-handlers, but the top-level rfcomm_recv_frame() was left unfixed.
KMSAN reports:
BUG: KMSAN: uninit-value in rfcomm_run
...
Uninit was created at:
__alloc_skb+0x474/0xb60
vhci_write+0xe9/0x870
Fix this by rejecting frames smaller than sizeof(struct rfcomm_hdr) + 1
(the minimum frame must have a 3-byte header and a 1-byte FCS).
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
net/bluetooth/rfcomm/core.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index ebeae17b71d1..37c23ef47baf 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -1778,6 +1778,11 @@ static struct rfcomm_session *rfcomm_recv_frame(struct rfcomm_session *s,
return s;
}
+ if (skb->len < sizeof(*hdr) + 1) {
+ kfree_skb(skb);
+ return s;
+ }
+
dlci = __get_dlci(hdr->addr);
type = __get_type(hdr->ctrl);
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* RE: Bluetooth: RFCOMM: validate skb length in rfcomm_recv_frame
2026-07-22 9:26 [PATCH] Bluetooth: RFCOMM: validate skb length in rfcomm_recv_frame Jiale Yao
@ 2026-07-22 10:02 ` bluez.test.bot
0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2026-07-22 10:02 UTC (permalink / raw)
To: linux-bluetooth, yaojiale02
[-- Attachment #1: Type: text/plain, Size: 1930 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=1132292
---Test result---
Test Summary:
CheckPatch FAIL 0.72 seconds
VerifyFixes PASS 0.13 seconds
VerifySignedoff PASS 0.13 seconds
GitLint PASS 0.33 seconds
SubjectPrefix PASS 0.13 seconds
BuildKernel PASS 25.39 seconds
CheckAllWarning PASS 27.95 seconds
CheckSparse PASS 26.58 seconds
BuildKernel32 PASS 24.89 seconds
CheckKernelLLVM SKIP 0.00 seconds
TestRunnerSetup PASS 460.25 seconds
TestRunner_rfcomm-tester PASS 25.82 seconds
IncrementalBuild PASS 23.92 seconds
Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
Bluetooth: RFCOMM: validate skb length in rfcomm_recv_frame
WARNING: The commit message has 'BUG: KMSAN: ', perhaps it also needs a 'Fixes:' tag?
total: 0 errors, 1 warnings, 0 checks, 11 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/github/workspace/src/patch/14702860.patch has style problems, please review.
NOTE: Ignored message types: UNKNOWN_COMMIT_ID
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
##############################
Test: CheckKernelLLVM - SKIP
Desc: Build kernel with LLVM + context analysis
Output:
Clang not found
https://github.com/bluez/bluetooth-next/pull/475
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-22 10:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-22 9:26 [PATCH] Bluetooth: RFCOMM: validate skb length in rfcomm_recv_frame Jiale Yao
2026-07-22 10:02 ` bluez.test.bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox