Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH net] 6lowpan: fix off-by-one in multicast context address compression
@ 2026-05-27  8:18 Yizhou Zhao
  2026-05-27 10:59 ` [net] " bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: Yizhou Zhao @ 2026-05-27  8:18 UTC (permalink / raw)
  To: netdev
  Cc: Yizhou Zhao, Alexander Aring, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Simon Horman, linux-bluetooth,
	linux-wpan, linux-kernel, Yuxiang Yang, Ao Wang, Xuewei Feng,
	Qi Li, Ke Xu

The second memcpy in lowpan_iphc_mcast_ctx_addr_compress() uses
&data[1] as destination and &ipaddr->s6_addr[11] as source, but
both should be offset by one: &data[2] and &ipaddr->s6_addr[12]
respectively.

This off-by-one has two consequences:
1. data[1] is overwritten with s6_addr[11], corrupting the RIID
   field in the compressed multicast address
2. data[5] is never written, so uninitialized kernel stack memory
   is transmitted over the network via lowpan_push_hc_data(),
   leaking kernel stack contents

The correct inline data layout must match what the decompression
function lowpan_uncompress_multicast_ctx_daddr() expects:
  data[0..1] = s6_addr[1..2]  (flags/scope + RIID)
  data[2..5] = s6_addr[12..15] (group ID)

Also zero-initialize the data array as a defensive measure against
similar bugs in the future.

Fixes: 5609c185f24d ("6lowpan: iphc: add support for stateful compression")
Reported-by: Yizhou Zhao <zhaoyz24@mails.tsinghua.edu.cn>
Reported-by: Yuxiang Yang <yangyx22@mails.tsinghua.edu.cn>
Reported-by: Ao Wang <wangao@seu.edu.cn>
Reported-by: Xuewei Feng <fengxw06@126.com>
Reported-by: Qi Li <qli01@tsinghua.edu.cn>
Reported-by: Ke Xu <xuke@tsinghua.edu.cn>
Assisted-by: GLM:GLM-5.1
Signed-off-by: Yizhou Zhao <zhaoyz24@mails.tsinghua.edu.cn>
---
diff --git a/net/6lowpan/iphc.c b/net/6lowpan/iphc.c
index e116d30..37eaff3 100644
--- a/net/6lowpan/iphc.c
+++ b/net/6lowpan/iphc.c
@@ -1086,12 +1086,12 @@ static u8 lowpan_iphc_mcast_ctx_addr_compress(u8 **hc_ptr,
 					      const struct lowpan_iphc_ctx *ctx,
 					      const struct in6_addr *ipaddr)
 {
-	u8 data[6];
+	u8 data[6] = {};
 
 	/* flags/scope, reserved (RIID) */
 	memcpy(data, &ipaddr->s6_addr[1], 2);
 	/* group ID */
-	memcpy(&data[1], &ipaddr->s6_addr[11], 4);
+	memcpy(&data[2], &ipaddr->s6_addr[12], 4);
 	lowpan_push_hc_data(hc_ptr, data, 6);
 
 	return LOWPAN_IPHC_DAM_00;


--
2.43.0


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

* RE: [net] 6lowpan: fix off-by-one in multicast context address compression
  2026-05-27  8:18 [PATCH net] 6lowpan: fix off-by-one in multicast context address compression Yizhou Zhao
@ 2026-05-27 10:59 ` bluez.test.bot
  0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2026-05-27 10:59 UTC (permalink / raw)
  To: linux-bluetooth, zhaoyz24

[-- Attachment #1: Type: text/plain, Size: 4381 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=1101476

---Test result---

Test Summary:
CheckPatch                    FAIL      0.58 seconds
VerifyFixes                   PASS      0.09 seconds
VerifySignedoff               PASS      0.08 seconds
GitLint                       PASS      0.23 seconds
SubjectPrefix                 FAIL      0.08 seconds
BuildKernel                   PASS      26.92 seconds
CheckAllWarning               PASS      29.05 seconds
CheckSparse                   PASS      27.15 seconds
BuildKernel32                 PASS      25.60 seconds
TestRunnerSetup               PASS      572.33 seconds
TestRunner_l2cap-tester       FAIL      58.33 seconds
TestRunner_iso-tester         PASS      79.66 seconds
TestRunner_bnep-tester        PASS      19.58 seconds
TestRunner_mgmt-tester        FAIL      224.69 seconds
TestRunner_rfcomm-tester      PASS      26.56 seconds
TestRunner_sco-tester         PASS      33.37 seconds
TestRunner_ioctl-tester       PASS      26.48 seconds
TestRunner_mesh-tester        FAIL      25.91 seconds
TestRunner_smp-tester         PASS      23.48 seconds
TestRunner_userchan-tester    PASS      20.47 seconds
TestRunner_6lowpan-tester     PASS      23.45 seconds
IncrementalBuild              PASS      25.25 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[net] 6lowpan: fix off-by-one in multicast context address compression
WARNING: Reported-by: should be immediately followed by Closes: with a URL to the report
#113: 
Reported-by: Yizhou Zhao <zhaoyz24@mails.tsinghua.edu.cn>
Reported-by: Yuxiang Yang <yangyx22@mails.tsinghua.edu.cn>

WARNING: Reported-by: should be immediately followed by Closes: with a URL to the report
#114: 
Reported-by: Yuxiang Yang <yangyx22@mails.tsinghua.edu.cn>
Reported-by: Ao Wang <wangao@seu.edu.cn>

WARNING: Reported-by: should be immediately followed by Closes: with a URL to the report
#115: 
Reported-by: Ao Wang <wangao@seu.edu.cn>
Reported-by: Xuewei Feng <fengxw06@126.com>

WARNING: Reported-by: should be immediately followed by Closes: with a URL to the report
#116: 
Reported-by: Xuewei Feng <fengxw06@126.com>
Reported-by: Qi Li <qli01@tsinghua.edu.cn>

WARNING: Reported-by: should be immediately followed by Closes: with a URL to the report
#117: 
Reported-by: Qi Li <qli01@tsinghua.edu.cn>
Reported-by: Ke Xu <xuke@tsinghua.edu.cn>

WARNING: Reported-by: should be immediately followed by Closes: with a URL to the report
#118: 
Reported-by: Ke Xu <xuke@tsinghua.edu.cn>
Assisted-by: GLM:GLM-5.1

total: 0 errors, 6 warnings, 0 checks, 14 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/14596745.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: SubjectPrefix - FAIL
Desc: Check subject contains "Bluetooth" prefix
Output:
"Bluetooth: " prefix is not specified in the subject
##############################
Test: TestRunner_l2cap-tester - FAIL
Desc: Run l2cap-tester with test-runner
Output:
Total: 96, Passed: 95 (99.0%), Failed: 1, Not Run: 0

Failed Test Cases
L2CAP BR/EDR Server - Set PHY 3M                     Failed       0.251 seconds
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 494, Passed: 489 (99.0%), Failed: 1, Not Run: 4

Failed Test Cases
Read Exp Feature - Success                           Failed       0.260 seconds
##############################
Test: TestRunner_mesh-tester - FAIL
Desc: Run mesh-tester with test-runner
Output:
Total: 10, Passed: 8 (80.0%), Failed: 2, Not Run: 0

Failed Test Cases
Mesh - Send cancel - 1                               Timed out    2.497 seconds
Mesh - Send cancel - 2                               Timed out    1.995 seconds


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

---
Regards,
Linux Bluetooth


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

end of thread, other threads:[~2026-05-27 10:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-27  8:18 [PATCH net] 6lowpan: fix off-by-one in multicast context address compression Yizhou Zhao
2026-05-27 10:59 ` [net] " 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