* [PATCH] 6lowpan: fix NHC entry use-after-free on error path
@ 2026-06-09 8:00 Yizhou Zhao
2026-06-09 9:30 ` bluez.test.bot
0 siblings, 1 reply; 2+ messages in thread
From: Yizhou Zhao @ 2026-06-09 8:00 UTC (permalink / raw)
To: linux-bluetooth
Cc: Yizhou Zhao, Alexander Aring, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, linux-wpan, netdev,
linux-kernel, Yuxiang Yang, Ao Wang, Xuewei Feng, Qi Li, Ke Xu,
stable
lowpan_nhc_do_uncompression() looks up an NHC descriptor while holding
lowpan_nhc_lock. If the descriptor has no uncompress callback, the error
path drops the lock before printing nhc->name.
lowpan_nhc_del() removes descriptors under the same lock and then relies
on synchronize_net() before the owning module can be unloaded. That only
waits for net RX RCU readers. lowpan_header_decompress() is also exported
and can be reached from callers that are not necessarily covered by the net
core RX critical section, for example the Bluetooth 6LoWPAN L2CAP receive
path.
This leaves a race where one task drops lowpan_nhc_lock in the error path,
another task unregisters and frees the matching descriptor after
synchronize_net() returns, and the first task then dereferences nhc->name
for the warning.
With the post-unlock window widened, KASAN reports:
BUG: KASAN: slab-use-after-free in lowpan_nhc_do_uncompression+0x1f4/0x220
Read of size 8
lowpan_nhc_do_uncompression
lowpan_header_decompress
Fix this by printing the warning before dropping lowpan_nhc_lock, so the
descriptor name is read while unregister is still excluded. The malformed
packet is still rejected with -ENOTSUPP.
Fixes: 92aa7c65d295 ("6lowpan: add generic nhc layer interface")
Cc: stable@vger.kernel.org
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/nhc.c b/net/6lowpan/nhc.c
index 7b374595328d..a4dde85664f2 100644
--- a/net/6lowpan/nhc.c
+++ b/net/6lowpan/nhc.c
@@ -117,9 +117,9 @@ int lowpan_nhc_do_uncompression(struct sk_buff *skb,
return ret;
}
} else {
- spin_unlock_bh(&lowpan_nhc_lock);
netdev_warn(dev, "received nhc id for %s which is not implemented.\n",
nhc->name);
+ spin_unlock_bh(&lowpan_nhc_lock);
return -ENOTSUPP;
}
} else {
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* RE: 6lowpan: fix NHC entry use-after-free on error path
2026-06-09 8:00 [PATCH] 6lowpan: fix NHC entry use-after-free on error path Yizhou Zhao
@ 2026-06-09 9:30 ` bluez.test.bot
0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2026-06-09 9:30 UTC (permalink / raw)
To: linux-bluetooth, zhaoyz24
[-- Attachment #1: Type: text/plain, Size: 4094 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=1108371
---Test result---
Test Summary:
CheckPatch FAIL 0.75 seconds
VerifyFixes PASS 0.13 seconds
VerifySignedoff PASS 0.14 seconds
GitLint PASS 0.34 seconds
SubjectPrefix FAIL 0.13 seconds
BuildKernel PASS 28.31 seconds
CheckAllWarning PASS 31.95 seconds
CheckSparse PASS 29.63 seconds
BuildKernel32 PASS 27.13 seconds
TestRunnerSetup PASS 596.34 seconds
TestRunner_l2cap-tester PASS 65.08 seconds
TestRunner_iso-tester PASS 86.94 seconds
TestRunner_bnep-tester PASS 20.27 seconds
TestRunner_mgmt-tester FAIL 224.52 seconds
TestRunner_rfcomm-tester PASS 26.68 seconds
TestRunner_sco-tester PASS 34.10 seconds
TestRunner_ioctl-tester PASS 27.51 seconds
TestRunner_mesh-tester FAIL 26.96 seconds
TestRunner_smp-tester PASS 24.40 seconds
TestRunner_userchan-tester PASS 21.02 seconds
TestRunner_6lowpan-tester PASS 23.79 seconds
IncrementalBuild PASS 26.60 seconds
Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
6lowpan: fix NHC entry use-after-free on error path
WARNING: Reported-by: should be immediately followed by Closes: with a URL to the report
#120:
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
#121:
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
#122:
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
#123:
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
#124:
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
#125:
Reported-by: Ke Xu <xuke@tsinghua.edu.cn>
Assisted-by: GLM:GLM-5.1
total: 0 errors, 6 warnings, 0 checks, 10 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/14618776.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_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.265 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.252 seconds
Mesh - Send cancel - 2 Timed out 1.985 seconds
https://github.com/bluez/bluetooth-next/pull/298
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-09 9:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-09 8:00 [PATCH] 6lowpan: fix NHC entry use-after-free on error path Yizhou Zhao
2026-06-09 9:30 ` 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